aboutsummaryrefslogtreecommitdiffstats
path: root/Main.gd
blob: 813d22bd3fb5bf0377c9ba7859c99d19e2a7b6b8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
extends Node2D

export(PackedScene) var enemy_scene
onready var globals = get_node("/root/Global")

# Called when the node enters the scene tree for the first time.
func _ready():
	randomize()
	get_node("Player").connect("hit", get_node("HUD/HBoxContainer/HealthBar"), "_on_player_hit")
	get_node("Player").connect("coin", get_node("HUD/HBoxContainer/CoinCount"), "_on_coin_hit")
	get_node("Player").connect("coin", get_node("HUD/GameOver/GameOverCoinMessage/GameOverCoinCount"), "_on_coin_hit")
	$EnemySpawnTimer.start()


# Called every frame. 'delta' is the elapsed time since the previous frame.
#func _process(delta):
#	pass


func _on_EnemySpawnTimer_timeout():
	var enemy = enemy_scene.instance()
	var spawn_loc = get_node("EnemySpawn/EnemySpawnLocation")
	spawn_loc.offset = randi()
	enemy.position = spawn_loc.position
	add_child(enemy)