mirror of
https://github.com/creyD/ludum_dare_46.git
synced 2026-06-12 21:42:23 +02:00
setup for ai
This commit is contained in:
@@ -17,7 +17,7 @@ func _on_Hurtbox_area_entered(area):
|
||||
var Hearts = load("res://Objects/Heart/Heart.tscn")
|
||||
|
||||
#index of ysort
|
||||
var world = get_tree().current_scene.get_child(4)
|
||||
var world = get_tree().current_scene.get_child(2)
|
||||
if(randf()<GreenDrop):
|
||||
var green = GreenRubies.instance()
|
||||
world.add_child(green)
|
||||
|
||||
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
|
||||
28
src/Objects/Torch/Torch.tscn
Normal file
28
src/Objects/Torch/Torch.tscn
Normal file
@@ -0,0 +1,28 @@
|
||||
[gd_scene load_steps=5 format=2]
|
||||
|
||||
[ext_resource path="res://Overlap/HurtHit_Box/Hurtbox.tscn" type="PackedScene" id=1]
|
||||
[ext_resource path="res://testSprites/fackel.png" type="Texture" id=2]
|
||||
[ext_resource path="res://Objects/Torch/Torch.gd" type="Script" id=3]
|
||||
|
||||
[sub_resource type="CapsuleShape2D" id=1]
|
||||
radius = 8.0
|
||||
height = 12.0
|
||||
|
||||
[node name="Torch" type="StaticBody2D"]
|
||||
script = ExtResource( 3 )
|
||||
|
||||
[node name="Sprite" type="Sprite" parent="."]
|
||||
position = Vector2( 0, -8 )
|
||||
texture = ExtResource( 2 )
|
||||
|
||||
[node name="Hurtbox" parent="." instance=ExtResource( 1 )]
|
||||
collision_layer = 8
|
||||
collision_mask = 0
|
||||
script = null
|
||||
|
||||
[node name="CollisionShape2D" parent="Hurtbox" index="0"]
|
||||
position = Vector2( 0, -8 )
|
||||
shape = SubResource( 1 )
|
||||
[connection signal="area_entered" from="Hurtbox" to="." method="_on_Hurtbox_area_entered"]
|
||||
|
||||
[editable path="Hurtbox"]
|
||||
Reference in New Issue
Block a user