how to add Scoring to unity3D 2d top down car game?

310 views Asked by At

I'm making 2D top down car game. as for now car game working with if player car hit enemy car game is over.

I used for it adding tag to Enemy car and if player car collision detect enemy car with tag the finish the game.

My question is: How can i implement scoring after player car passing enemy car?

1

There are 1 answers

0
Sohail Siddiqui On BEST ANSWER

Since this is a racing game, time to complete the race would be your main scoring factor. The faster the player finishes the race the higher the score. As for your question about passing enemy car you can check that by calculating the distance the player has covered on the race path vs the distance the enemy has covered. If the player distance is greater than the enemy distance the player has passed the enemy. The distance can be checked in many ways. One approach is to place waypoints on the race path and update check the distance to waypoints.