Hello, I'm creating a 2d space shooter (one of many projects). So far I have a wire-frame ship which can move around as the space background scrolls downward and a few asteroids come crashing down (while rotating). So far everything is looking very good however I'm planning on creating a collision system for my game now. Maybe something I can re-use in other projects. I'm thinking of a way to do this but i'm afraid of approching it wrong. For example, on a tile game i'm also working on my collision system was planned to check one unit ahead of the player before each attempt to move then find out if that tile is walkable or not. i.e.
struct tiles
{
BITMAP *image;
bool walkable;
}
Tiles are 16x16 so...
int map_x = player_x / tile_size;
int map_y = player_y / tile_size;
Let's say if I move right I increase a player_direction_x by one THEN divide and check against my tile structure like so...
...REQUESTED TO MOVE RIGHT
...GET TILE
if(tile[x].walkable == true) ...THEN WALK
But I don't think I should use something like this in the kind of game I am creating now since I can only move side to side and I have to check for asteroids whom Y values keep changing. Any ideas on how to create a collision system for this type of project OR know of a good tutorial on collision engines? Thanks a lot in advance.
Erick