I have some code here originally authored by Zach Weber, username Wizirdi on Youtube, and it allows your player to jump by pressing up.
if keyboard_check_pressed(vk_up) and !place_free(x,y+1) {
vspeed = -10
}
How would one go about making it so that the longer you hold jump, the higher you go and the shorter you hold jump, the shorter you jump?
Jump control like Mario Bros.?
Started by Mamamamammalian, Jun 09 2012 08:56 PM
3 replies to this topic
#1
Posted 09 June 2012 - 08:56 PM
#2
Posted 09 June 2012 - 09:10 PM
I've tried to make that piece of code myself. But I didn't dome up with a reasonable solution. But Google did!
This engine is really handy. It got almost everything you could possibly look for in a platformer.
http://sandbox.yoyog...om/games/171169
Btw, please read through the code to learn how the engine works.
This engine is really handy. It got almost everything you could possibly look for in a platformer.
http://sandbox.yoyog...om/games/171169
Btw, please read through the code to learn how the engine works.
Edited by darkclower, 09 June 2012 - 09:12 PM.
#3
Posted 09 June 2012 - 10:37 PM
Put this in the step event
placefree=place_free(x,y+1)
if keyboard_check_pressed(vk_up) and !placefree=1
{
jump=0
/*
This is only here so you don't have to assign jump to a variable in the create event.
*/
}
if keyboard_check(vk_up) and !placefree=1
{
jump=max(9,jump+0.1);//Edit the 9 to change the minimum height you can jump. and edit the 0.1 to change how long it takes to get to maximum jump height.
jump=min(15,jump);//Edit the 15 to change the maximum height you can jump.
}
if keyboard_check_released(vk_up) and !placefree=1
{
vspeed =- jump
}
#4
Posted 28 June 2012 - 02:47 AM
I've tried to make that piece of code myself. But I didn't dome up with a reasonable solution. But Google did!
This engine is really handy. It got almost everything you could possibly look for in a platformer.
http://sandbox.yoyog...om/games/171169
Btw, please read through the code to learn how the engine works.
Wow, this code is actually really, really awesome. Guess I gotta' check out more of the games on YoYo, looks like I could learn a lot.
Thanks
0 user(s) are reading this topic
0 members, 0 guests, 0 anonymous users











