[gameprogrammer] RES: Re: Racing Game

I have to worry about the "lap_incrementor". I'm already working on it!

Thanks,
Dirso.

Atenciosamente,
 
Edilson Vasconcelos de Melo Junior
Diretor de Projetos - JR Softwares
dirso@xxxxxxxxxxxxxxxxxx
dirsow@xxxxxxxxx
(19) 3243-4403 / 3213-7357 / 9213-5245
-----Mensagem original-----
De: gameprogrammer-bounce@xxxxxxxxxxxxx
[mailto:gameprogrammer-bounce@xxxxxxxxxxxxx] Em nome de Chris Nystrom
Enviada em: sábado, 23 de dezembro de 2006 23:28
Para: gameprogrammer@xxxxxxxxxxxxx
Assunto: [gameprogrammer] Re: Racing Game

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




-- 
No virus found in this incoming message.
Checked by AVG Free Edition.
Version: 7.1.409 / Virus Database: 268.15.26/600 - Release Date: 23/12/2006



---------------------
To unsubscribe go to http://gameprogrammer.com/mailinglist.html


Other related posts: