Alright, maybe I have done some coding before with the intent of creating a game. In my first year of school we had to create an educational game using a Lego Mindstorm. In my second year we had to rewrite the code for a pinball machine from scratch and in my third year we created a simple platformer, but never have I created a game that was ment to be put out in the world, for others to play and to criticize. Until now. In this short series of blogposts I will take you on a tour through the mystic lands of android game development.

Setup

For this project I will be using Unity 2019.2.4f1 (download here). To make life a little easier I installed probuilder and progrid (for progrid enable experimental under advanced). These can be installed using the package manager (windows>package manager). Next I created a new project, named it and headed over to the build settings. Switched the target to Android and did a testbuild. Guess what, I needed to update the SDK tools… Two hours later and we are all set to start this project.

The idea

Because this is my first game, I want to start easy and small. In this game you will play as me, riding my bike to school over the dike. On the way you have to dodge puddles, pilons and cars. The dike will generate endlessly and the further you ride without crashing the more points you earn.

That’s it. Plain and easy. However, I will turn this in a full game with a personal highscore, neat UI and some progression (still in the works, maybe different bikes/vehicles)

Infinite dike generation

The primary feature of this game is the endlessness of the road ahead. This road may look seamless, but it actually consists of small parts like this:

A script instantiates 7 of these in a row. The player goes over them and the script removes one at the back ones the player passes it, and adds a new one in the front. Voilla, an infinite dike, or as some would say, a dutchmen’s dream.

Next I created a puddle, added it to the basic prefab, added collision detection and added randomness to the script that creates the dike. Now every now and then a puddle will be in your way. Next blogpost I will add more obstacles.

UI: wip

When you hit an obstacle the game is over, and you will be taken to the game over menu. To test and setup the flow of the game I added a temporary menuscreen.

It’s just ugly, but it gets the job done. The replay button reloads the scene and quit exits. Easy as that.

Next time I wil spruce up the dike by adding more obstacles. Try to find a bike and create a propper UI. See you next time,

Ruurd

Do you want to start creating your own games, but don’t know how? This book will teach you how to use the unity game engine to it’s fullest potential