Day 2 Infinite Loops

Infinite loops are real. They warn you as they hold your hand through all the tutorials but then when you get a chance on your first while loop of the game you break unity and guess what, you haven’t saved your progress in 3 hours.

Day 2 Endless runner core mechanics was set up starting with the background. I got my ground texture from filebase (GameDevHq’s asset library) and then set it up to continuously scroll down making it look like the player is running.

This was done with the help of the Unity Junior Programmer tutorial where it teaches you how to scroll a sprite renderer to the right of the screen on a side scrolling endless runner. I was pretty consistent throughout coding this and it took me approximately an hour and a half to get the camera angle and ground moving consistently with no jitter between the repeat.

Next moved onto the making the enemies and power ups into prefabs and making a basic move forward script.

This took me a total of about 30 seconds plus celebration time for getting something right on the first try. Next made a gameobject to represent the spawn manager and set up the spawn manager script.

I made the enemies that spawn into another gameobject that way tomorrow I can pool them in an enemy container for a more efficient game. Here is where the lovely infinite loop came in. Trying my best to use the knowledge I’ve gained throughout my rigorous study routine I decided to make the coroutines without pulling up coroutines on the unity manual. I unfortunately did not read my code out loud (in english) and the yield return new WaitForSeconds(2.0f) was put outside of my while loop. On top of that I placed the StartCoroutine() in the Update()… I lost everything when it came to the unity editor side of things and learned a lesson I will regret not remembering when it happens again. ALWAYS SAVE UNITY EDITOR.

Here is where I ended up today:

This so far has proven to be a good challenge at my skill level and by the end of the 30 days I may revisit the endless runner project.

Tomorrow’s goal:

The deadline for this game is tomorrow so I will focus on making this a completely functioning game. I’ll be using filebase for the assets and give the enemies individualities. I may not have enough time to fully incorporate a coin system that I wanted but I will make sure I have power ups in the game. Scoring system will need to be developed and of course an interface for it all.

Thank you for the read —




Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store