- Beginning C++ Game Programming
- John Horton
- 145字
- 2021-03-26 16:12:30
Drawing the player and other sprites
Before we add the code to move the player and use all of our new sprites, let's draw them. We are doing it this way so that as we add code to update/change/move them, we will be able to see what is happening.
Add the following 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);
// Draw the flying log
window.draw(spriteLog);
// Draw the gravestone
window.draw(spriteRIP);
// Draw the bee
window.draw(spriteBee);
The preceding code passes our four new sprites, one after the other, to the draw function.
Run the game and you will see our new sprites in the scene:

We are really close to a working game now. The next task is to write some code to allow the player to control what happens.
- Visual Basic程序開發(學習筆記)
- C語言程序設計教程(第2版)
- Learning ASP.NET Core 2.0
- Haskell Data Analysis Cookbook
- Swift 4從零到精通iOS開發
- Test-Driven JavaScript Development
- Getting Started with Python
- Mockito Essentials
- ASP.NET 4.0 Web程序設計
- 交互設計師成長手冊:從零開始學交互
- 例說FPGA:可直接用于工程項目的第一手經驗
- PHP動態網站開發實踐教程
- 大話代碼架構:項目實戰版
- Spring MVC Cookbook
- 利用Python駕馭Stable Diffusion:原理解析、擴展開發與高級應用(智能系統與技術叢書)