How do you make velocity? When I do it, I thought it was working, but it kept moving back in the same place. Here's how I'm doing it:
when gf clicked forever if <key [right arrow v] pressed?> change [velocity x v] by [1] end if <key [right arrow v] pressed?> change [velocity x v] by [-1] end set x to ([velocity x]) change [velocity x v] by (([velocity x] * [0.9]))I'm not a good scriptor online
Offline
Nekro wrote:
How do you make velocity? When I do it, I thought it was working, but it kept moving back in the same place. Here's how I'm doing it:
when gf clicked forever if <key [right arrow v] pressed?> change [velocity x v] by [1] end if <key [right arrow v] pressed?> change [velocity x v] by [-1] end set x to (velocity x) change [velocity x v] by ((velocity x) * [0.9])I'm not a good scriptor online
Fixed.
Anyway, the problem I see is that you're setting your x position to x velocity, when you should be changing it by your x velocity. Fix that and you should be good.
I hope that this helps!
Last edited by ErnieParke (2012-11-10 22:00:33)
Offline
Here is the script:
when gf clicked if <key [right arrow v] pressed?> change [x velocity v] by (1) end if <key [left arrow v] pressed?> change [x velocity v] by (-1) end if <touching color [#000008]?> set [y velocity v] to [0.1] if <key [up arrow v] pressed?> set [y velocity v] to [15] end end set [x velocity v] to ((x velocity) * (0.9)) change x by (x velocity) change y by (y velocity) change [y velocity v] by (-1)
Last edited by WIlliam7777 (2013-02-10 00:26:57)
Offline
Nekro wrote:
How do you make velocity? When I do it, I thought it was working, but it kept moving back in the same place. Here's how I'm doing it:
when gf clicked forever if <key [right arrow v] pressed?> change [velocity x v] by [1] end if <key [right arrow v] pressed?> change [velocity x v] by [-1] end set x to ([velocity x]) change [velocity x v] by (([velocity x] * [0.9]))I'm not a good scriptor online
The set x block should changed to change x block.
The script should like this:
when gf clicked if <key [right arrow v] pressed?> change [x velocity v] by (1) end if <key [left arrow v] pressed?> change [x velocity v] by (-1) end if <touching color [#000008]?> set [y velocity v] to [0.1] if <key [up arrow v] pressed?> set [y velocity v] to [15] end end set [x velocity v] to ((x velocity) * (0.9)) change x by (x velocity) change y by (y velocity) change [y velocity v] by (-1)
Last edited by WIlliam7777 (2013-02-10 00:30:08)
Offline