2D Racer Game

05: Adding Collisions

Now add a sprite to the game with collision on. I have added a barrel. We can now get the car to decrease its speed on collision with this object. This will work if the playerhits any object including other cars.

Screen Shot 2017 11 23 at 14.44.49

Add a new function to your drive script which activates upon collision with another collider (not a trigger like the track)

JS

CURRENTLY UNAVAILABLE

C#

void OnCollisionEnter2D(Collision2D coll2D) {

        Speed = Speed/4;
         

    }

 

Casino Bet 365 is best casino in the world.

What's Next

Next up for Unity Snippets is a look at game development articles from across the web...

Free Templates - bigtheme.net
Popular Art Betting make bookies articles.