Games Development - Task 3 : Game Prototype

 21/04/2025 -  ( Week 1 - Week 4 )

Ho Winnie / 0364866 

Games Development / Bachelor's of Design Honors In Creative Media 

Task 3 : Game Prototype




1. Task 3 -  Game Prototype

Requirements : 

Students given the task to create the prototype of their game. The prototype doesn’t need to have the final art asset, and the use of grey boxing is allowed. The focus here is to quickly test out the game mechanics and to troubleshoot any technical difficulties discovered during the development. The focus should be the MVP of your game.

This includes:
Coding movements and actions
Coding obstacles and enemies’ interactions
Coding game levels (Logic of the game)

Progression : 

In this project, we divided the work into different parts to ensure that each team member could focus on specific areas based on their strengths and skills. By splitting the tasks into enemy design, player mechanics, game systems, and level setup, we were able to collaborate efficiently and bring all the core elements of the game together seamlessly.

Ho Winnie ( Me ) prepared the spritesheets for the enemies and designed the environmental tiling style to match the game’s visual theme. I was responsible for programming the movement of the enemies, which included the Undead Cat, Sand Fox, and Skeletal Monster. In addition, I developed the mechanics for enemy attacks targeting the player, enemy attacks on minions, and the behaviors for enemies when defeated.

Lew Guo Ying created the spritesheets for Sahira, the main character, and implemented her full range of movements, including jump, idle, dash, attack, walk, and soul collection actions. Lew also coded the entire crafting system mechanics, developed the soul collection system, and handled the spawning mechanics for minions, ensuring that these systems worked cohesively in gameplay.

Chong Hui Yi took charge of the game level setup by preparing the environment layout, designing the tile setup, setting up collisions, and defining tile boundaries. She also added the parallax background to enhance the game’s visual depth. Furthermore, Chong developed the potion and scarab pickup mechanics, allowing Sahira to pick up items that increase her health bar after consuming potions and implemented border collision logic for these collectible items.

Setting Up Spritesheets : 

I started by importing the prepared enemy spritesheets — including the Undead Cat, Sand Fox, and Skeletal Monster — into Unity. Once the spritesheets were added, I sliced them into individual frames to create the necessary animations for each enemy state, such as idle, walk, attack, and dead. After setting up the animations, I created Animator Controllers to manage the transition between different states based on the enemy’s behavior and game logic. With the animations ready, I integrated them with scripts to control the enemies’ movement patterns, attack mechanics targeting the player and minions, and the behavior when an enemy is defeated. 

Fig 1.1 Enemy Spritesheets

Attack Movement of Skeletal Monster : 

In this part of the script, I programmed the attack behavior for the Skeletal Monster.

On the right side, the script defines key enemy settings:

  • The attackType is set to Melee — so the Skeletal Monster will only use melee attacks.

  • moveSpeed and patrolDistance control how fast the monster moves and how far it patrols.

  • maxHP sets its maximum health points.

  • soulDropPrefab is the object it will drop when defeated.

  • The faceRightByDefault and stopWhileAttacking booleans help control its orientation and whether it stops moving while attacking.

  • Under Attack Logic, it has an attackCooldown to prevent constant attacks and a rangedAttackRange (which won’t be used here since it’s melee only).

  • Under Melee Settings, meleePoint is the point in front of the monster where damage is checked, meleeRange defines how far its attack reaches, meleeDamage is the amount of damage it deals per hit, and targetLayer defines which objects it can hit (like the player or minions).


On the left side, the DealDamage() method handles what happens when the Skeletal Monster attacks:

  1. It first checks if the enemy’s attackType allows melee — if not, the method stops.

  2. It checks whether the meleePoint is assigned; if not, it logs a warning.

  3. The Physics2D.OverlapCircleAll checks for any valid targets within the meleeRange around the meleePoint.

  4. If a target is found, it loops through each one:

    • If the target is the Player (PlayerSahiraController), it deals melee damage.

    • If the target is a Minion (MinionFollowerController), it deals melee damage.

  5. If no valid target was hit, it logs that the attack missed.


Fig 1.2 Skeletal Monster Attack Scripts

In this part of the Skeletal Monster’s setup, I used an Animator panel to precisely synchronize when the enemy deals damage and when its attack ends. The code checks if the Skeletal Monster is within melee range and if its attack cooldown has passed. If these conditions are met, it resets the attack timer and calls StartAttack(), which triggers the attack animation. The Rigidbody’s velocity is also set to zero on the X-axis so the enemy stops moving while attacking.

In the Animator timeline, I added animation events — “DealDamage” and “EndAttack” — at specific frames. The DealDamage event is timed to match the exact frame when the monster’s attack should hit the player or minion, ensuring that the visual swing and the actual damage line up. The EndAttack event signals when the attack animation finishes, allowing the monster to return to its idle or movement state smoothly. This setup makes the Skeletal Monster’s attacks feel responsive and realistic, tightly linking the animation with the gameplay logic.

Fig 1.3 Skeletal Monster Animator Panel




Attack Movement of Sand Fox :

For the Sand Fox, I designed a ranged attack system using a projectile script. The right side of the image shows the EnemyProjectile class, which defines the behavior of the fox’s projectile. This script sets key properties like the projectile’s speed, damage, and lifetime. It also holds a reference for a hiteffect that plays when the projectile hits something. The projectile knows which targets it can damage through the playerTag and minionTag variables, so it can hit both the player and minions. When the projectile is spawned, it gets its Rigidbody2D component for movement and is set to destroy itself automatically after a certain time to prevent clutter in the scene.

On the left side, the OnTriggerEnter2D method controls what happens when the projectile collides with something. If the projectile hits the player, it finds the player’s PlayerSahiraController and applies damage. If it hits a minion, it finds the MinionFollowerController and damages the minion too. In both cases, a visual hiteffect can be spawned for feedback, and the projectile destroys itself afterward. The same happens if the projectile hits the ground or a wall, ensuring that it doesn’t linger or pass through obstacles.

Fig 1.4 Sand Fox Attack Script

For the Sand Fox’s special soundwave projectile attack, I set up a Shoot() method to handle how the fox spawns and fires its projectiles. The method first checks that the FirePoint (where the projectile spawns) and the projectile prefab exist, and that the fox currently has a valid target. When the fox shoots, the script instantiates the projectile prefab at the FirePoint position. It also determines the direction the fox is facing to set the projectile’s travel direction correctly. A Rigidbody2D on the projectile moves it forward, and its local scale is flipped if needed so the visual matches the direction. After firing, the EndAttack() method ensures the fox finishes the attack smoothly.

The second code block checks whether the fox is in ranged mode, whether the target is within shooting range, and whether its cooldown timer has finished. If so, the fox stops moving horizontally, resets its attack timer, and calls StartAttack() — this triggers the projectile animation. In the Animator panel, an event called “Shoot” is placed at the right frame so that the projectile is instantiated exactly when the animation shows the fox attacking.

The Inspector settings at the bottom show how this is configured in Unity. The attack type is set to Ranged, and the fire point and projectile prefab are assigned — in this case, the SoundwaveProjectiles. Other general settings, like movement speed, patrol distance, health points, and the soul drop prefab, help make the Sand Fox behave as a ranged enemy that fires soundwave projectiles accurately at the player or minions.

Fig 1.5 Sand Fox Projectile Scripts 





Attack Movement of Undead Cat :

For the Undead Cat, which also acts as a ranged enemy, I set up its SoundwaveProjectile prefab as its primary attack. This prefab asset represents the visual and functional projectile that the Undead Cat shoots at the player or minions. In the Inspector, the EnemyProjectile script attached to the prefab defines its behavior: the projectile travels at a speed of 5 units, deals 1 point of damage on impact, and has a lifetime of 3 seconds before destroying itself automatically if it doesn’t hit anything. The Target Tags fields specify that this projectile can detect and damage both the player (tagged Player) and minions (tagged Minion).

By setting these properties, the Undead Cat’s ranged attack works consistently: when it fires, the projectile moves forward at the specified speed, checks for collisions with valid targets, and applies damage if it hits. If no Hit Effect is set, it simply disappears when it collides or when its lifetime runs out. This setup makes the Undead Cat’s long-range attack reliable and ensures it can threaten the player from a distance, adding variety to enemy behavior in the game.
Fig 1.6 Undead Cat Projectile Set Up

This script handles the entire behavior for the Undead Cat’s ranged projectile attack. At the top, it defines settings like the projectile’s speed, damage, lifetime, and the HitEffect that plays on impact. It also stores the tags for valid targets — the player and minions. In the Start() method, the script sets up the projectile’s Rigidbody2D for movement and schedules the projectile to destroy itself automatically after its lifetime expires to avoid clutter in the scene.

The ShootTowardsTarget method is responsible for aiming the projectile at its target. It calculates the direction vector from the projectile to the target’s position, normalizes it, and then sets the Rigidbody2D’s velocity to move the projectile forward in that direction at the given speed. The projectile’s rotation is adjusted so it visually faces the direction it’s traveling.

When the projectile collides with something, the OnTriggerEnter2D method checks what it hit. If it hits the player, it calls the player’s TakeDamage method and spawns the hit effect before destroying itself. The same logic applies if it hits a minion. If it hits the ground or a wall, it plays the hit effect and destroys itself as well. The SpawnHitEffect helper method handles spawning the impact effect at the collision point to provide visual feedback when the projectile hits a target or the environment.

Altogether, this script makes the Undead Cat’s projectile attack functional and polished: it shoots accurately at the target, deals damage on contact, shows impact feedback, and cleans itself up to keep the scene optimized.

Fig 1.7 Undead Cat Attack Script






Demo Video : 



Presentation Slides :
Game Dev Task 3 by Winnie Ho 



Contribution List :




2. Feedback

Week 10 : 
Dr Mia complimented the completeness of the game prototype which has the unique soul collecting and crafting feature. 


3. Reflection

Experience : 
This task has been quite challenging for us because we were all completely new to Unity and had to learn everything from scratch while coding all the game logic. It took a lot of trial and error, countless hours of debugging, and plenty of patience to get each part to work as intended. Personally, I spent a long time figuring out how to make the ranged enemy projectiles function properly, from spawning and aiming to detecting hits and cleaning up. Although it was tough, working through the technical obstacles really pushed me to grow my skills in scripting and using Unity’s animation and physics systems.

Observation : 
Throughout this project, I observed how important clear teamwork and task distribution are, especially when everyone is new to the tools and workflows. I really appreciate my teammates — Guo Ying handled the most complex part, which was coding the entire crafting system, and Hui Yi set up the environment tiles and backgrounds, which gave the game its proper look and feel. Everyone focused on different pieces of the project, which helped us make steady progress despite the steep learning curve. I also realized how many tiny details need to come together just to make basic enemy behaviors feel smooth and believable.

Findings : 
One key takeaway from this project is that building even simple game mechanics requires careful planning and constant testing. I learned how small coding errors can break entire animations or mechanics and how important it is to check how scripts, prefabs, and animation events interact. Overall, this project taught me the basics of structuring enemy behaviors, syncing logic with animations, and working in a team where everyone’s contribution is essential to completing the whole game. 

Comments

Popular posts from this blog

Application Design 2 - Task 1 : App Design 1 Self Evaluation & Reflection

Application Design 2 - Task 2 : Interaction Design Proposal & Planning

Information Design - Exercise 1 : Quantifiable Information