Pages: 1
Topic closed
I need help with my project. I used vel. for Y and X, then whenever up arrow key is held it goes through the ground.
I used a script that uses sensor sprites that go all around the sprite. The bottom sensor set Xvel. to 0 every time it touches the level. and when up arrow key not pressed. That means that if the up arrow key is not pressed it will set Xvel. to 0. But if it is pressed it won't set Xvel. to 0. I need help with this script!!!
Offline
Move the xvel out of the IF loop if it's in a
if <not <key [up arrow v] pressed?>> ... stuff ... endloop.
Last edited by rdococ (2012-03-08 05:43:19)
Offline
Also, make sure that you're working with YVEL instead of XVEL...Y is the vertical axis.
Offline
JDProducers wrote:
I need help with my project. I used vel. for Y and X, then whenever up arrow key is held it goes through the ground.
I used a script that uses sensor sprites that go all around the sprite. The bottom sensor set Xvel. to 0 every time it touches the level. and when up arrow key not pressed. That means that if the up arrow key is not pressed it will set Xvel. to 0. But if it is pressed it won't set Xvel. to 0. I need help with this script!!!
Does it float in mid-air? If it does, you need to make it so that if the bottom one is touching the ground, set y vel to 0. If it isn't, change y vel by -0.1. For the top sensor, if it's touching it should set y vel to y vel * -1 / 2. Let me show you:
when gf clicked forever if <the top is touching> set [Yvel v] to (((Yvel) * (-1)) / (2)) end if <the bottom is touching> set [Yvel v] to (0.7) else change [Yvel v] by (-0.1) end if <key [right arrow v] pressed?> change [Xvel v] by (2) end if <key [left arrow v] pressed?> change [Xvel v] by (-2) end if <(Xvel) > (7)> set Xvel to (7) end if <(Xvel) < (-7)> set Xvel to (-7) end change x by (Xvel) change y by (Yvel) if <(letter (1) of (Xvel)) = [-]> change [Xvel v] by (0.5) else change [Xvel v] by (-0.5) end
I don't know for sure that it will work, but I think it will.
Last edited by PullJosh (2012-03-08 16:16:45)
Offline
Topic closed
Pages: 1