top of page

KNIGHTKNIGHT

ROLE

GAME DESIGNER AND DEVELOPER

DESCRIPTION

This game is a classic inspired 2D Side-Scroller in which you take the role of KnightKnight, an outcast adventurer hacking and slashing your way through an odd and annoying world. In this game, you'll utilize running, jumping, and melee attacks to overcome your foes and make your way to the legendary credits scene. Only the best have seen it.

 

The purpose of this game was to gain experience working with side scrollers and to continue practicing in Unity 2D. KnightKnight is inspired by old Side Scrollers such as Super Mario and WarioLand.  This game contains various types of enemies which can chase, attack, and damage the player. There are collectible coins and health pickup's as well as traps such as spikes and moving pillars which can crush the player. This game also features multiple types of moving platforms which the player must learn to navigate successfully in order to succeed.

YEAR

2023

GENRE

2D Side-Scroller (Platformer)

PLATFORM

PC

portal.jpg

Level Design

How I created this Game

​

The Initial Creation of KnightKnight started with a want to learn how Side Scrollers were made. I began by creating a fun player movement with responsive animations and a ground check. The way the ground check works is that it uses the transform of an empty game object that is set below the player's foot collision. If the GameObject Collides with or stays inside of the Ground Layer, the player will play the Idle Animation unless they have are moving at a speed greater than zero. The game background was created using tilesets and layers  and different grids for walls, ground, background, and collectible game objects. The moving Parallax Background was created using seven layers which each move at a different speed compared to the player so that the parallax effect can be created while the player is moving. There are several unique enemies which all damage or pester the player in their own way. This game contains five types of unique moving platforms which either pivot, rotate, move vertically / horizontally, or fall and reset when touched. The coins that the player collects are saved between scenes using PlayerPrefs and any coin collected is represented using a Text UI on the game screen. This game is comprised of free art and audio assets.

​

​

Player Movement and Animation

​

The player animations were pre-made as a free Unity asset, so for those I only had to adjust the size of the sprite to fit my needs and edit the speed the animation played at and if it should loop or not. For example, the Jump animation is meant to play fully one time and then transition into the falling animation which will loop until the player reaches a "Grounded" State at which point the script will transition the animator controller to play the Idle animation if the player is moving at a speed of zero or will transition into the Running animation if the player is moving at a speed greater than 0.  The attack animation is set to work with the Left Mouse Button and has a preset delay so that the attack cannot be spammed constantly. The player attack is created using a method similar to the ground check. In front of the player at a proper distance to the length of the sword, there is an empty game object which senses if it is colliding with an enemy layer as the attack is pressed.  If it is, any enemy which is being collided with at the time will be damaged by a preset amount. 

The player has a health bar which can be damaged by enemy attacks and environmental hazards and replenished with health pick-up placed throughout the levels. The player collision uses two colliders; A sphere collider at the player base to allow for smooth movement over rigid surfaces and a box collider from the waist to head which acts as a way for the player to collide with the environment in a way that makes sense.

​

​

Enemies

​

Patrolling Bandit - The patrolling bandit uses a ground check and an attack check similar to the player character but different in its own way.  The ground check game object is set just below the foot collision of the Bandit and just in front of the Bandits collision. What this allows me to do is set a section of ground layered tiles capped off with Wall Layer tiles. This creates an effect where the bandit will run forward as long as it senses the ground layer, as soon as the bandit's ground check touches a wall collision it will sense there is no ground and cause the bandit sprite to flip horizontally and reverse it's direction. The attack sensor is placed in front of the enemy at a location where the sword blade animation swing can reach. This senor check for collision with the player, if it does collide with the player it will play the attack animation and damage all player object currently withing the collision zone, there is also a delay on this attack to prevent the enemy from damaging the player more than once per second. This enemy has a health bar and can be damaged by both player attack and by the player jumping on a collider placed at the top of the head of the enemy. Each attack does its own amount of damage which is preset - A sword attack does more damage than the player jumping on the Bandit. The Bandit is set to play walking, attack, damage, and death animations accompanied by scripted sound triggers whenever one of these animations occur. 

​

Flying Alien - The Flying Alien enemy uses X&Y min and max values to create a square zone which the alien is allowed to fly in. The alien has variable speed and float distance at which it can sense the player. It also contains code which allows it to shoot any projectiles at the player using an adjustable time delay between shooting and an adjustable variable for how many projectiles are shot at each shooting interval and how much space should be between each projectile. In the game you will see the enemy shooting three projectiles at the player per shot interval. The projectiles have their own colliders which are set so that if they will be destroyed after five seconds or if they collide with anything besides the player character. The projectiles do not do damage to the player but rather push the player, this creates an annoyance while attempting to jump along certain platforms or areas of the game. This can also push the player into a stick situation of they are pushed into more enemies or environmental hazards. If the flying enemy comes into contact with any of the X or Y boundaries it will play a teleport animation and sound then reset its position back to the starting position within the center of the boundary zone. This is set so that the floating enemy cannot chase the player relentless across the entire map. This enemy has a health bar and health script which can only be damaged if the player jumps on top of the enemy. The alien will play damage sounds and then a death animation once destroyed. 

​

Hellcat - The Hellcat is a simple trigger based enemy.  This enemy sits outside of player view at various locations, with a trigger collider set far in front of it. The Hellcat contains a variable for speed, and an Enumerator/Co-Routine death delay which will destroy the asset after fifteen seconds. The way the Hellcat works is; When the player collides with the trigger collider set in front of the Hellcat, the script will initiate a roar sound effect alerting the player to the incoming danger and the Hellcat will begin to move forward at its preset speed. If the Hellcat collides with the player its collider becomes null so that no further damage or collision is possible. This is a one or none hit type enemy which runs by and keeps running whether it hits the player or not. This enemy has no health bar or health script as it is only meant to be an obstacle in a sense. 

​

​

Obstacles

​

Spike Pits - These spikes are set as a ground layer object so that the player can walk and jump from them with ease. If the player touches the collider within a Spike Pit they will be damaged on a delay - 20/100 damage every 3 seconds until death or escape. 

​

Crushing Pillar - The crushing pillar is set to move within Y min and Max boundary points at a set variable speed so that it looks as though its sliding up and down from either the floor or ceiling. This game object also comes with "Deathtouch" collision script. For pillars which come down from the ceiling towards the floor; The deathtouch collider is on the bottom edge of the collider so that if the player makes contact with the pillar it will reset the scene as though the player was crushed to death and has to start over. For pillars which raise up from the ground toward the ceiling; The deathtouch collision is set on the ceiling above the pillar so that if the player is pressed into the ceiling in a crushing fashion, the scene will be reset. These are much less forgiving obstacles than the spike pits and must be traversed with care. 

​

Vertical Platform These platforms move up and down within Y min and Max boundaries and are set to be in the Ground Layer so that the player can use them to move up and down so they can reach various areas within the game. 

​

Rotating Platform - The rotating platform is set with three adjustable variables; Rotation Speed, Rotation Degree, and Rotation Delay. The speed will determine how fast the platform flips, the rotation degree sets how far the platform rotates with each rotation ( for this game 180 degrees), and the rotation delay determines how many seconds between each rotation. This allows for the player to take a second to gauge the pattern of platform rotation and then jump accurately between rotations to reach their goal. 

​

Pivot Platform - The pivot platform is similar to the rotating platform except it's pivot point is on one side rather than the center. This platform senses when the player is leaving its collider and proceeds to rotate at that point. This allows for the platform to flip forward and catch the player as they jump off of it, allowing for unique gap jumping areas. 

​

Falling Platform - The falling platform senses the player colliding with it and triggers and Enumerator. This enumerator begins to shake the platform within a very small boundary for a certain amount of time, from there the platform will fall at a consistent speed for a preset amount of time before resetting its position back to its spawn point. 

​

​

Level Creation

​

Layers - This game is made using several Grids with their own Layers which include; Ground, Wall, Background Objects, and Collectible Objects. The ground layer is set to work with the player and enemy ground checks and helps to create accurate animation transitions when patrolling, walking, jumping or landing. The Wall Layer is set with a frictionless material so that the player will slide off any wall they come in contact with. This layer is meant to block the player from various areas and keep them within the bounds of the game. The Background object layer is set in the Layer order so that it is behind the player but in front of any Wall Layer Objects. This layer is meant purely for flair, any bushes, trees, clouds, or cobwebs which decorate the background of the map are within this layer. The final layer is the Collectible Object Layer. This layer helps with specific collisions and allows for collectible spite prefabs to be set within the levels. 

​

Tile sets -  I prefer to use tileset images and size/slice them myself so that all of the tiles within my game will be the same size while allowing me to blend various tilesets. This game consists of three different tile sets including a cave setting, a mountain setting, and a graveyard setting. 

​

Background - This background was created using Order Layering, and variable speeds on each of the seven layered sprites which center around player movement both horizontally and vertically. This allows for the creation of a parallax background.

​

Level Transition - This level transition is a circular object which is rotating on constantly at a set speed, its often surrounded by Background Layer object which create the look of a portal arch. The rotating object contains a trigger collider which checks what the current scene in the build index currently is and then sends the player to that scene +1 in the build index, this effectively allows for each portal to be dropped into any level and always teleport the player to the next level without any additional information needed to be entered. 

​

Collectibles

​

Health Collectible - This collectible has a trigger collider which checks if the player has 100 health or not. If they do, nothing will happen, if the player is at less than 100 health then the pickup will add 25 health to the player (capping at 100) and play a sound effect signifying pickup as it destroys itself so that it cannot be picked up twice. 

​

Coins - The coins are really just an aesthetically pleasing item to pick up within the game. The total collected is added to a Text UI which sits on the top right corner of the game screen. The coins also contain a satisfying pickup sound trigger which plays before the coins is destroyed. This coin prefab came with a sprite sheet for animation, so it also has a satisfying spinning animation which draws the players eye. The coin total is contained within a PlayerPref function that allows the total to continue to be added to rather than reset between scenes.

​

​

UI

​

Main Menu -The Play Button within this menu is scripted so that it will send the player to the current Build Index Scene +1 when pressed which will start the game as the the first level scene is loaded. The quit button simply quits the application allowing the player to exit the game at any time. The Options button contains a hidden Game Canvas which reveals itself when the button is pressed, at the same time the original menu canvas is set to hidden. This flips back when the Main Menu button is pressed from within the options menu. 

​

Pause Menu - The pause menu works in a way similar to the options button on the main menu. It contains script which will set the game scene canvas to hidden and set the previously hidden pause menu canvas to reveal itself. The game timescale is also set to zero during the time the pause menu is opened so that the game truly pauses. From the pause menu the player can choose to return to the main menu which will load the main menu scene, they can also choose to quit the game from the pause menu if they wish to stop playing. 

​

Coin Text - This UI text updates and saves as the player collects coin game objects, this allows for the current count of coins that have been collected to always be displayed. 

​

​

This game taught me a lot about scene transition, helped me to practice my level design using tilesets and allowed me to scratch that itch for wanting to create a retro side scroller. Overall I am very Happy with how KnightKnight ended up and from all of the great things I learned along the way. 

bottom of page