Tile collisions using grid for a large room

J

Jeffers72

Guest
Hi I'm new to GM and would like to clarify if I'm on the right path in how I'm considering creating my game.

It's a top down racing game that will be on a very large room/map. Before I design and draw the room I would like to make sure it'll work.

Basically there will be sections of road that are normal (black), icy (blue) and sandy (yellow). When the car hits these I would like collision events to apply different variables to the car (faster/slippery on ice, slow in sand).

I had a search and if I'm understanding correctly the best way to do this would be a tile map that stores the type of tile section into a grid and then have the collision call that grid when the players x,y coordinates are on that tile?

That way I could create the map in say Photoshop with each section type overlayed as layers and then import those layers as Sprites which would then be easy to dump into the room and everything will line up. Then if a tiles colour equals for example RGB black, it calls the RGB black section of the grid, applying normal physics. If it's blue it'll call the icy physics.

Will this work correctly as I'm currently understanding it? Any guidance is greatly appreciated :)
 

TheouAegis

Member
If you're using GMS2, you can use normal tiles and either just check what tile the car hit using a simple algorithm, or assign a unique bit mask to each tile depending on what type of terrain it is.
 
Top