Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /* Movimento lateral */
- if keyboard_check(vk_left) hspeed = -5.3;
- else if keyboard_check(vk_right) hspeed = 5.3;
- else hspeed = 0;
- /* Pulo */
- if keyboard_check_pressed(vk_up) and !place_free(x, y + 1) vspeed = -18.6;
- vspeed += 0.7; // Gravidade
- vspeed = min(vspeed, 15); // Limita velocidade de queda
- // Evita colisão horizontal, vertical e diagonal
- while !place_free(x + hspeed, y) hspeed -= min(abs(hspeed), 1) * sign(hspeed);
- while !place_free(x, y + vspeed) vspeed -= min(abs(vspeed), 1) * sign(vspeed);
- while !place_free(x + hspeed, y + vspeed)
- {
- hspeed -= min(abs(hspeed), 1) * sign(hspeed);
- vspeed -= min(abs(vspeed), 1) * sign(vspeed);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement