diff --git a/nodes/npc/npc.gd b/nodes/npc/npc.gd index 73a5324..ea40987 100644 --- a/nodes/npc/npc.gd +++ b/nodes/npc/npc.gd @@ -6,7 +6,7 @@ const SPEED = 100 const MINIMUM_STATE_DURATION = 3 const STATES = ['panic', 'dead'] -const QUEUE_FREE_DELAY = 30 +const QUEUE_FREE_DELAY = 10 var gravity = ProjectSettings.get_setting("physics/2d/default_gravity") var direction = 0 @@ -41,13 +41,14 @@ func dead_state(_delta): velocity = Vector2(0, -rising_speed) move_and_slide() + if $fsm.state_duration > QUEUE_FREE_DELAY: + queue_free() func die(level_speed): $fsm.set_next_state('dead') rising_speed = level_speed - if $fsm.state_duration > QUEUE_FREE_DELAY: - queue_free() + func pick_new_direction(): direction = [1,-1][randi_range(0,1)] * SPEED