[gameprogrammer] Re: Racing Game
- From: "Chris Nystrom" <cnystrom@xxxxxxxxx>
- To: gameprogrammer@xxxxxxxxxxxxx
- Date: Sat, 23 Dec 2006 18:28:24 -0800
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
- Follow-Ups:
- [gameprogrammer] RES: Re: Racing Game
- From: Edilson Vasconcelos de Melo Junior
- References:
- [gameprogrammer] Racing Game
- From: Edilson Vasconcelos de Melo Junior
Other related posts:
- » [gameprogrammer] Racing Game
- » [gameprogrammer] Re: Racing Game
- » [gameprogrammer] Re: Racing Game
- » [gameprogrammer] Re: Racing Game
- » [gameprogrammer] Re: Racing Game
- » [gameprogrammer] Re: Racing Game
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.
- [gameprogrammer] RES: Re: Racing Game
- From: Edilson Vasconcelos de Melo Junior
- [gameprogrammer] Racing Game
- From: Edilson Vasconcelos de Melo Junior