Advertisement
NovaYoshi

foreground collision

Jan 13th, 2017
197
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.31 KB | None | 0 0
  1. Collision points:
  2.  
  3. A___B
  4. | |
  5. | E |
  6. F|C_D|G
  7.  
  8. Procedure:
  9.  
  10. If the player's feet are above the top of the screen, abort.
  11.  
  12. Read the block types under A, B, C, D and E, and record whether block types at A, B, C and D are solid.
  13.  
  14. If those block types have behaviors that need to trigger upon being touched, run those behaviors.
  15.  
  16. If the player is not touching a ladder, reset the "on ladder" flag.
  17.  
  18. If the "player standing on moving platform" flag is on, force C and D to be recorded as solid.
  19.  
  20. Use the solidity of A, B, C and D to look up a reaction from this table:
  21.  
  22. ..
  23. ..
  24. Record this position as the last known good one.
  25.  
  26. AB AB
  27. C. .C
  28. Do nothing.
  29.  
  30. A. .B AB
  31. .D C. CD
  32. Reset to the last known good position.
  33.  
  34. A.
  35. CD
  36. Run behavior for ..CD and then A.C.
  37.  
  38. .B
  39. CD
  40. Run behavior for ..CD and then .B.D
  41.  
  42. .B
  43. ..
  44. Check if it's bricks or an item box and break it if so.
  45. Reset horizontal speed.
  46. If player vertical speed is negative and G is nonsolid, reset vertical position.
  47. If F is nonsolid, snap the player left enough to no longer collide with the block.
  48.  
  49. A.
  50. ..
  51. Check if it's bricks or an item box and break it if so.
  52. Reset horizontal speed.
  53. If player vertical speed is negative and F is nonsolid, reset vertical position.
  54. If G is nonsolid, snap the player right enough to no longer collide with the block.
  55.  
  56.  
  57. .B
  58. .D
  59. Reset horizontal speed.
  60. Snap the player left enough to no longer collide with the block.
  61.  
  62. A.
  63. C.
  64. Reset horizontal speed.
  65. Snap the player right enough to no longer collide with the block.
  66.  
  67. AB
  68. ..
  69. Check if the blocks above are bricks or an item box and break them if so.
  70. Reset vertical speed.
  71.  
  72. .. .. ..
  73. CD C. .D
  74. Record this position as the last known good one.
  75. Reset the "on ladder" flag.
  76. If the blocks the player are standing on are spikes, hurt the player.
  77. If the player is standing on fall-through platforms and has been holding down for 8 frames, fall through the floor.
  78. If the player is standing on a ladder and has been holding down for 4 frames, turn on "on ladder" flag.
  79. Allow the player to start or stop running.
  80. If the player is not riding on a moving platform, snap them up far enough that they're not touching the ground. (only if the foot is in the top half of the block, not the bottom half)
  81. If the player presses A, start a jump by setting the player's velocity negative.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement