Fixed stuck in enemy
This commit is contained in:
+17
-11
@@ -79,17 +79,13 @@ func _physics_process(delta: float) -> void:
|
||||
|
||||
_update_animation()
|
||||
|
||||
var was_collided := move_and_slide()
|
||||
if was_collided and _is_alive:
|
||||
for i in range(get_slide_collision_count()):
|
||||
var collision := get_slide_collision(i)
|
||||
if _is_killing_collider(collision.get_collider()) and _is_alive:
|
||||
SoundManager.play_sfx_stream(SoundManager.sfx_stream_death, global_position)
|
||||
_is_alive = false
|
||||
collision_mask = 1
|
||||
get_tree().paused = true
|
||||
process_mode = Node.PROCESS_MODE_ALWAYS
|
||||
sprite.play(ANIMATION_DEATH)
|
||||
move_and_slide()
|
||||
#var was_collided := move_and_slide()
|
||||
#if was_collided and _is_alive:
|
||||
#for i in range(get_slide_collision_count()): #TODO remove
|
||||
#var collision := get_slide_collision(i)
|
||||
#if _is_killing_collider(collision.get_collider()):
|
||||
#kill()
|
||||
|
||||
|
||||
func _input(event: InputEvent) -> void:
|
||||
@@ -98,6 +94,16 @@ func _input(event: InputEvent) -> void:
|
||||
collision_switcher.switch_color()
|
||||
|
||||
|
||||
func kill() -> void:
|
||||
if not _is_alive: return
|
||||
|
||||
SoundManager.play_sfx_stream(SoundManager.sfx_stream_death, global_position)
|
||||
_is_alive = false
|
||||
get_tree().paused = true
|
||||
process_mode = Node.PROCESS_MODE_ALWAYS
|
||||
sprite.play(ANIMATION_DEATH)
|
||||
|
||||
|
||||
func add_pickup(pickup: AbstractPickup) -> void:
|
||||
pickup.reparent.call_deferred(pickups)
|
||||
_rearrange_pickups.call_deferred()
|
||||
|
||||
Reference in New Issue
Block a user