We are going to need to have multiple sprite lists or draw "layers". We may also need to have a LayerManager that keeps track of sprites and allows them to request moving between layers.
If problems come up where we aren't sure of how to implement this or need to solve another problem first, making another ticket that mentions this one would be ok.
Why?
Example 1: Setting up the Puzzle
An NPC sits down behind a desk, facing the screen
The player's solution to this game scenario would be to sneak behind the desk. To depict the NPC facing forward, the following would need to happen:
Draw the chair behind the NPC
Draw the NPC in front of the chair
Draw the desk in front of the NPC and the chair
Example 2 : Core Gameplay
You need to sneak behind an NPC at the desk
Continuing from the example above, the player character will need to be drawn behind all of the above. To draw the player character sneaking, we will need to draw the player before the NPC and the furniture. The draw order will need to go as follows:
Draw the Player
Draw the chair behind the NPC
Draw the NPC in front of the chair
Draw the desk in front of the NPC
Example 3: Gameplay Variety
An NPC sits down at a desk, with their back to the viewer*
Having NPCs face in a variety of directions will allow us to add more variety and complexity to puzzles. To draw the NPC sitting at a desk with the NPC's face away from the screen with minimal asset load, we probably want to draw three pieces in the following order:
Draw the desk the NPC will be sitting at
Draw the NPC that will be sitting on the chair
Draw the chair over the NPC so they appear to be sitting on it with their back to the player
What Layers?
Something like the following layers, ordered from first drawn to last, will be needed to draw the game:
Static Backgroundcached, non-changing tiles likely loaded as a pre-rendered image or TMX.
Sneak Behind LayerWhen crouched / sneaking behind objects, the Player's first sprite gets drawn at this point.
Furniture Far LayerDesk Jockeys that face away (using a computer maybe?) will have desks that is drawn here
NPC Sit LayerSitting NPCs go here
Furniture Near LayerDesks facing the player will go here
Normal Actor Walk LayerMost walking actors will walk here
Darkness OverlayIf we include lighting effects, they will get drawn here
Highlight Layer / EffectsThe overlay/outline of the player will get drawn here, as will the highlights of interactive objects that are in range and currently selected
UI ElementsThis happens automatically if we use the UI manager class
How?
Each layer might need to be a separate sprite list stored in a LayerManager class. In addition to having a method to draw everything, it may also be convenient to put an update method on it.
Implementing the player's see-through view when sneaking
We might be able to draw the player's current animation frame a second time at partial transparency as a way of showing their position. This implies desks have to be light colored. This may need to be implemented as a second sprite, which raises questions about whether we'll make game objects with multiple sprite components.
tl;dr
We are going to need to have multiple sprite lists or draw "layers". We may also need to have a
LayerManager
that keeps track of sprites and allows them to request moving between layers.If problems come up where we aren't sure of how to implement this or need to solve another problem first, making another ticket that mentions this one would be ok.
Why?
Example 1: Setting up the Puzzle
An NPC sits down behind a desk, facing the screen
The player's solution to this game scenario would be to sneak behind the desk. To depict the NPC facing forward, the following would need to happen:
Example 2 : Core Gameplay
You need to sneak behind an NPC at the desk Continuing from the example above, the player character will need to be drawn behind all of the above. To draw the player character sneaking, we will need to draw the player before the NPC and the furniture. The draw order will need to go as follows:
Example 3: Gameplay Variety
Having NPCs face in a variety of directions will allow us to add more variety and complexity to puzzles. To draw the NPC sitting at a desk with the NPC's face away from the screen with minimal asset load, we probably want to draw three pieces in the following order:
What Layers?
Something like the following layers, ordered from first drawn to last, will be needed to draw the game:
How?
Each layer might need to be a separate sprite list stored in a
LayerManager
class. In addition to having a method to draw everything, it may also be convenient to put an update method on it.Implementing the player's see-through view when sneaking We might be able to draw the player's current animation frame a second time at partial transparency as a way of showing their position. This implies desks have to be light colored. This may need to be implemented as a second sprite, which raises questions about whether we'll make game objects with multiple sprite components.