Discuss Scratch
- Discussion Forums
- » Help with Scripts
- » How to stop sprite trailing behind another sprite
- wolfburrito55
-
Scratcher
85 posts
How to stop sprite trailing behind another sprite
In my game, the hat sprite goes behind the player a bit, even though it uses the “Go To” block and not the “Glide To”
(Also, I suggest loading this save code so you can see what I mean quicker, unless it's a bug on my end: 1;0;Grate's Grate;0;30;9;0;female;0;0;1;1;( ͡° ͜ʖ ͡°);40
;0;0;0;1;Reogle;0;Oil;2;Delta;4;0;Guard;1;Nope;1;0;0;inside;n n n n n ; Imma Torrorae;;rising dawn;;;Alive;;Yes; )
(Also, I suggest loading this save code so you can see what I mean quicker, unless it's a bug on my end: 1;0;Grate's Grate;0;30;9;0;female;0;0;1;1;( ͡° ͜ʖ ͡°);40
;0;0;0;1;Reogle;0;Oil;2;Delta;4;0;Guard;1;Nope;1;0;0;inside;n n n n n ; Imma Torrorae;;rising dawn;;;Alive;;Yes; )
- Yusei-Fudo
-
Scratcher
1000+ posts
How to stop sprite trailing behind another sprite
Please share your project next time, thanks:

Any other helpers can use this until the real project is shared:
https://turbowarp.org/468999162

Any other helpers can use this until the real project is shared:
https://turbowarp.org/468999162
Last edited by Yusei-Fudo (June 6, 2021 23:26:52)
- Yusei-Fudo
-
Scratcher
1000+ posts
How to stop sprite trailing behind another sprite
I can't find the problem, so how do I find the problem?
- wolfburrito55
-
Scratcher
85 posts
How to stop sprite trailing behind another sprite
Oops sorry, it's shared now. The problem should be the hat on the wolf (if you loaded the code it should appear on its head. It's the green object) because it drags behind the sprite instead of staying on it
Last edited by wolfburrito55 (June 6, 2021 23:38:48)
- Yusei-Fudo
-
Scratcher
1000+ posts
How to stop sprite trailing behind another sprite
Oops sorry, it's shared now. The problem should be the hat on the wolf (if you loaded the code it should appear on its head. It's the green object) because it drags behind the sprite instead of staying on it
Hm… Let me take another look, and I'll let you know my findings
- Thingied
-
Scratcher
1000+ posts
How to stop sprite trailing behind another sprite
In player

In hat

Reason why it used to lack behind is because of the weird way scripts are run. Sometimes one might run before the other. So what was happening was that the hat would go to the player and the player would move which makes the hat fall behind. You can fix this by forcing the hat to move after the player moves.

In hat

Reason why it used to lack behind is because of the weird way scripts are run. Sometimes one might run before the other. So what was happening was that the hat would go to the player and the player would move which makes the hat fall behind. You can fix this by forcing the hat to move after the player moves.
Last edited by Thingied (June 6, 2021 23:51:43)
- wolfburrito55
-
Scratcher
85 posts
How to stop sprite trailing behind another sprite
Turns out I needed to put the “Go to” block in a forever loop, and now it works. I guess this is solved 

- Harakou
-
Scratcher
1000+ posts
How to stop sprite trailing behind another sprite
Turns out I needed to put the “Go to” block in a forever loop, and now it works. I guess this is solvedGlad you found an answer! Since this is resolved, I'll close it to help highlight the answer and prevent future responses. If you need it re-opened, though, you can report this and ask.

- Discussion Forums
- » Help with Scripts
-
» How to stop sprite trailing behind another sprite