0 votes

Hey all, in this new game I am creating, I have a moving kinematicbody2d with a sprite( a red dot) attached. Is there any way I can create a trail behind the kinematicbody2d?

I couldn't find anything useful on the internet.

in Engine by (420 points)

1 Answer

0 votes

You can sort of cheat one, I took a bunch of Sprites and sets their position to the one in front of them every frame, that way you have some sort of a buffer for the later ones. I also changed their alpha channel in the modulate in visibility...

you can make it better by using more Sprites or having an array with a bigger range of delays

by (1,204 points)

Could you provide some kind of code cause I couldn't get it to work.

func update_ball():
$Ball/Sprite6.global_position = $Ball/Sprite5.global_position
$Ball/Sprite5.global_position = $Ball/Sprite4.global_position
$Ball/Sprite4.global_position = $Ball/Sprite3.global_position
$Ball/Sprite3.global_position = $Ball/Sprite2.global_position
$Ball/Sprite2.global_position = ball_last
ball_last = $Ball.global_position

that is the code i use, the Ball node got 6 sprites on it and there is one buffer added, i update it every frame(would recommend updating every couple frames or something)

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.