#Raycast 3D not activating kill function

44 messages · Page 1 of 1 (latest)

vocal mist
#

I'm very new to godot and im trying to follow a tutorial as practice. I got moving and a gun working, but the enemy wont die when i shoot it. I have it set to activate the kill function when the raycast collides with the enemy but its not dying. ideas?
first image is from the player script and second is the enemy script

calm horizon
#

is there an if statement line of code somewhere in your enemy script that triggers if dead== true?

vocal mist
#

Will I add dead == true?

calm horizon
#

no, that should work.

#

what exactly do you want to happen once the enemy dies? and what actually happens when you run it right now?

vocal mist
#

play the death animation, remove collision

#

right now it just keeps running in place

#

oh yeah and play the death sound

calm horizon
#

okay, im assuming "pwned" is your death animation and that it doesnt loop?

vocal mist
#

ha yeah

#

any ideas on why this could be happening?

calm horizon
#

okay, try adding an await animated_sprite_3d.animation_finished() before writing the dead = true at the very end of the kill function

vocal mist
#

still not working! uhg

calm horizon
#

what happens in run with these changes?

vocal mist
#

nothing changes at all its still just idling

#

i dont think the kill function is activating at all cause not even the sound is playing

calm horizon
#

hmm, to test, write a print("TEST") at the very top of the kill function then try

#

just to see if the function is actually getting called

vocal mist
#

would test come up on screen if its working? cause nothing showed up

calm horizon
#

"TEST" should show up in the output in the godot editor

vocal mist
#

Nope, nothing :(

calm horizon
vocal mist
#

STILL not working

calm horizon
#

but does it print the "TEST" now?

vocal mist
#

No it doesnt

#

I downloaded the tutorials scripts and copied them in exactly and it still doesnt work

#

the enemy doesnt even mov

#

move*

#

so i think its something thats wrong with how i made the enemy

calm horizon
#

what version of godot was the tutorial for? though unlikely, maybe there's a mismatch

vocal mist
#

4.1, but i figured it out but not really

#

I just remade the enemy from scratch and it worked fine

#

i still have no idea what i did wrong

calm horizon
#

oh? lol what was different

vocal mist
#

thanks for the help though i appreciate it

vocal mist
#

i probably hit something stupid by accident

calm horizon
calm horizon
vocal mist
#

day 2 of learning to make a game i suffer for two hours on how to make a png make a noise

vocal mist