Im making a racing game. In it I would like to be able to to show the positions of the cars in the race (first, second, third, etc.). What would be the most reliable way of doing this?
Positions in race
Welcome to our brand new Clickteam Community Hub! We hope you will enjoy using the new features, which we will be further expanding in the coming months.
A few features including Passport are unavailable initially whilst we monitor stability of the new platform, we hope to bring these online very soon. Small issues will crop up following the import from our old system, including some message formatting, translation accuracy and other things.
Thank you for your patience whilst we've worked on this and we look forward to more exciting community developments soon!
Clickteam.
A few features including Passport are unavailable initially whilst we monitor stability of the new platform, we hope to bring these online very soon. Small issues will crop up following the import from our old system, including some message formatting, translation accuracy and other things.
Thank you for your patience whilst we've worked on this and we look forward to more exciting community developments soon!
Clickteam.
-
-
Do you mean an "in-race" statistic on who's leading so far, or do you mean just a final score?
I'm assuming you mean the first:You could place some detector objects (just invisible active objects) around your race-track. Make sure to code your game so you can only win if you met the detectors in the right order so you can't cheat by just going over the racing-line a couple of times to win. You just order the players after the first cars reaching your invisible detector objects.
So you could simply add 1 to the cars alterable value the first time it meets this detector this track. The car with the highest value is the leading car.
-
First off, yes that was what I was going for, I should have been more descriptive. Thanks for the tip but is there a way to get the positions in real time?
-
You'd have to make a "line" that drew the route of the race-track and then figure out how close each player is to the end of this line, and then arrange them in order by their position value.
I'm afraid there's no easy way to do this. The easiest would be what Andos suggested.
-
The way most of the modern racing games detect split times (usually 3 and the start finish line so that the race is split into four areas) is having a polygon line across the floor at the appropriate places, and the game keeps track which car goes over it and when to display the split times.
You could use a similar system with more lines to keep track of which cars are colliding with which line.
The AI cars in most commercial games follow a set of waypoints on the track that make up their driving line, and I presume that this is how they keep track of what's where.
You could also try that method by comparing the positions of the cars to the positions of the waypoints, but this will be processor intensive, especially if you use hundreds of them to make the driving line, like they do.I would suggest going with the first one, maybe with a line every 2 car lengths, and keep track of them like that.
Of course, the line would be an active sprite, and not a polygon object.I love the "Super Sprint" type racers.
Always good fun.Good luck with it.
Krush.
-
theres a really simple way to do this. you'll kick yourself when you see how.. i'll post an example.
-
theres a really simple way to do this. you'll kick yourself when you see how.. i'll post an example.
Did this ever get posted? Curious because I'm looking for a simple way to do this.
-
Did this ever get posted? Curious because I'm looking for a simple way to do this.
I searched danjo's posts and found it: Please login to see this link. - I hope it shows you how to do what you want.
-
Thanks, I didn't even consider searching that way. I appreciate your help. I'll have a look.
-
It all depends on what the cars can do, if they are fully autonomous, if they can collide and "stay put" for a few moments, be diverted from their trajectory by a collision ...
Participate now!
Don’t have an account yet? Register yourself now and be a part of our community!