Exponential movement doesn't work

exponents
movement
exponential
hopscotch_app

#1

Hi,

I'm new to exponential movement; I'm no good at doing it. ^^;

Would someone tell me what I did wrong? It seems to be jumping to 406 right away instead of zooming over to it. :p

I meant to ask @GysvANDRegulus on her general topic, but I figured I should make a new topic for this because of people's complaints about there not being enough code topics here. Anyone else's responses are obviously still welcome. :)

Thanks!


#2

Hmm, actually, it seems to be jumping to 250ish... weird. ^^;


#3

That is weird.


#4

@Rawrbear yep this is correct. I'm not 100% sure what you're exactly trying to do, but there is a problem in your code. Currently, you have this:

Set Position X(512) Y(912)

Repeat forever:
-Set Position X(512) Y( (Self Y + (406 - Y Position)) / 2 )

Let's substitute the Self Y position with 912.

-Set Position X(512) Y( (912 + (406 - 912)) / 2 )

Which moves the square to Y 203.

Now the equation is this:

-Set Position X(512) Y( (203 + (406 - 203)) / 2 )

Which also equals 203. So now the square can't move anymore.


#5

Hm, interesting.

I followed this post by Corvus to make my box move from the top of the screen down; it all looks correct to me... :thinking:


#6

You put ((self) + (destination - self)) / ease which is different from (self) + ((destination - self) / ease). Basically you want to divide the destination - self by the ease, and add the self y position


#7

Oh, so the way you place the bubbles actually matters? Didn't know that, hehe. Thanks!

EDIT: Yeah, that worked! Thanks a bunch! :D


#8

That looks really cool!


#9

Thanks!! ^o^