Momentum is usually referred to as velocity on this site...I guess to most people they're similar enough...For momentum, instead of changing your x and y positions, you change the change of your x and y positions. This will require a minimum of one variable (for only one axis) or two variables (for both x and y).
Scripts usually look like this:
when gf clicked set x to (start x) set y to (start y) set [xvel v] to (0) set [yvel v] to (0) forever if <[right arrow v] key pressed?> change [xvel v] by (.2) end if <[left arrow v] key pressed?> change [xvel v] by (-.2) end if <[up arrow v] key pressed?> change [yvel v] by (.2) end if <[down arrow v] key pressed?> change [yvel v] by (-.2) end set [xvel v] to ((xvel) * (.95)) set [yvel v] to ((yvel) * (.95)) change x by (xvel) change y by (yvel) endHopefully this is the effect you were talking about.
Last edited by AtomicBawm3 (2012-03-12 22:22:28)
Offline
AtomicBawm3 wrote:
Momentum is usually referred to as velocity on this site...I guess to most people they're similar enough...For momentum, instead of changing your x and y positions, you change the change of your x and y positions. This will require a minimum of one variable (for only one axis) or two variables (for both x and y).
Scripts usually look like this:when gf clicked set x to (start x) set y to (start y) set [xvel v] to (0) set [yvel v] to (0) forever if <[right arrow v] key pressed?> change [xvel v] by (.2) end if <[left arrow v] key pressed?> change [xvel v] by (-.2) end if <[up arrow v] key pressed?> change [yvel v] by (.2) end if <[down arrow v] key pressed?> change [yvel v] by (-.2) end set [xvel v] to ((xvel) * (.95)) set [yvel v] to ((yvel) * (.95)) change x by (xvel) change y by (yvel) endHopefully this is the effect you were talking about.
Yes! it is! Thank you!
Offline