Discuss Scratch
- Discussion Forums
- » Help with Scripts
- » "lag" effect with path following between 2 sprites?
- Zparx
-
500+ posts
"lag" effect with path following between 2 sprites?
I'm wondering how I can make a sprite follow the y-position of another, while taking a small while to accurately line up with the coordinate. I've tried simple methods like
and

both of which still represent a good idea of what I'm trying to accomplish, yet do not function as intended. I hope someone can understand and is able to help ;p
Thanks!

and

both of which still represent a good idea of what I'm trying to accomplish, yet do not function as intended. I hope someone can understand and is able to help ;p
Thanks!
Last edited by Zparx (June 12, 2013 14:56:28)
- turkey3
-
1000+ posts
"lag" effect with path following between 2 sprites?
forever
if <([y position] of [sprite1]) > ((y position) + (3))>
change y by (3)
end
if <([y position] of [sprite1]) < ((y position) - (3))
change y by (-3)
end
if <(abs of (([y position] of [sprite1]) - (y position))) < (4)>
set y to ([y position] of [sprite1])

Last edited by turkey3 (June 12, 2013 15:50:03)
- ErnieParke
-
1000+ posts
"lag" effect with path following between 2 sprites?
Here
I hope that this helps!
With regards,
ErnieParke
P.S. Out of curiosity, is this by chance for Ping Pong?
I see what you need. It just takes a little twist of coding, which I'll show you: I'm wondering how I can make a sprite follow the y-position of another, while taking a small while to accurately line up with the coordinate. I've tried simple methods like![]()
and
both of which still represent a good idea of what I'm trying to accomplish, yet do not function as intended. I hope someone can understand and is able to help ;p
Thanks!
when gf clickedBlank
forever
change y by ((([y position v] of [Sprite to Follow v]) - (y position)) * (0.5))
I hope that this helps!
With regards,
ErnieParke
P.S. Out of curiosity, is this by chance for Ping Pong?
Last edited by ErnieParke (June 12, 2013 23:17:08)
- dracae
-
1000+ posts
"lag" effect with path following between 2 sprites?
Erm… That doesn't really work… HereI see what you need. It just takes a little twist of coding, which I'll show you: I'm wondering how I can make a sprite follow the y-position of another, while taking a small while to accurately line up with the coordinate. I've tried simple methods like![]()
and
both of which still represent a good idea of what I'm trying to accomplish, yet do not function as intended. I hope someone can understand and is able to help ;p
Thanks!when gf clickedBlank
forever
change y by ((([y position v] of [Sprite to Follow v]) - (y position)) * (0.5))
I hope that this helps!
With regards,
ErnieParke
P.S. Out of curiosity, is this by chance for Ping Pong?

Here's (in my opinion



Hope I help!

Oh sorry! D: ErnieParke, your way works great! I just read it wrong… XD
What ErniePark was saying was similiar to this:
Last edited by dracae (June 13, 2013 01:44:21)
- Discussion Forums
- » Help with Scripts
-
» "lag" effect with path following between 2 sprites?