Player Movement
The player controls a ghost that maps paths for the robots using WASD. Pressing one of the keys moves the ghost to the adjacent space in the desired direction. Before moving, there is a check to make sure there isn't a wall in the location the player wants to move to. If there is, the player does not move. The ghost faces in the inputted direction direction regardless of obstruction. As the ghost moves, it creates points to draw a line from one of the robots to itself. The player controls which robot's line they are drawing by selecting 1, 2, or 3.
Route Plotting
Each time the player takes a step in any direction, their new location vector is saved in an array, unless their new location is equal to the previous location. This means they took a step backwards so it removes their previous location. Each robot actor has a spline component, which is used to draw straight coloured lines between each point in the array each frame.
Robot Movement
The robots move when the play button is pressed. They follow the path that has been set for them by sequentially moving through each point in their path array.
Pressing Buttons
There are buttons in some levels that the player can stand on to press, activating an object in the level such as a laser door. When the player steps off the button, there is a short delay, then the object the button controls is deactivated.
Laser Doors
When a door is activated (by a button, for instance) the lasers in the doorway disappear, allowing robots to pass through safely. If a robot tries to pass through a door while the lasers are still active, they collide with the box collision component that is present only when the lasers are and explode.
Robots Exploding
If a robot collides with lasers or another robot, they generate an explosion particle effect, an explosion sound plays, then they are given a ragdoll effect and thrown backwards. This sometimes makes a level unwinnable and the player must restart, which they can do by pressing "R" to reload the level.
Completing a Level
To complete a level, the player must have just one character reach the exit button, which is a glowing yellow instead of the standard grey. If a robot stand on this button, a success sound is played and level complete graphic is shown on the screen. Then the next level is loaded after a short delay
Guards
Guards use much of the same code code as the robots controlled by the players, except they have a pre-defined path for each level they are in. They provide an obstacle for the player to navigate, as a robot colliding with a guard will destroy both of them.
UI
I have created a basic user interface for the player to interact with if they choose. They can click the red, green, and blue buttons to switch to the corresponding robot. These buttons also show the number of moves each player has remaining. There is also a play button to move the robots. I have included a slider to allow the player to control the speed of the robot movement, choosing from slow, medium and fast. The bottom section of the UI is the controls. This would usually be accessible from a menu but this game does have a menu yet so I have just included it as part of the ui so people can play the game without needed outside guidance.

Comments
Post a Comment