Not Mario (Exam Work)
In this project, I applied the main principles of object-oriented programming (OOP) to make the code more structured and manageable. I used encapsulation by separating responsibilities across different scripts — for example, GameGui
handles the user interface, while PlayerStats
manages the player’s lives. Through inheritance, various types of enemies (jumping, smart, etc.) inherit from a common base class Monster
, avoiding code repetition. Polymorphism is used so that each enemy can have its own version of the MoveAction()
method, yet they can all be handled in a unified way. Abstraction is also implemented — external objects don’t need to know how damage is calculated; they simply call the TakeDamage()
method.
The game includes a collectibles system with coins and score tracking, which are updated in the UI, as well as a life system: the player starts with 3 lives, loses one when hit, and sees a Game Over screen with a level restart when lives reach zero. A victory condition is also implemented — when the player enters the castle, the message “YOU WON!” appears and the level restarts after 5 seconds. Collectibles like mushrooms grant extra lives, and all game elements interact through triggers and colliders. The interface clearly displays coins, score, lives, and a countdown timer.
Leave a comment
Log in with itch.io to leave a comment.