do you play roblox?
Offline
his scratch username :3
Offline
when gf clicked forever wait until <key [left v] pressed?> set [X Velocity v] to [-7] repeat until <not <key [left arrow v] pressed?>> change x by (X Velocity) end repeat until <(X Velocity) > (-0.1)> set [X Velocity v] to ((X Velocity) * (0.98)) change x by (X Velocity) end set [X Velocity v] to [0]It should work.
Last edited by jontmy00 (2012-08-15 08:53:27)
Offline
jontmy00 wrote:
when gf clicked forever wait until <key [left v] pressed?> set [X Velocity v] to [-7] repeat until <not <key [left arrow v] pressed?>> change x by (X Velocity) end repeat until <(X Velocity) > (-0.1)> set [X Velocity v] to ((X Velocity) * (0.98)) change x by (X Velocity) end set [X Velocity v] to [0]It should work.
Or:
when gf clicked forever if <key [left arrow v] pressed?> change x by (-1) end end
Last edited by JH1010 (2012-08-15 14:01:10)
Offline
JH1010 wrote:
jontmy00 wrote:
when gf clicked forever wait until <key [left v] pressed?> set [X Velocity v] to [-7] repeat until <not <key [left arrow v] pressed?>> change x by (X Velocity) end repeat until <(X Velocity) > (-0.1)> set [X Velocity v] to ((X Velocity) * (0.98)) change x by (X Velocity) end set [X Velocity v] to [0]It should work.Or:
when gf clicked forever if <key [left arrow v] pressed?> change x by (-1) end
Fixed.
Offline
Here's what I usually use:
when green flag clicked forever if <<key [left arrow v] pressed?> and <([abs v] of (x velocity)) < [10]>> change [x velocity v] by (-0.85) end if <<key [right arrow v] pressed?> and <([abs v] of (x velocity)) < [10]>> change [x velocity v] by (0.85) end set [x velocity v] to ((x velocity) * (0.89)) change x by (x velocity)
Last edited by henley (2012-08-16 14:34:09)
Offline
Why do people overcomplicate themselves with x/y velocities?
Offline
JH1010 wrote:
Why do people overcomplicate themselves with x/y velocities?
Well, they're smoother, and once you get used to them, they aren't too complicated...
But yes, the most basic moving left would be
move (negative number) stepsor
change x by (negative number)
Offline
JH1010 wrote:
Why do people overcomplicate themselves with x/y velocities?
It's not overcomplicated if you know how it works and what you're doing. It creates a much better, smoother sense of movement making it better than the choppy, immediate movement that you're limited to otherwise.
Offline
henley wrote:
Here's what I usually use:
when green flag clicked forever if <<key [left arrow v] pressed?> and <([abs v] of (x velocity)) < [10]>> change [x velocity v] by (-0.85) end if <<key [right arrow v] pressed?> and <([abs v] of (x velocity)) < [10]>> change [x velocity v] by (0.85) end set [x velocity v] to ((x velocity) * (0.89)) set x to (x velocity)
Instead of
set x to (x velocity)did you mean
change x by (x velocity)Also, I believe it could be simplified to
when green flag clicked set [XVelocity v] to (0) forever if <([abs v] of (XVelocity)) < [10]> if <key [left arrow v] pressed?> change [XVelocity v] by (-1) end if <key [right arrow v] pressed?> change [XVelocity v] by (1) end end set [XVelocity v] to ((XVelocity) * (0.9)) change x by (XVelocity){Sorry for any typos, can't edit posts.}
Offline
Oh, oops. I meant [change x by (x velocity)], I typo'd.
And you're right. I wonder why no one else has thought of that. You must be magic.
Offline
OverPowered wrote:
Also, I believe it could be simplified to
when green flag clicked set [XVelocity v] to (0) forever if <([abs v] of (XVelocity)) < [10]> if <key [left arrow v] pressed?> change [XVelocity v] by (-1) end if <key [right arrow v] pressed?> change [XVelocity v] by (1) end end set [XVelocity v] to ((XVelocity) * (0.9)) change x by (XVelocity)
Actually you dont need to use "abs" to limit the velocity. The "set velocity to" part of the script will limit the velocity itself.
when green flag clicked set [XVelocity v] to (0) forever if <key [left arrow v] pressed?> change [XVelocity v] by (-1) end if <key [right arrow v] pressed?> change [XVelocity v] by (1) end set [XVelocity v] to ((XVelocity) * (0.9)) change x by (XVelocity)
Offline
Wes64 wrote:
OverPowered wrote:
Also, I believe it could be simplified to
when green flag clicked set [XVelocity v] to (0) forever if <([abs v] of (XVelocity)) < [10]> if <key [left arrow v] pressed?> change [XVelocity v] by (-1) end if <key [right arrow v] pressed?> change [XVelocity v] by (1) end end set [XVelocity v] to ((XVelocity) * (0.9)) change x by (XVelocity)Actually you dont need to use "abs" to limit the velocity. The "set velocity to" part of the script will limit the velocity itself.
when green flag clicked set [XVelocity v] to (0) forever if <key [left arrow v] pressed?> change [XVelocity v] by (-1) end if <key [right arrow v] pressed?> change [XVelocity v] by (1) end set [XVelocity v] to ((XVelocity) * (0.9)) change x by (XVelocity)
However, the "abs" portion of the script prevents the player from actively increasing their velocity over a value, much like
if <((XVelocity) > (10)> set [XVelocity v] to (10) end if <((XVelocity) < (-10)> set [XVelocity v] to (-10) endwhich is fine and well, except that the "abs" script is shorter and passively allows the player to be "flung" at faster than the maximum speed.
Offline