how to add a finish line or laps?

hello guys i am new here,

trying hard game developer wanna be here :smiley:
could you guys help me, how can i add or implement a finish line which could end a game or detect laps. i was exploring the supports but with no luck i wasnt able to find any help

Hi there! And welcome to BlenderArtists!

This is probably the simplest approach:

Have a finish line have a collision sensor that is sensitive to a material or property in the racing cars. When a collision is registered, it will add one to a lap property- if the lap property = 4 (for example) the race is over and the scene changes to a race over (e.g.).

I’ve attached a simple .blend file that gives you the basics to look at. Controls are UP and DOWN cursor. When the CAR block hits the START line block the debug output will show the laps increasing.

Its not perfect, but I hope it gives you some ideas!

Paul

Attachments

Simple Start and Finish.blend (393 KB)

Make a stretched box as a wall over the trac, make it an invisible sensor and detect when racers collide with it. You can make it detect only object with property “racer” in case other stuff moves around in Your game.

update: Rubbernuke beat me to this one :slight_smile:

Let me break this down into easily manageable problems for you.

A finish line is three things: A visual line or object with a texture, a collision bounds that sends a message, and a property or state.

Simply put, lets take your finish line object, give it the logic bricks that makes it send a message “finish” when the cars collide. You can use this message to add an overlay scene if YOUR car collides, or a retry screen if it is another.

This is just the basics though, and you will need a script for a leader-board.

But lets say you have a round track, and cars will be going 'round a few times before they can finish. I would give the finish line a different Boolean property for each racer (so they don’t interfere with each other), and toggle those properties to True when 3 laps are done. A collision sensor with a “property = True” sensor would be what triggers the end.

As for laps, give each racer an integer property, which goes up by one for each lap. Then, at three laps, the car sends a message to the finish line “Imdone” this message will be used to trigger the Finish line’s Boolean for that car.

Messages have to be different for each car, and so do the Finish line’s Booleans. It is a bit of work, but mostly repetition.

thank you for all of your replies and comments.

-rubbernuke
thank you sir for the file you have uploaded, though i can’t try to play the game(it goes black screen after executing or pressing p) i followed what you created and it’s properties. but everytime i get to pass the collision detector the car object seems to go out of control.

-lah
i also tried to follow what you said but same goes for the results with rubbernuke

-satoru
sir do i need somekind of a code for this?thank you sir for the file you have uploaded, though i can’t try to play the game(it goes black screen after executing or pressing p) i followed what you created and it’s properties. but everytime i get to pass the collision detector the car object seems to go out of control.

very good
i only was seeing