Discuss Scratch

whyhellothere1
Scratcher
29 posts

Make sprites move exponentially?

Something I wanted to make was a way that sprites could move exponentially. Basically, they would move the fastest at the beginning and slow down/cut speed in half as it gets closer to where it's supposed to go to create some cool-looking transitions. How do I do this?
footsocktoe
Scratcher
1000+ posts

Make sprites move exponentially?

whyhellothere1 wrote:

Something I wanted to make was a way that sprites could move exponentially. Basically, they would move the fastest at the beginning and slow down/cut speed in half as it gets closer to where it's supposed to go to create some cool-looking transitions. How do I do this?
If you know the math it's just like graphing the equation. x and y
gtoal
Scratcher
1000+ posts

Make sprites move exponentially?

Actually, it's not trivial. Fortunately I've had a go at this - see https://scratch.mit.edu/projects/129324720/ - press and hold an arrow key, and the background will scroll, slowly at first working up to a maximum speed, then it will slow down and stop when you release the key.

I'm not sure using this technique for a moving sprite (rather than a background) would be too useful though - there's not very much distance to travel in before you hit the edge (unless of course you bounce, or are moving in a circle etc)…

G
hyprgy
Scratcher
1 post

Make sprites move exponentially?

what if you wanted it to do slowly at first and then faster
dspace1015
Scratcher
65 posts

Make sprites move exponentially?

repeat until <[done]>
change x by ((speed)*([x position to move to]-(x position)))
change y by ((speed)*([y position to move to]-(y position)))
end
This is the simplest way to do what you want, fast at first then slows into the position
Just make sure speed is something small like 0.1

Powered by DjangoBB