Developer guide - PatrikTrefil/geometry-dash-clone GitHub Wiki
Scenes
Start Scene
The start scene is a simple scene. There are a couple of self-explanatory buttons, a background image and we have a song playing in the background (for more information about audio, see the Audio section).
Game Scene
Player
We have a player gameobject, which has many components.
We have the standard Transform, Sprite Renderer, Rigidbody2D, BoxCollider2D.
The player gameobject also has a Death script attached to it. This gives
the player the ability to die. It has one method Die(), which is public.
The gameobject also has an Animator, which is used for the running animation and death animation.
We use the Kill (script) component to check if we are not hitting a wall, which is done using raycasts,
and in case the player dies it calls the Die() method. (I have experimented with different ways
of detecting wall collisions, but none of them none of them worked reliably. The biggest problem
was detecting which tile of the tilemap is the player colliding with, because in Unity the whole
tilemap shares one collider)
The player gameobject has 3 scripts that take care of player controls and movement. The first script is called Movement and as the name suggests, it makes the player move to the right at constant speed. The second script is called Jump, which implements jumping. The third script, which is disabled by default, takes care of the plane form of the player.
Currently, the switch between the player forms (cube and plane) is done by OnCollision listener of the tiles, that are used as portals. If we wanted to add more forms of the player, it would definitely by worth it to make a separate script that manages player states, but it seemed like an overkill for now.
There is a very simple script to make sure the camera follows the player.
The Map
The whole map is created using Unity's Tilemap system. The game uses the traditional rectangular tiles. There are
6 types of tiles in the game. There are standard building blocks, spikes, decorations, finish, portals to plane mode,
portals to cube mode. If the player hits a spike block, the Die() method is called. If the player hits a finish block, he wins. Other kinds
are pretty self-explanatory.
Menus
There are 3 menus in the game. The restart menu, pause menu, win menu. They are all children of a Canvas. Canvas holds all the scripts controlling the menus. Menus script provide methods that are for all menus. Then we have separate scripts for each menu.
The menus need to control time. Methods for controlling time are provided by the GameTime script, which is attached to the Canvas.
Audio
All audio (soundtrack, sound effects) is passed through AudioMixer asset. Audio volume can be controlled using the slider in the options menu, which can be accessed from the start scene.
Design
Obviously, the design does not match Geometry Dash at all. The goal of this project for me was to learn how to create a game with similar mechanics to Geometry Dash, not to create the perfect clone. Spending hours looking or copying game art was not worth it for me. Nonetheless, if someone provided the needed assets, it would be very easy to make the game look exactly like Geometry Dash.
Git and Github
The whole projects was managed using git. The whole process was very chaotic. I had no plan, because I was figuring stuff along the way. I tried my best to keep the commits small, but I was not always successful. Nonetheless, git came in very useful many times.
CI/CD
The project uses Github Actions to check for errors and builds the whole project on every push. This way we know that the project is in good shape. This is all thanks to Game CI.