Dynamic race postion/timer

Hi everyone!

I have a workable logic brick based start/finish line that shows the postion of racers as they collide with it, however, how do I do the following?

Dynamic race positions (i.e. as cars pass each other the postions change rather than having to go through the start/finish line).

A timer- I know properties has a timer function, but how do I reset it after a lap? And can the result be outputted somewhere to a record board?

And this sounds stupid but: I use the debug output to do scores and other things, can this stuff (race postion, time etc) be outputted to a HUD in some way? I have seen some games that do this but I cant figure how its done.

Anyhow, as always, cheers for reading!

Paul

I’ve found this to be tricky in the past so I tackled it again tonight. The blend should work. Touch left arrow to start the “race”.

Attachments

TimerEq.blend (580 KB)

Thats really cool- how did you do the text by the way? And I see from looking at the scripts there is a race over display but its not showing- instead as you touch the finish line the finish line collision = TRUE the clock stops, however, as you go through completley the current time is used with no race over text.

But still, this is the stuff I want to learn!

Cheers, Paul

“RaceOver” is a float property that doesn’t do anything until collision time when it gets and keeps the value of the text object’s property [“time”] at the one and only moment the collision sensor fires. It’s then pemanently given to the text object in the last lines of the Clock script. The timer keeps going. There’s a little script runs off the spacebar to demonstrate that you can reset the timer. And you could stop it for keeps if you kept giving it the value 0.0. Try the spacebar with True pulse mode enabled. Start the “race” but leave the “car” car short of the finish line. With True pulse mode enabled on the spacebar the timer resets and halts at zero but the “HUD” displays 0.01677 (if you’re running at 60 fps). It’s often the way that things don’t get done until the next tic. Sometimes there’s ways around that, sometimes not but it’s not critical.

If you don’t know about text objects they’re gotten from fontsheets, UV mapped a particular way onto a plane. It’s pretty ugly but once you’ve got one you don’t need to worry about it too much. You’ve got one now that you can append into your own files when you want. Or you can find them or make your own from any ttf’s. This blend shows the basic use of them for HUDs etc. A text object can only display one line of text or figures. You can lay them out with borders and stuff and parent them just in front of your camera.

One little thing, it would make more sense to register the collision and pass property values from the “car” rather than the finish line as I’ve done, since you have multiple cars and one finish line.

Excellent, thanks for the explanation!

Cheers boss!

Paul