0 votes

I wasn't exactly sure how to describe this because it's not quite a shockwave. But you see it often with different weapons and abilities in Castlevania games like these examples. It's easy enough to get the projectile animation working, but I'm struggling to get that neat "trailing" effect as they move across the ground. I'm guessing it might work similar to an animated ghost trail for dashing, etc. that's also very common in those games, but starting about halfway through the projectile's animation and not transparent or anything?

https://imgur.com/Rz9dZD1
https://imgur.com/ayFQeLn

EDIT: After looking closer and thinking about this a little more, I don't think it's just an animated trail. The trails can typically still do damage, so I think it's more like each projectile spawns another instance of flames or whatever behind it at a set distance around halfway through its animation cycle.

Godot version 3.5
in Engine by (20 points)
edited by

as you instance() the bullet at the scene
instance an animation scene (shockwave scene) to the bullet scene as well
set x position relative to floor (animation scene (shockwave scene))
Add code to the animation scene(shockwave scene). Delete when animation ends (queue_free())
instance the (shockwave scene) one after the other.

sorry i use Google Translate

1 Answer

+1 vote

You could just build it into the spritesheet itself (the entire wave, using Aseprite or Pixelorama) and then call queue_free() whenever the animation ends. But I am guessing you want the projectile's collision to reflect this as well. (of course you could just move the collision shape)

But instancing is what you're looking for, as Ramazan suggested. Create one object of a single "piece" of the wave with a collision box and have it free itself whenever its animation ends as it creates other instances of itself until the sequence is done. You'll want to play with it a bit, which you'll want to do to get good at animating anyways.

by (536 points)

Thanks for the advice! After reading the answers and thinking it over a bit I think it shouldn't be too difficult to pull off. I think you could probably even have a variable that it increments every time it spawns a copy so you could control the length of the wave.

Also now that I think of it as a side question, what would be the most efficient way to get an instance to spawn a copy of itself? I see there's a duplicate() function, but I'm not sure if that's what I need to be looking at.

‘Duplicate()’ is for copying arrays. You can just ‘add_child’ after using ‘instance()’ in the code.

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.