Created
July 28, 2015 23:12
-
-
Save fl4shk/7c3c745da5737e8c9568 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void player_sprite_stuff::handle_jumping_stuff ( sprite& the_player, | |
u32 is_jump_key_hit, u32 is_jump_key_held ) | |
{ | |
if ( the_player.on_ground && is_jump_key_hit ) | |
{ | |
the_player.vel.y = jump_vel; | |
the_player.jump_hold_timer = max_jump_hold_timer; | |
} | |
else if ( !the_player.on_ground ) | |
{ | |
if ( the_player.jump_hold_timer > 0 ) | |
{ | |
if ( is_jump_key_held ) | |
{ | |
--the_player.jump_hold_timer; | |
} | |
else | |
{ | |
the_player.jump_hold_timer = 0; | |
//if ( the_player.vel.y.data < -0x200 ) | |
//{ | |
// the_player.vel.y.data = -0x200; | |
//} | |
apply_gravity (the_player); | |
//while ( the_player.vel.y.data <= 0 ) | |
//{ | |
// apply_gravity (the_player); | |
//} | |
} | |
} | |
else if ( the_player.jump_hold_timer == 0 ) | |
{ | |
//if ( the_player.vel.y.data < -0x200 ) | |
//{ | |
// the_player.vel.y.data = -0x200; | |
//} | |
apply_gravity (the_player); | |
//while ( the_player.vel.y.data <= 0 ) | |
//{ | |
// apply_gravity (the_player); | |
//} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment