Eksāmens - Praktiskā daļa: Mario OOP un Līmeņi
About This Game
This is a 2D Mario-style platformer built in Unity, split across three scenes: Mario, Level2, and Level3.
Player movement is split between CharacterMovement (input) and CharacterController2D (physics). A central singleton, MarioStateController, tracks the player's size state (Small, Big, Fire), active power-ups, and lives. Taking damage downgrades the state by one tier; losing the last life triggers a full game reset. Pressing R does the same manually.
Power-ups are collected via trigger colliders. The Mushroom scales the player up temporarily, the Fire Flower enables shooting, the Starman grants invincibility, and the 1-Up adds a life. All four share a Collectable base class that handles pickup detection, with each subclass overriding ProcessCollect() for its specific effect.
Blocks share a Hittable base class that detects bottom hits from the player and calls a ProcessHit() virtual method. Bricks break or bump depending on Mario's size, and question blocks spawn their item once before becoming inert.
Enemies extend a Monster base class that handles proximity activation, ground detection, and collision direction routing. Side and bottom contacts call GetHit() on the player, which deducts a life and starts a brief invincibility blink. Top contacts kill the enemy.
Scene transitions use either trigger-based level entrances or tube entrances that animate the player sliding in and teleporting to a linked exit. Key objects like the player, camera, and HUD persist across scenes via DontDestroyOnLoad. Scenes that provide their own instances clean up leftover persistent objects at startup using SelfContainedScene.
Respawning is handled by a DestroyBounds trigger below each level. Falling into it calls TakeDamage() and teleports the player to the scene's own SpawnPoint. The HUD displays coins, score, lives, elapsed time, and the current world label, updating automatically on every scene load.
Controls / How to Play
Action Control Move Arrow Keys / A & D Jump Space / Z Crouch Down Arrow / S Shoot X Respawn (full reset) R
Elisalowai
VolA1GhT
Espadas