I began to come up with themes for different game ideas and compiled them into a list that follows:
-You're not supposed to be here
-Fusion
-Lifecycle
-Hidden World
-Minimal
-Keep it alive
-Don't go outside
-It's not supposed to do that
-Progress will make you weaker
-Beneath the surface
-You are the villain
-Tiny World
You don't play as the main character
-One room
-Escape the Game
-Power Source
I had some ideas immediately come into my head for some of the themes, these included:
Fusion: Platform based game where you have to collect items and combine the right ones to get the right output to progress.
Life-Cycle: Every time you "die" you reset and play as a clone of you, your past bodies stay where they were. Some sort of idea where you cycle through lives.
Escape the game: Face off against the games AI and complete puzzles to bypass it and escape.
Power source- Collect power cores and power different machines to unlock more power, locations and puzzles.
I decided to continue working with the idea Life-Cycle, feeling that it has a sci-fi theming and made me think back to a puzzle game called Portal that I had played. I was inspired by the use of puzzles to frame the narrative of the game and decided that I too wanted to create a puzzle game. I began deciding on the basics of the game such as - the objective of the levels and game overall, as well as if the game should be continuous or broken down into different level with a checkpoint system.
I created a simple checklist containing the basic movement requirements that I have set. These included:
-Horizontal movement
-Jumping
-Gravity physics
-Collision
-This last one does not come under the movement system but I thought it was an important mechanic to program into the game early on. I needed to respawn the player at the last checkpoint and leave a dead cube at the position the player was at before it respawned.
Here is a script for the basic movement of the player in the programming language C#:
The horizontal movement was very simple to set up, however the jumping code was slightly more complex as I had to make sure the player wasn't already in the air and jump again. I did this through having all the objects that I wanted the player to jump on to have the 'Layer Mask' labelled 'DefineGround' in which I could select the correct mask from Unity's list.
The Boolean variable isGrounded is equal to if the player is detecting an object with the correct 'LayerMask' within a specific range and at a specific position (both set by public variables). If the player is in contact with an object within range the Boolean isGrounded is set to true.
Within the Update function which runs once per frame, the program checks if the player is pressing the space bar key AND isGrounded is equal to true. If these conditions are met then an upward velocity is applied to the player as seen on line 39.
On the right you can see the LayerMask I created within the Unity settings:
In this image on the right you can see the LayerMask called 'Ground' being applied to the variable 'WhatIsGround' within the Simple Movement script component. Within the player 'GameObject' there is an empty 'GameObject' called 'GroundCheck' will provide the transform location for where the script should be checking for the ground.
Here is a screenshot of the public variables from the movement script with their allocated references to other object, components and values.
In the image above you can see there is no longer a public reference to the 'RigidBody2D' component which is required to apply force to the player for movement. This is due to me switching it to a private reference. I could still create a reference to the 'RigidBody2D' component, but now within the script as seen below:
I had a working movement program that would allow me to start getting the grips of creating the gameplay itself. I decided to take a small step back from the coding and decided I should focus on the planning of the game for a while.
Comments