Drawing the player and other sprites

Before we add the code to move the player and use all our new sprites, let's draw them. This is so that, as we add code to update/change/move the sprites, we will be able to see what is happening.

Add the highlighted code to draw the four new sprites:

// Draw the tree 
window.draw(spriteTree); 
 
// Draw the player 
window.draw(spritePlayer); 
 
// Draw the axe 
window.draw(spriteAxe); 
 
// Draraw the flying log 
window.draw(spriteLog); 
 
// Draw the gravestone 
window.draw(spriteRIP); 
 
// Draw the bee 
window.draw(spriteBee); 

Run the game and you will see our new sprites in the scene.

Drawing the player and other sprites

We are really close to a working game now. ...

Get Beginning C++ Game Programming now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.