Pages: 1
Topic closed
i want to be able to control the direction of the jump so say my sprite jumped up i want him to be able to change direction while in the air can anyone help thx!!!
Offline
Most users do
when spacebar pressed
change y by 5
wait 1 sec
change y by -5
but this is choppy.
if want want smoother motion and longer hang time,
youll want to add regular.increaing exponential intervals on the Y axis along.withh decreasing jntervals.at the same rate.
(check out my Flea project. Its got it on there)
PS sorry if I sound like a.salesman. xD)
Offline
Try the script
when gf clicked forever if <key [space v] pressed> repeat (10) change y by ( (x) * (x) ) change [x v] by [1] end repeat (10) change y by ( (x) * (x) ) change [x v] by [-1] end endas a part of a "one sprite, one script" structure and a jump script
Offline
DHMockingjay wrote:
Try the script
when gf clicked forever if <key [space v] pressed> repeat (10) change y by ( (x) * (x) ) change [x v] by [1] end repeat (10) change y by ( (x) * (x) ) change [x v] by [-1] end endas a part of a "one sprite, one script" structure and a jump script
Yes, that. What he said.
Offline
I would try this:
1. Create a variable called "yvel".
2. Add this script to your sprite:
when gf clicked set [yvel v] to [0] forever if <touching [ground v]?> //Whatever your ground is. Edge works too. set [yvel v] to [0] else change y by (yvel) change [yvel v] by (-0.1) end if <<key [up arrow v] pressed?> and <touching [ground v]?>> //Your ground. repeat until <not <touching [ground v]?>> //Your ground. change y by (5) end set [yvel v] to [5] end end
Last edited by SciTecCf (2012-06-01 11:51:12)
Offline
SciTecCf wrote:
I would try this:
if <touching [ground v]?> //Whatever your ground is. Edge works too.
[/scratchblocks]
Or you could set it to a certain colour, which you would outline the background/sprite in, wich I find works a little better. They both work though. Oh, and SciTecCfs' method works really nice too.
Offline
Topic closed
Pages: 1