< Go Back

MagUnet

About
Its a charming 2D puzzle platformer where players control a sentient magnet awoken and is forced to explore a forgotten, crumbling factory. Armed with the ability to manipulate magnetic forces, the player must solve intricate puzzles, push and pull objects, and overcome environmental obstacles. Along this journey, player will discover more about the factory, form unique bonds with the ultimate goal of escaping this factory.
Project Info
Role : Gameplay programmer
Time : 3 months
Team Size : 7
Engine : Unity

Background

The overall game world is built around a dark, melancholy atmosphere of industrial decay. The environment is designed to evoke a sense of sadness, lifelessness, and decline, reflecting the abandoned and deteriorating state of a once-thriving factory.

In contrast to the bleak world, the characters embody warmth and hope. They are soft, vibrant, cheerful, and brave. Designed to stand out against the sadness of their surroundings. Rather than being overly goofy, their ‘wholesome cute with purpose’ aesthetic creates a sense of safety and optimism, offering comfort within the decaying industrial setting.

MagUnet: Quiet but expressive.
Redgie: Cheerful, optimistic and a bit chatty.

Magnetic Abilities System

Challenges

The most challenging aspect of creating this system was managing the conditions that restricted when the magnetic abilities could trigger, as specified in the design document. The core issue turned out to be that the object’s linear velocity was not reset to zero after the trigger was released. This created a timing gap in the script’s execution, causing the ability to activate outside its intended limits and making it seem as though the conditions themselves were failing.

An additional complication came from the fact that the game object used a dynamic rigidbody, which allowed the player to physically push it while using the magnetic abilities.

Solution

To address the issue, I first used a small rectangular BoxCollider2D with a trigger to detect when the player was too close to the game object. If the player entered this range, the object’s X-axis was locked and the player was prevented from using magnetic abilities. However, this approach limited player freedom by forcing them to maintain a certain distance in order to use the abilities.

Eventually, the game object was converted into a kinematic rigidbody. The previous proximity check was adapted so that if one kinematic object came too close to another, the player would be blocked from pushing into them but still allowed to pull the object toward themselves.

MagnetAbilities.cs

This part of the script is to detect all magnetic gameobjects within the range then using DOT product to determine if the magnetic game object is Infront (within a certain threshold) of the player.

If so then he will choose the closest gameObject, and retrieve data like rigid body from it .

MagnetAbilities.cs

Here is where the gameObject is getting pull or push, as this is required to base it on the current form of the player and the type of game object.

MagnetVFX.cs

Here is if the player is in red or blue form , a line of circle VFX will appear between the player and game object to show a connection.

If the player use the abilities then it will change to a line of arrow VFX, with the direction either moving towards the game object or towards the player.

What I Learned

Far far away, behind the word mountains, far from the countries Vokalia and Consonantia, there live the blind texts. Separated they live in Bookmarksgrove right at the coast of the Semantics, a large language ocean. A small river named Duden flows by their place and supplies it with the necessary regelialia. It is a paradisematic country, in which roasted parts of sentences fly into your mouth.

What to improve

Far far away, behind the word mountains, far from the countries Vokalia and Consonantia, there live the blind texts. Separated they live in Bookmarksgrove right at the coast of the Semantics, a large language ocean. A small river named Duden flows by their place and supplies it with the necessary regelialia. It is a paradisematic country, in which roasted parts of sentences fly into your mouth.

Results

Play The Game On Itch.io

https://uowmgames.itch.io/magunet

Clone The Project On Github

https://github.com/Farhan0419/May24_GPS1_Team2