Fronter/Main.gd

71 lines
1.8 KiB
GDScript3
Raw Normal View History

extends Node
export (PackedScene) var FirstBad
export (PackedScene) var BadBlob
export (PackedScene) var UpgradeMenu
# class member variables go here, for example:
# var a = 2
# var b = "textvar"
var position = Vector2(200, 200)
var kill_money = 10
var total_bads_spawned = 0
var upgrade_cost = 50
func _ready():
$BaddieTimer.start()
randomize()
$MoneyDisplay.text = str($Player.money, " points")
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()
$MoneyDisplay.text = str($Player.money, " points")
func _on_bad1_death():
$Player.money += kill_money
$MoneyDisplay.text = str($Player.money, " points")
func _on_badblob_death():
$Player.money += kill_money*2
$MoneyDisplay.text = str($Player.money, " points")
var sendblob = 0
func BaddieTimer():
prints ("baddie boi")
if total_bads_spawned < 11:
var bad
if sendblob == 5:
sendblob = 0
bad = BadBlob.instance()
add_child(bad)
bad.connect("dead", self, "_on_badblob_death")
else:
bad = FirstBad.instance()
add_child(bad)
sendblob += 1
bad.connect("dead", self, "_on_bad1_death")
total_bads_spawned += 1
$BaddieTimer.wait_time = $BaddieTimer.wait_time * 0.99
$MoneyDisplay.text = str($Player.money, " points")
bad.position.x = 1200
bad.position.y = randi()%500 + 25
else:
$Player.money += 200
total_bads_spawned = 0
func _on_Player_shooting_speed_upgrade():
#$MoneyDisplay.text = str($Player.money, " points")
pass
func _on_PauseButton_pressed():
var upgmenu
upgmenu = UpgradeMenu.instance()
add_child(upgmenu)
get_tree().paused = true # replace with function body