Top down racing game: track tiles and offroad areas

D

diealp

Guest
Hi all,

I'm working on a topdown racing game, my idea is to draw different terrains surfaces and tracks using tile layers.

one tile layer for terrain (grass, dirt, sand ecc...), one tile layer for the track (straight, curve ecc...) and one instance layer for objects (houses, fences ecc...).

My question is: what is the best way to delimitatesurface areas (grass, dirt ecc...)... I mean, how my car can understand if is over the track or offroad? and how my car con undestand if is over sand or grass?

I tried using objects (one for grass, one for dirt and so on) and to draw it over the track, and IT WORKS... but as I can see i can only draw rectangles, and it is not a very precise way in curves.

I hope someone has understood my english :D
thanks in advance ;)
 

O.Stogden

Member
If you're using sprites with precise collision checking and assign them to objects, you can run a check to see if your car is on the road.

For example:

Code:
if position_meeting(car.x,car.y,road)
{
offroad=false
}
else
{
offroad=true
}
If you wanted to keep it tiles, you'd have to find another method, but this is the method I use in my racing game.
 
  • Like
Reactions: hfe
D

diealp

Guest
If you're using sprites with precise collision checking and assign them to objects, you can run a check to see if your car is on the road.

For example:

Code:
if position_meeting(car.x,car.y,road)
{
offroad=false
}
else
{
offroad=true
}
If you wanted to keep it tiles, you'd have to find another method, but this is the method I use in my racing game.
so I have to try using objects... thanks I’ll give a check, tiles are not mandatory :)
 
Top