Raiders of the Lost Art Raiders of the Lost Art

Infinite Runner Tutorial

For this tutorial we looked at an infinite runner like Canablat, Vector or Subway Surfers. The tutorial carefully instructed us how to spawn objects in front of our main player in real time during game play, alter player controls to restrict certain movements. We would also utilise the Unity asset story to be able to work with appropriate character sprite sheets.

First we started by creating multiple folders, sprites, prefabs, scripts and scenes then we started to create multiple shape of different lengths in photoshop to act as our floor and our obstacles that would go into our prefabs folder. Then we added a 2D box collider and a 2D platform effector after that we added physics material 2D and adjusted the properties to friction 0 and bounciness to 0.

After that I downloaded the standard assets file from the assets store and pulled out the 2D platformer character and placed him in my scene. From here I opened the animator window and applied the correct scripts to the character move script. After that I attached the camera to our character rather than our normal nested camera, meaning the camera would move in position according to our character.

After I positioned the camera I needed to create a spawner and a destroyer, so I created a 3D object quad and offset its position to be slightly behind the camera so that when objects went off screen they were destroyed this was done by adding a 2D box collider that reacted using a trigger. Because the destroy was set to be behind the player and attached to the camera so it would never react with the player I duplicated that shape object and placed it beneath the character so to if her was to fall it would then restart the level. I then created another quad shape that would generate shapes in front of the character by adding in the spawn script and then building an array and from here we could generate any shape we needed by dropping any shape into the array.

Tags: , ,

Share Post :

More Posts

Leave a Reply