On 12/23/06, Edilson Vasconcelos de Melo Junior <dirso@xxxxxxxxxxxxxxxxxx> wrote:
I working on a racing game and I have a problem: To know whether the player finished the race I test if the car position is in the finish line, but the problem is if the player starts running, turns the car and then drives in the wrong way it will end up winning the race L. How could I know the player is in the wrong way? I put several check points and uncheck them if it was already checked, but I really would like to put a sign in the screen telling him his is in the wrong way.
Something like this might work: // assuming 360 degrees // edge condition checks left as an exercise for reader if ( car_direction > track_direction + 90 || car_direction < track_direction - 90) { direction = WRONG_WAY; } if (direction == WRONG_WAY) { lap_incrementor = -1; can_win = FALSE; } Chris -- E-Mail: Chris Nystrom <cnystrom@xxxxxxxxx> Saving the world from web programming. http://www.newio.org - AIM: nystromchris --------------------- To unsubscribe go to http://gameprogrammer.com/mailinglist.html