I'm currently implementing a little game in java that allows for a player to drive a car around a track.
I want the car to slow if it deviates from the track. However, because the track is rounded, using rectangles doesn't seem to be the best idea.
One idea that popped into my head was somehow using the colors of the pixels the car is on. If all the pixels of the car happen to be where the map is green, as opposed to black for the track, then I slow the car down.
Is this a good approach? If so, how do I go about doing it? Searches have just yielded the same rectangle intersection approach to collision detection.