Advertisement
NovaYoshi

collision rules

Jul 17th, 2015
269
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.04 KB | None | 0 0
  1. collision on all four points:
  2. move the player up vertically, assume they're stuck
  3.  
  4. top left and the bottom two:
  5. run routine for bottom two
  6. run routine for left two
  7.  
  8. top right and the bottom two:
  9. run routine for bottom two
  10. run routine for right two
  11.  
  12. right two:
  13. zero horizontal velocity
  14. move the player horizontally so that they're as right as they can be without colliding
  15.  
  16. left two:
  17. zero horizontal velocity
  18. move the player horizontally so that they're as left as they can be without colliding
  19.  
  20. top left only:
  21. move player right a bit
  22.  
  23. top right only:
  24. move player left a bit
  25.  
  26. top two:
  27. zero out the vertical velocity
  28.  
  29. bottom left, bottom right and both:
  30. check if we're trying to fall through a fallthroughable floor
  31. set a flag for being on the ground
  32. zero out the vertical velocity
  33. change the player's vertical position so that they're as far down as they can go without colliding
  34. if the player is pressing A and hasn't pressed A last frame, jump by setting the vertical velocity negative
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement