mirror of
https://github.com/creyD/ludum_dare_46.git
synced 2026-06-14 22:32:24 +02:00
setup for ai
This commit is contained in:
23
src/Objects/Torch/Torch.gd
Normal file
23
src/Objects/Torch/Torch.gd
Normal file
@@ -0,0 +1,23 @@
|
||||
extends StaticBody2D
|
||||
|
||||
export(int, 1, 5) var lifePoints = 3
|
||||
export(int, 1, 30) var spawnRate = 5
|
||||
|
||||
var elapsedTime = 0.0
|
||||
|
||||
func _physics_process(delta):
|
||||
elapsedTime += delta
|
||||
if(elapsedTime>=spawnRate):
|
||||
elapsedTime-=spawnRate
|
||||
var Minion = load("")
|
||||
var world = get_tree().current_scene.get_child(2)
|
||||
var minion = Minion.instance()
|
||||
world.add_child(minion)
|
||||
minion.global_position = global_position
|
||||
|
||||
|
||||
func _on_Hurtbox_area_entered(area):
|
||||
lifePoints -= area.damage
|
||||
if(lifePoints<0):
|
||||
queue_free()
|
||||
pass
|
||||
Reference in New Issue
Block a user