#enemy dissappears but collision is still there
22 messages · Page 1 of 1 (latest)
could we see your enemy script ?
yeah this is death function
`
func _death():
if main.cop_health <0:
main.cop_health = 0
timer.stop()
chase = false
shoot = false
#utils.saveGame()
get_node("AnimationPlayer").play("death")
await get_node("AnimatedSprite2D").animation_finished
await get_tree().create_timer(0.5).timeout
print("cop deaath")
queue_free()
`
no, i mean the whole script.
but you can do that later (or not if you dont want to) since you said you're gonna go to class now.
Does "cop death" get printed to the console?
its supposed to, but it doesn't
my guess is the animation_finished signal isnt working. seen that before a couple of times, but i dont know what the solution was
okay
okay i solved it by getting rid of the animation finished thing and just setting a timer for how long the animation is
sorry i didnt see this till now 😭
Could you send a screenshot of the tree structure of the enemy? I know you already have something working, but it might help to figure out why it wasn't working
Protip: add a call track to the animation and have it call queue_free() on the node. No timer required. Let the animation do the work.
you can do that?
alternatively, if the fadeout animation is the only thing in the animationplayer. you could just tween the cop's modulate from default to zero alpha
this too
i thought about using tweens but theyre really confusing to me so i decided to just use the player
in your animation, seek it to where you want the property called (at the very end in this case)
then click on the "add track" img1, then the "call method track" img2, and then select the node with the script on the popup that will show up. this will add a new track img3. right click to when you want it, then insert key img4 then a popup will appear where you can look for the function you want to call