Reputation: 2668
I'm creating a Bomberman Game with different Components. I've created separate DrawableGameComponents
for BombList
, PlayerList
, WallList
, PlayerDisplay (List of players when TAB is pressed)
and added them in the Components
list. The backboard and instruction texts are drawn in the main Game1
class.
I want to know in what order these Components are rendered. Is it in the order in which they are in Components
List? Initially it seemed like that.
Later, I needed to update BombList
, PlayerList
and WallList
. But this time, it was rendering PlayersDisplay
at the back. I tried to insert them at different positions but I realized what matters is the order in which the Components are added (no matter at what position).
My questions are
Components
list?Draw()
of the Game1
class be called with respect to other Components in the list?Game
class been added in the Components
list in the base constructor?Upvotes: 0
Views: 52
Reputation: 772
Reading up on the documentation explains that.
It has the following member: .DrawOrder
Order in which the component should be drawn, relative to other components that are in the same GameComponentCollection.
Additionally, when you call base.Draw()
in your Draw
override you're calling the .Draw
method for all components.
Upvotes: 1