Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- if (instance_exists(obj_player))
- {
- obj_player.onMovingPlatform = false;
- var vPlayer = instance_place(x, y-obj_player.vsp, obj_player); // get an instance of the player that's colliding with this platform
- if (obj_player.vsp >= 0)
- if (place_meeting(x, y-obj_player.vsp, obj_player)) { // check to make sure the player actually collided with this platform
- var playerBoundsOffset = sprite_get_bbox_bottom(obj_player.mask_index) - sprite_get_yoffset(obj_player.mask_index); // get the y position of the bottom of the player
- if (obj_player.y + playerBoundsOffset - obj_player.vsp <= y + abs(vsp)) { // check to see if the bottom of the player is going to touch the top of this moving platform
- // the player touched the platform, so consider this as a touch on the ground, set their vertical velocity to zero, and reset their doublejump
- obj_player.grounded = 1;
- obj_player.vsp = 0;
- obj_player.djump = obj_player.doubleJumpMaximum;
- obj_player.djump += 1;
- obj_player.pitch_jump = 0;
- obj_player.hsp_carry = hsp;
- var platformOffset = vsp;
- obj_player.y = y - playerBoundsOffset + platformOffset; // move the player along with the platform
- obj_player.onMovingPlatform = true;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment