-
Notifications
You must be signed in to change notification settings - Fork 172
Game: Temporary page
Tiffany Chong edited this page Jul 28, 2020
·
23 revisions
- Manages
- Renders the Awards Menu which displays assets corresponding to user's collectibles and achievements.
- Implements Game UI as AwardMenu is one of the possible game phases.
Specification
- Given the Awards Mapping (from StateManager), and the list of awards obtained (from UserStateManager), be able to render the award, the keys, and the
Render the background in a Game Location onto Background Layer as specified by assetKey of the Location in State Manager's game map
Game Loop Methods | Description | Usage |
---|---|---|
renderBackgroundLayerContainer |
Obtains all asset key for a location and renders background image on entire screen | Called by GameManager on location render, and on change_background action |
Helper Methods | ||
renderBackgroundImage |
Render background image based on asset given key | Called by renderBackgroundLayerContainer to render GameLocation's background image |
Render all rectangular bounding boxes in a Game Location onto the BBox Layer as specified by BBoxProperty in State Manager's game map
Property Name | Description | Rationale |
---|---|---|
bboxes |
Mapping between bbox ID and activatable bounding boxes that are present on screen right now. | Indexed by bbox ID so that when updates need to be called on certain bboxes, we can easily rerender/remove this bounding box from screen. |
Game Loop Methods | Description | Usage |
---|---|---|
renderBBoxLayerContainer |
Obtains all bbox IDs present in a Game Location and renders each bbox based on BBoxProperty specification | Called by GameManager on location render. |
Helper Methods | ||
createBBox |
Render 1 rectangular bbox by its bbox id specifications provided by BBoxProperty | Called by renderBBoxLayerContainer repeatedly to render all bboxes individually |
State Observer Methods | ||
handleAdd |
Renders 1 bbox | Called by State Manager on add_item action |
handleDelete |
Deletes 1 on-screen bbox sprite | Called by State Manager on remove_item action |
handleMutate |
Replaces 1 on-screen bbox sprite with the same character with another property | Called by State Manager on setBBoxProperty action |
Render all characters in a Game Location onto the Character Layer as specified by Character object in State Manager's game map
Property Name | Description | Rationale |
---|---|---|
characterSpriteMap |
Mapping between character ID and sprites of Characters that are present on screen right now. | Indexed by character ID so that when updates need to be called on certain characters, we can easily rerender/remove this character |
Game Loop Methods | Description | Usage |
---|---|---|
renderCharacterLayerContainer |
Obtains all character IDs present in a Game Location and renders each character based on Character specification | Called by GameManager on location render. |
Helper Methods | ||
createCharacterSprite(id) |
Render 1 character by its character id using default expression and position of the character. | Called by renderCharacterLayerContainer repeatedly to render all characters individually |
createCharacterSprite(id, expression, position) |
Renders 1 character with a different expression (based on the different asset keys stored in Character data type) and different position (based on Character constants) |
Called by DialogueSpeakerRenderer to render speaker avatars |
State Observer Methods | ||
handleAdd |
Renders 1 character | Called by State Manager on add_item action |
handleDelete |
Deletes 1 on-screen character sprite | Called by State Manager on remove_item action |
handleMutate |
Replaces 1 on-screen character sprite with the same character id but with another property | Called by State Manager on move_character and update_character action |
Renders dialogues as specified by Dialogue object retrieved from State Manager's game map
Variables | Description | Usage |
---|---|---|
dialogueGenerator |
Class which holds a pointer to the current part and line in the Dialogue object, it keeps track of the lines that should play next |
Called by Dialogue Manager on line change |
dialogueRenderer |
Renderer that displays the green box and flashes text using the typewriter effect | Called by Dialogue Manager on line change |
speakerRenderer |
Manager which renders the speaker box speaker avatar | Called by Dialogue Manager on line change |
Game Loop Methods | Description | Usage |
---|---|---|
showDialogue |
Plays out an entire dialogue, orchestrating the change in speakers, lines and in-dialogue actions. | Called in Talk mode and during show_dialogue action. |
Helper Methods | ||
playWholeDialogue |
Starts a promise to play the entire dialogue. Attaches listener to green dialogue box, so that when clicked, it can show the next line. | Main function called by showDialogue
|
showNextLine |
Renders one dialogue line, by generating line using dialogueGenerator , rendering the text using dialogueRenderer , changing the speaker using speakerRenderer and processing actions using Action Manager's processActions . If no more lines, it resolves the promise and ends the dialogue. |
Called by playWholeDialogue on start of dialogue and whenever dialogue box is clicked |
- Renders the Escape Menu, which provides options for changing user settings and going back to Main Menu.
- Implements Game UI as EscapeMenu is one of the possible game phases.
- Registers all keyboard and mouse event listeners, so that they can be deleted at the end of every scene.
- Creates all layers in order specified by
defaultLayerSequence
. - Manages addition of objects into specific layers.
- Manages visibility and effects for an entire layer.
- Performs action(s): show_object_layer
Render all sprites of objects in a Game Location onto the Objects Layer as specified by ObjectProperty in State Manager's game map
Property Name | Description | Rationale |
---|---|---|
objects |
Mapping between object ID and activatable objects that are present on screen right now. | Indexed by object ID so that when updates need to be called on certain objects, we can easily rerender/remove this object from screen. |
Game Loop Methods | Description | Usage |
---|---|---|
renderObjectsLayerContainer |
Obtains all object IDs present in a Game Location and renders each object based on ObjectProperty specification | Called by GameManager on location render. |
Helper Methods | ||
createObject |
Render 1 object image sprite by its object id ObjectProperty. | Called by renderObjectsLayerContainer repeatedly to render all objects individually |
State Observer Methods | ||
handleAdd |
Renders 1 object | Called by State Manager on add_item action |
handleDelete |
Deletes 1 on-screen object sprite | Called by State Manager on remove_item action |
handleMutate |
Replaces 1 on-screen object sprite with another property | Called by State Manager on setObjProperty action |
Action Methods | ||
makeObjectGlow |
Makes one object glow by calling the Glowing Image's glow functions, which makes a yellow tint overlay blink |
Called on make_object_glow action |
makeObjectBlink |
Makes one object blink by calling the Glowing Image's blink functions, which makes the image blink |
Called on make_object_blink action |
- Performs state transitions by activating and deactivating modes
- Keeps track of history of previous active states using a stack.
- Renders popups for a specified amount of time
- Performs actions(s): add_popup
- Loads user data at the start of entire game
- Saves game data every start of checkpoint and every time a series of actions is performed.
- Saves settings to backend
- Plays and pauses plays background music throughout the game with the volume specified in user settings
- Plays sound effects with volume specified in user settings
- Manages user progression throughout the game by keeping track of set of triggered interactions, set of triggered state-change actions, and completed objectives
- Also manages the game map which contains dynamic information about the objects, characters and other entities in each location.
- Performs actions: add_item, remove_item, add_mode, remove_mode, complete_objective
- Manages states related to the user, available regardless of which checkpoint he is at.
- Stores achievements, collectibles, and assessments completed by the user.
- Performs action(s): obtain_collectible