*** TODO Doing collisions right **** Brainstorming Let's think about this. First, players will always have acted "in-between" ticks. We'll also be doing collisions multiple times. Thus the "collide" method gains a new argument, "phase". - Before ANY ticks (level start), we need to "set the scene". This will be stored in the "last layout". - In-between ticks, the player moves - The player, if moving, asks the "last layout" if it would be able to move to that position without collision. If so, the player can move and does not die (the exception being temporary spawn invincibility) - Collisions are informed with 'player-move phase - DURING the tick: - Terrain movement: - First, the terrain moves (??) - All objects are given a chance to handle their 'level-advance method - Then the objects all are ticked with their 'tick method - Projectiles need to do an extra check. Did they collide on the *previous* round? - Finally, the *general* collision check happens. - At the end of every tick, the current layout is calculated and stored for reference in the next tick. So that's interesting! That reveals that there are two kinds of collision detections: - Did *I* collide with the "last layout"? (player, bullets) - The general "check everyone for collisions" **** TODO "Last layout" ***** TODO Store "last layout" when first generating the level ***** TODO Store "last layout" at the end of a tick **** TODO Refactor collision handlers to support purposes **** TODO Allow collision "testing" against last layout in ticky ***** TODO Do refactor ***** TODO Use for player movement ***** TODO Use for bullets