Skip to main content

Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
TagsGame Engines

Entry #9 UP2212859

As a part of our Game Development Module, one of my assessments was to make a game from a design brief - which was made by the second year students.  My group settled on a game called Art Block.

For someone that was new to coding, I was a little intimidated by the main mechanic of the game, but luckily I had experienced programmers in my group that would handle the more difficult mechanics.  So I focused on making a various other scripts like a player controller scripts, a climbing mechanic, camera follow script and a collectible star system, as well as a puzzle script and player destruction scripts.

First and foremost, upon completing the game, I realised that my biggest mistake was not creating a game management script.  This was identified by myself when I wanted to add a checkpoint system.  I had coded the player destruction scripts to reload the level from scratch.  Due to realising this late, I didn't have time to add a new script.  In the future I now know the importance of having a respawn system, as it is imperative in good game design.  Reloading the level forces the players to restart from the very start, losing their collectables, which can cause frustration.


Whilst making my own personal projects and learning about Unity via YouTube from content creators like Brackeys, I learned about OnTrigger events and the tag system, which makes handling game instances like collision super easy and manageable in Unity.  Using my previous knowledge, I handled player interaction with other components like "Fire" by using the script above.  Going forwards, I do intend to learn how to properly implement a game manager script, as it will improve the player's experience and also increase efficiency of my code.  As reloading the level constantly in larger games could take a long time to reload larger levels.


I did the same with my spike trap code.  I also had to set the time scale to pause the game whilst the scene loads, as the player character wouldn't move upon loading.  So I reset the time scale back to normal time upon reloading and this fixed the issue.  I learned about controlling the games time scale from creating pause menus in Unity for a previous game jam.

Whilst making the player controller script, I used headers to lay out my variables so that my other team members could clearly see the labels in the inspector windows.  I learned that using serializable fields whilst using private variables, allow you to still see the variables inside the inspector.  Making variables public means that they can be accessed by other scripts, which can cause problems in larger projects when you have a lot of variables.  Keeping the variables private means that you keep them in the script they were created in, but this can be overridden by using getters and setters.

 

We used a Fork Git repository to push and pull changes we made to the game.  This was incredibly useful and efficient however, it was incredibly difficult to use at first.  So, I will definitely be looking to learn more about how to properly use repositories in the future, as they are vital when it comes to working on a game in a group.


These were the rest of my functions that I made within the player script.  As you can see, I made a player state list script as well...

Whilst making the player controller I was playing Hollow Knight (Team Cherry, 2017) and I got a little carried away at first, trying to make a script with multiple movement mechanics like double jumping, wall jumping, coyote time and jump buffering.  This was due to feature creeping on my part, but the designers told me to cut that stuff out as our game was meant to focus on other mechanics.  So the player state list isn't necessary, but I still left it in the game in case they changed their minds later.  The player state list would've allowed me to add a double jump and wall jump mechanic, as the system would be able to identify when the player is no longer grounded.  All I would have to add are variables to determine how many jumps the player can perform and set the conditions of when the player is allowed to jump.

Learning about Raycasting for ground checking was a long and difficult process, I used the Unity documentation (2022.3) to learn about it's uses and essentially went rubber ducking until my code worked.  In short, I created a Raycast game object that I attached to the player character.  If the ground comes into contact with the Raycast game object, then the system will determine the player as "Grounded" allowing the player to jump.  This was a long and hard process to figure out, but I can now reuse this code and implement it in my other games if I want to make a more complex player controller.

The most difficult part about making the climbing work, was working out how to fix the character's box collider.  During the animation sequence, I had to change the character's 2D box collider during the animation transition which took a long time.  The climbing system isn't perfect and needs a lot of polish, since the character can fall off very easily due to the hit box changing.  This is an issue I aim to work on fixing in the future.  A possible fix could be to prevent the player from falling off of the climbable object at all until they have completed the climb.

Here are a few more scripts I made for our game jam!

Moving Platforms:

Camera Follow:

Star Manager:

Star collectable scripts:

In our game jam our designers wanted to include a water/underwater level, which would require a swimming mechanic and moving water.  I did some research online and found out that programmers use water springs to make 2D water.  This way uses Hooke's Law (Hooke, Robert, 1660) and complex math to create a spring effect that looks like water waves and reacts to foreign collision, creating waves or ripples.  This was however far too complex for me to implement on my own at this point.  But learning how integral math is to programming was very interesting and I aim to one day program something as complex as this feature.

Below is what I coded using Hooke's Law  (Hooke, Robert, 1660) F=KX (Force = a constant i.e. stiffness multiplied by a displacement or change in length X).  There are tutorials on how to use it, but I felt it would be cheating to copy someone else's code and take credit for it.


You can try out our Game Jam game here!

Bibliography:

Team Cherry. (2017). Hollow Knight (v1.5.78.11833) [C#; PC, PlayStation, Xbox, Nintendo Switch]. Team Cherry. https://store.steampowered.com/app/367520/Hollow_Knight/

Unity Technologies. (n.d.). Unity - Scripting API: Physics2D.Raycast. Retrieved 15 May 2024, from https://docs.unity3d.com/ScriptReference/Physics2D.Raycast.htm

Augustyn, A. (2024, April 9). Hooke’s law | Description & Equation | Britannica. https://www.britannica.com/science/Hookes-la

Support this post

Did you like this post? Tell us

In this post

Mentioned in this post

University Game Jam
Platformer