I need a good wall jumping script and acceleration along the x axis script. I have tried to different wall jumping scripts and both do not work. I have a good platform script.
Offline
You can use this script for x movement:
when gf clicked set [xvel v] to [0] forever if <not <<key [right arrow v] pressed?> and <key [left arrow v] pressed?>>> if <key [left arrow v] pressed?> change [xvel v] by (-0.8) //Movement gain speed, must be negative end if <key [right arrow v] pressed?> change [xvel v] by (0.8) //Same as above, but not negative end change x by (xvel) set [xvel v] to ((xvel) - ((xvel) * (0.08))) //Friction, increase for faster stop end
Offline
Wall jumping assuming you have a sensor costume would be
forever if <color [#00FF00] is touching [#FFFFFF]?> if <<key [up arrow v] pressed?> and <key [left arrow v] pressed?>> set [xvel v] to (4) set [yvel v] to (7) //this is for the right hand side, you'd use the right sensor for the left jump //and negative numbers. //green would be the top left sensor, and white would be your //wall colour //
Last edited by zammer990 (2012-08-08 09:02:22)
Offline
Can you explain this script?
Offline
BirdByte wrote:
You can use this script for x movement:
when gf clicked set [xvel v] to [0] forever if <not <<key [right arrow v] pressed?> and <key [left arrow v] pressed?>>> if <key [left arrow v] pressed?> change [xvel v] by (-0.8) //Movement gain speed, must be negative end if <key [right arrow v] pressed?> change [xvel v] by (0.8) //Same as above, but not negative end change x by (xvel) set [xvel v] to ((xvel) - ((xvel) * (0.08))) //Friction, increase for faster stop end
I just noticed quite a few bugs here. Try this instead:
when gf clicked set [xvel v] to [0] forever if <not <<key [right arrow v] pressed?> and <key [left arrow v] pressed?>>> if <key [left arrow v] pressed?> change [xvel v] by (-0.8) //Movement gain speed, must be negative end if <key [right arrow v] pressed?> change [xvel v] by (0.8) //Same as above, but not negative end end change x by (xvel) set [xvel v] to ((xvel) - ((xvel) * (0.08))) //Friction, increase for faster stop end
Offline
I meant the wall jumping script. Are the red blocks ones that were hacked? Could you explain the wall jumping script.
Offline
zammer990 wrote:
Wall jumping assuming you have a sensor costume would be
forever if <color [#00FF00] is touching [#FFFFFF]?>//green would be the top left sensor, and white would be your wall color if <<key [up arrow v] pressed?> and <key [left arrow v] pressed?>>//this is for the right hand side, you'd use the right sensor for the left jump and negative numbers. set [xvel v] to (4) set [yvel v] to (7)
Fixed.
Offline
BirdByte wrote:
zammer990 wrote:
Wall jumping assuming you have a sensor costume would be
forever if <color [#00FF00] is touching [#FFFFFF]?>//green would be the top left sensor, and white would be your wall color if <<key [up arrow v] pressed?> and <key [left arrow v] pressed?>>//this is for the right hand side, you'd use the right sensor for the left jump and negative numbers. set [xvel v] to (4) set [yvel v] to (7)Fixed.
![]()
Yea, i just do comments at the end so you can read them
And the red blocks are just blocks that dont exist, the forum makes them when you write a commment, not hacked blocks
Offline
Does not work.
Offline
This was my answer to a question for "a wall jumping script without sensors":
when gf clicked forever if<key [right arrow v] pressed?> // increase velocity if right key pressed change [x-vel v] by (0.2) end if<key [left arrow v] pressed?> // decrease velocity if left key pressed change [x-vel v] by (-0.2) end change x by (x-vel) // move sprite by x-velocity if<touching [wall/floor v]?> // if sprite collides with wall set [x-vel v] to ((-0.5)*(x-vel)) // bounce off change x by (x-vel) if<touching [wall/floor v]?> change x by (x-vel) end // after bouncing off the wall... if<<key [up arrow v] pressed?> and <(y-vel) < (0)>> // see if you should wall bounce set [y-vel v] to (3) if<(x-vel) > (0)> set [x-vel v] to (2) else set [x-vel v] to (-2) end end end change [y-vel v] by (-0.2) // gravity change y by (y-vel) // move sprite along the y-axis if<touching [wall/floor v]?> // if touching wall/floor set [x-vel v] to ((0.94)*(x-vel)) // friction set [y-vel v] to ((-0.5)*(y-vel)) // bounce change y by (y-vel) if<touching [wall/floor v]?> change y by (y-vel) end if<<key [up arrow v] pressed?> and <(y-vel) > (0)>> // jump set [y-vel v] to (4) end else set [x-vel v] to ((x-vel)*(0.98)) // friction in the air (not on the ground) endEdit: added comments
Last edited by MoreGamesNow (2012-08-13 08:51:27)
Offline
Is it okay to remove if key right arrow/left arrow move x. I have a solid objects script and the x movement is crucial for it to work. Will it work without this?
Offline
concentrating wrote:
Is it okay to remove if key right arrow/left arrow move x. I have a solid objects script and the x movement is crucial for it to work. Will it work without this?
If you remove the "if key [right arrow/left arrow]" blocks, how will you receive input?
Offline
How will it effect the wall jumping.
Offline
Wall jumping currently only work if your y-velocity is less than zero when you hit the wall. You can remove the conditional if you want. I'm not sure how it will be affected, because I'm still not sure what you mean by removing the left and right arrow keys. I'm assuming you're taking some other kind of input (different keys? are you running into the object with another object? what's your plan?)
Offline
With the platform script I have Y must be over zero to jump. What should I do?
Offline
I edited it and realized this script will not work with the floor and walls the same colors. And I fall through the floors even while moving. I need a different script.
Offline
MoreGamesNow wrote:
This was my answer to a question for "a wall jumping script without sensors":
when gf clicked forever if<key [right arrow v] pressed?> // increase velocity if right key pressed change [x-vel v] by (0.2) end if<key [left arrow v] pressed?> // decrease velocity if left key pressed change [x-vel v] by (-0.2) end change x by (x-vel) // move sprite by x-velocity if<touching [wall/floor v]?> // if sprite collides with wall set [x-vel v] to ((-0.5)*(x-vel)) // bounce off change x by (x-vel) if<touching [wall/floor v]?> change x by (x-vel) end // after bouncing off the wall... if<<key [up arrow v] pressed?> and <(y-vel) < (0)>> // see if you should wall bounce set [y-vel v] to (3) if<(x-vel) > (0)> set [x-vel v] to (2) else set [x-vel v] to (-2) end end end change [y-vel v] by (-0.2) // gravity change y by (y-vel) // move sprite along the y-axis if<touching [wall/floor v]?> // if touching wall/floor set [x-vel v] to ((0.94)*(x-vel)) // friction set [y-vel v] to ((-0.5)*(y-vel)) // bounce change y by (y-vel) if<touching [wall/floor v]?> change y by (y-vel) end if<<key [up arrow v] pressed?> and <(y-vel) > (0)>> // jump set [y-vel v] to (4) end else set [x-vel v] to ((x-vel)*(0.98)) // friction in the air (not on the ground) endEdit: added comments
It works Great even with the floor and the walls the same color! Thanks!
Offline