-
Notifications
You must be signed in to change notification settings - Fork 3
Pause
The pause menu is implemented as an invisible UIComponent
similar to the low health bloodied view which is set to visible using an event handler which in turn is called by an input component when the "p" button is pressed. Once p is pressed again the the same input handler toggles the visibility of the pause menu. The menu itself however, is only a small part of the feature. Once the game is paused all in game activity and movement must stop and once the game is unpaused again, the activity must resume. This was implemented by creating a pause attribute in the GameTime
class which make swithes the time scale from 1 to 0 once set to true. This makes all the features that rely on game time such animations to pause which in turn causes both player and enemy movement to pause. However, features that don't rely on animations such as hit scan arrows or enemies looking at different direction still continues. Furthermore, while animation for projectile stops, sound cues and damage of the arrows continue implying that the arrow is still progressing in the background. To stop this AITaskComponent
which controls the AI of the enemy was altered so different tasks queued which simulate the AI of the enemies and enemy projectiles were not processed while the game time was paused. This stopped all enemy and projectile movement, damage, etc.
Below is the code snippet of the addition of pause related functions to game time. Since game time can be accessed globally all features in the game can have specific behavior for when the game is paused or utilize the pause themselves for example for displaying cutscenes
/**
* @return whether the game is paused
*/
public boolean isPaused() {
return paused;
}
/**
* Pauses the game
*/
public void pause() {
timeScale = 0f;
paused = true;
previouslyPausedAt = this.getTime();
}
/**
* Unpauses the game
*/
public void unpause() {
timeScale = 1f;
paused = false;
timePaused += getTimeSince(previouslyPausedAt);
}
Design Document
- Story
- Music
-
Characters
- Main Character
- Bosses
-
Enemies
- Sprint 1: Final Design
-
Sprint 2: Elvish Boss
- Decision to make our boss a mage
- Design Inspiration: Staff Weapon
- Design decisions for boss
- Archery attack animation for minions
- Different types of minion elves and designs
- Melee attack animation
- Boss attack animation using sceptre
- Design Inspiration: Shooting fireballs
- Mage Boss attack method: fireball
- Sprint 3: Walk Animations and Design Amendments
- Sprint 4: Refining animations
- Map Design
- User + Play Testing
- Gameplay
- Art Style Design Guidelines
- Emotional Goals