• Hey Guest! Ever feel like entering a Game Jam, but the time limit is always too much pressure? We get it... You lead a hectic life and dedicating 3 whole days to make a game just doesn't work for you! So, why not enter the GMC SLOW JAM? Take your time! Kick back and make your game over 4 months! Interested? Then just click here!

I want to press the space bar to make the character sprint forward and leave a shadow, like this picture. Who can help me?

Roderick

Member
The easiest way would probably be to write a custom Draw Event.

You probably have a Finite State Machine in your main loop to track what your character is doing. In your Draw Event, refer to that state machine and, if the character is in the dash state, draw an extra copy of the sprite, but offset it so that it's behind the character. Apply transparency, a special sprite, or other visual effects to make it look different from the main sprite.

Alternately, you could have the character spawning copies that it leaves behind as it moves, similar to instantiating bullets when you shoot a gun. This is less performant, so it should only be done if there's a good reason to use instances. For example, if they can damage an enemy that runs into them.

You could also use a Particle System that gets turned on when you dash, and leaves behind sprite particles as you move, then turns off when the dash is finished. This is similar to the instance option, but particles are less performance heavy, so if you don't need to interact with them, this would be the better of the two. Some people would probably say that this is the best option, but I was never any good with particle systems, so it would just be a giant headache for me. 😜
 
J

jifeng

Guest
I want to use every frame to move the character, but I always make the character reach this point in an instant, and I can't do continuous movement, so I can generate illusion continuously.
 
J

jifeng

Guest
The easiest way would probably be to write a custom Draw Event.

You probably have a Finite State Machine in your main loop to track what your character is doing. In your Draw Event, refer to that state machine and, if the character is in the dash state, draw an extra copy of the sprite, but offset it so that it's behind the character. Apply transparency, a special sprite, or other visual effects to make it look different from the main sprite.

Alternately, you could have the character spawning copies that it leaves behind as it moves, similar to instantiating bullets when you shoot a gun. This is less performant, so it should only be done if there's a good reason to use instances. For example, if they can damage an enemy that runs into them.

You could also use a Particle System that gets turned on when you dash, and leaves behind sprite particles as you move, then turns off when the dash is finished. This is similar to the instance option, but particles are less performance heavy, so if you don't need to interact with them, this would be the better of the two. Some people would probably say that this is the best option, but I was never any good with particle systems, so it would just be a giant headache for me. 😜
Thank you for your answer. I didn't implement the second method you said before. The character always reaches the position in an instant, rather than continuously. Now I'll try the first method you said. Thank you.
 
Z

zendraw

Guest
just write how meny pixels he shuld move per frame, and each frame create a shadow clone or whatever they are. its not a draw event thing, it can be but its easyer to just create shadow instances.
 
Top