2018-05-23 01:40:45 -04:00
|
|
|
extends Node
|
2018-05-23 03:57:15 -04:00
|
|
|
|
2018-05-23 01:40:45 -04:00
|
|
|
export (PackedScene) var FirstBad
|
2018-05-23 03:57:15 -04:00
|
|
|
export (PackedScene) var BlobBad
|
|
|
|
|
2018-05-23 01:40:45 -04:00
|
|
|
var position = Vector2(200, 200)
|
|
|
|
var total_bads_spawned = 0
|
|
|
|
var upgrade_cost = 50
|
|
|
|
|
|
|
|
func _ready():
|
|
|
|
$BaddieTimer.start()
|
|
|
|
randomize()
|
2018-05-23 03:57:15 -04:00
|
|
|
updatePoints()
|
2018-05-23 01:40:45 -04:00
|
|
|
|
|
|
|
func _process(delta):
|
|
|
|
if (Input.is_action_pressed("ctlr_l")):
|
|
|
|
if (Input.is_action_pressed("ctlr_r")):
|
|
|
|
if (Input.is_action_pressed("ctlr_a")):
|
|
|
|
if (Input.is_action_pressed("ctlr_start")):
|
|
|
|
get_tree().quit()
|
|
|
|
if (Input.is_action_pressed("ui_quit")):
|
|
|
|
get_tree().quit()
|
2018-05-23 03:57:15 -04:00
|
|
|
updatePoints()
|
2018-05-23 01:40:45 -04:00
|
|
|
|
2018-05-23 03:57:15 -04:00
|
|
|
func _on_bad_death(kill_money):
|
2018-05-23 01:40:45 -04:00
|
|
|
$Player.money += kill_money
|
2018-05-23 03:57:15 -04:00
|
|
|
updatePoints()
|
2018-05-23 01:40:45 -04:00
|
|
|
|
|
|
|
var sendblob = 0
|
|
|
|
func BaddieTimer():
|
|
|
|
if total_bads_spawned < 11:
|
|
|
|
var bad
|
2018-05-23 03:57:15 -04:00
|
|
|
|
2018-05-23 01:40:45 -04:00
|
|
|
if sendblob == 5:
|
|
|
|
sendblob = 0
|
2018-05-23 03:57:15 -04:00
|
|
|
bad = BlobBad.instance()
|
2018-05-23 01:40:45 -04:00
|
|
|
else:
|
|
|
|
bad = FirstBad.instance()
|
|
|
|
sendblob += 1
|
2018-05-23 03:57:15 -04:00
|
|
|
|
|
|
|
add_child(bad)
|
|
|
|
bad.connect("dead", self, "_on_bad_death")
|
2018-05-23 01:40:45 -04:00
|
|
|
total_bads_spawned += 1
|
2018-05-23 03:57:15 -04:00
|
|
|
$BaddieTimer.wait_time = $BaddieTimer.wait_time * 0.97
|
2018-05-23 01:40:45 -04:00
|
|
|
|
2018-05-23 03:57:15 -04:00
|
|
|
updatePoints()
|
2018-05-23 01:40:45 -04:00
|
|
|
|
|
|
|
bad.position.x = 1200
|
2018-05-23 04:34:13 -04:00
|
|
|
bad.position.y = (randi()%470) + 40
|
2018-05-23 01:40:45 -04:00
|
|
|
else:
|
|
|
|
total_bads_spawned = 0
|
|
|
|
|
|
|
|
func _on_PauseButton_pressed():
|
2018-05-23 11:02:52 -04:00
|
|
|
$Player.upgradeMenu()
|
2018-05-23 03:57:15 -04:00
|
|
|
|
|
|
|
func updatePoints():
|
|
|
|
$MoneyDisplay.text = str($Player.money, " points")
|
|
|
|
|
2018-05-23 11:02:52 -04:00
|
|
|
func _on_Player_update_display():
|
|
|
|
updatePoints()
|