Romoku/WindowsGame1 — Issue #2: Figure out how to handle collisions.
Author: Romoku
Created: 2012-02-25 23:24:43+00:00
State: open

I've tried several methods of collision so far.

Using the map to resolve collision:
This really doesn't work well because we have to transverse the map every time an update happens.

Using objects to resolve the map:
This works better, but it is not very modular and it makes the classes very bulky.

Using a collision map:
I have not tried this as I have no idea of how to implement it.

How collision works now:
There are two maps, the current map and previous map, which are used to keep track of the gamestate. We first update the gameobjects and the player then we check the player class to see if he has performed an action. If this is true we determine which action he did and use the previous map to check if this is valid. If the action it is legal then we add it to the new map.

Once the collisions are revolved the current map is cloned to the previous map and the current map is cleared.

How I want it to work:
Ideally there will be a list of gameobjects that need to be updated. In their update method the objects will fire off an event or something that will add them to the list. We will loop over the update list if its size is greater than 0.

I do not know if that will be a good method, but it is worth a try.