Guest User

Game Maker Jump Through Moving Platforms Code - Rexfurry

a guest
Dec 12th, 2013
553
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.14 KB | None | 0 0
  1.  
  2. Jump through code (can either go in Step Event of idle or moving Jump Through Platform)
  3.  
  4. if obj_player.bbox_bottom > bbox_top {solid=false}else{solid=true} //Checks for player and determines if solid or not
  5.  
  6. Create Event of Moving Jump Through Platform:
  7.  
  8. hspeed = 1
  9.  
  10. Collision with collision object in Moving Jump Through Platform:
  11.  
  12. hspeed = 1
  13.  
  14. Collision with idle or Moving Jump Through Platform object in Player:
  15.  
  16. if other.solid=true{move_contact_solid(direction,12) vspeed=0}
  17.  
  18. Step Event of Player:
  19. //Optional Movement/Gravity System
  20. /*
  21. if place_free(x,y+1){gravity=0.7 gravity_direction=270}else{gravity=0 gravity_direction=270} //Gravity
  22. if place_free(x-4,y)&& keyboard_check(vk_left) //Move Left
  23. {
  24. x-=4
  25. }
  26. if place_free(x+4,y)&& keyboard_check(vk_right) //Move Right
  27. {
  28. x+=4
  29. }
  30. if keyboard_check_pressed(vk_up) //Bad Jumping System For Tutorial/Testing Purposes Only
  31. {
  32. vspeed-=12
  33. }
  34.  
  35. */
  36. //Moving Platform Code
  37. if place_meeting(x,y+1,obj_moving_platform)//if there is a horizontal moving block under us
  38. {
  39. x+=instance_nearest(x,y+1,obj_moving_platform).hspeed//we move at the speed of the nearest horizontal block below us.
  40. }
Advertisement
Add Comment
Please, Sign In to add comment