-
Notifications
You must be signed in to change notification settings - Fork 9
Obstacle Minigame ‐ Sprint 3 and 4
Foref edited this page Oct 19, 2023
·
10 revisions
- Implemented Fuel, where each press of a movement button will reduce fuel by 1.
- Once Fuel runs out, the press of a button will not accelerate the ship.
- Implemented Health, where the ship will lose health by 1 for each collision with an asteroid
- There is a small knockback effect when the ship and an asteroid collide
- There are no Game Over scenario yet for debugging purposes, the label on the top left will simply show current health and additional text once health goes below or equal to 0
- All space obstacle minigame entity creation moved to MinigameObjectFactory from ObstacleFactory in entities/factories. Additional stuff added in Sprint 4:
- Retry button
- Access minigame through SpaceNavigationScreen
- Assets moved to assets/levels/obstacleGameAssets.json
Stats such as fuel and health are modified in the ShipActions class. Here, they are initialized to be fuel=20 and health=1 for simpler testing purpose. Acceleration by default is 1.
On the top left is the indicator for the amount of fuel and health left.- After pressing movement keys, the ship will lose fuel.
- Pressing movement keys will trigger the fly() method, which will reduce fuel by 1 for each trigger.
- Once fuel reaches 0, the noFuel() method will be triggered instead, including subsequent press of movement keys, preventing the acceleration of the ship
- noFuel() and other fuel/health update method will call their respective events
- The events will trigger relevant methods in ShipStatDisplay, which in turn will change the top left display of ship Stats
Ship will lose health when Hitbox Component of the ship collide with Hitbox component of the asteroid
- In addition to losing health (health will reduce by 1 and label will display new text as shown above in Fuel Mechanics), a knockback effect will be applied to the ship, as can be seen in the image above.
- To have collision, the component SpaceCollideDamageComponent has to be added to the asteroid entities in the MinigameObjectFactory, with Hitbox Component and PhysicsComponent as prerequisites.
- When creating a new SpaceCollideDamageComponent, the layer for the Hitbox component to detect the Ship entity has to be set to PhyiscsLayer.SHIP while the float number 0.5 is used to specify the knockback force
- Once collision is detected, hitOnce method will be called and handle the collision interaction, including
- Calling the ship entity's ShipActions hit() method
- Apply a knockback force on the ship
- The retry button is on the top right. Once clicked, the minigame will restart with a new map (mainly new distribution for asteroids, enemies and exit goal)
- The button is created in components/maingame/ReturnToPlanetDisplay addActors() method
- Once "restart" is triggered, it will call the ObstacleMiniGameActions restartGame() method
- A button on the top left right corner can open the space minigame. The first idea about this implementation of this is spawning the minigame right after the use decide to move to next planet. However, the minigame was too laggy with this implementation and hard to control the ship. Therefore this was fixed into an optional mechanism, if player want to play the minigame they can click on the button. Complete the minigame will help players to move on the next planet.
- First, press "F" key on keyboard near the ship
- Enter the space navigation screen, the top right will be the space minigame button. Press it and play the space minigame
- Find the exit goal (by distance indicator on the bottom of screen), enter the exit goal to complete the minigame
- Once the minigame is completed, the player will move on to the next map
- Movement Buttons Reminder: WASD for movement and (Not recommended in current laggy state) "B" for break, "V" for release break.
- Current fuel is adjusted to be 1000 for lowering the difficulty (required in current laggy state of the game)
- Assets moved to assets/levels/obstacleGameAssets.json, which can be accessed by FileLoader loading into game/areas/map_config/MiniGameAssetsConfig.java
Escape Earth Game
Interaction Controller and Interactable Components
Game and Entity Configuration Files
Loading Game Configuration Files