Changes on Cannon.gd

This commit is contained in:
2022-12-10 03:43:27 +01:00
parent ec8dcac756
commit 35d1bf72f3
4 changed files with 11 additions and 8 deletions

View File

@@ -5,7 +5,6 @@ signal ammo_pickup
signal shoot
var t = 0.0
var CAN_ENGAGE = true
@onready var tween = create_tween() as Tween
@@ -33,10 +32,8 @@ func _process(delta):
speed_p1 = 5
start_tween()
if round(p1.position.distance_to(p2.position)) == 9 && CAN_ENGAGE:
CAN_ENGAGE = false
if round(p1.position.distance_to(p2.position)) == 9:
emit_signal("shoot")
create_tween().tween_callback(func(): CAN_ENGAGE = true).set_delay(2)