The Godot Q&A is currently undergoing maintenance!

Your ability to ask and answer questions is temporarily disabled. You can browse existing threads in read-only mode.

We are working on bringing this community platform back to its full functionality, stay tuned for updates. | Twitter

+1 vote

i have make a 3d shooting spaceship game and i didn't know how to make enemy explode when it get shot

Godot version 3.3.2
in Engine by (13 points)

2 Answers

0 votes

You create a separate explosion scene. When your spaceship needs to explode, you create a new instance of your explosion scene, place it at the location of the exploding ship, then delete your ship.

by (595 points)
0 votes

if your bullet that hits your ship, has an area, do this in the bullets script: connect the area to your main script on "area body entered", then you will get this:

func _on_Area_body_entered(body):

you add:

func _on_Area_body_entered(body):

var spaceship = get_node("root to your spaceship")

     if body.get_name() == "spaceship":
          spaceship.visible = false

to do this, add an animationplayer an make the explosion with the animationplayer.

by (224 points)
Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to [email protected] with your username.