Game Development Reference
In-Depth Information
32));
}
This method contains only one line. It is very similar to the code we used to draw
each tile in the RenderWorld() method. But this time we are using the player
sprites sheet rather than the tile sheet. You may also notice that we determine which
sprite to draw based on the player object's AnimFrame variable, which we use to
keep track of which animation frame the robot is currently on.
Rendering debug information
This is not strictly necessary, but it's a good thing to know how to do. We will create a
new method called RenderDebug() . It will draw a yellow border on every solid tile
in the game world. The following is the code:
public void RenderDebug()
{
Tile s;
// Loop through the y axis.
for (int y = 0; y < m_Map.GetLength(0);
y++)
{
// Loop through the x axis.
for (int x = 0; x <
m_Map.GetLength(1); x++)
{
// Get the tile at the current
coordinates.
s = m_TileList[m_Map[y, x]];
// Check if the tile is solid. If
so, draw a yellow border on it.
if (s.IsSolid)
m_RenderTarget.DrawRectangle(m_DebugBrush,
Search WWH ::




Custom Search