官术网_书友最值得收藏!

Chapter 2. Sprites, Camera, Action!

We will start our first game by learning how to draw shapes and textures on the screen. SpriteKit makes drawing simple by doing a lot of the hard work and exposing simple classes we can use for rendering. We are free to focus on building great gameplay experiences while SpriteKit performs the mechanical work of the game loop.

To draw an item on the screen, we need to create a new instance of a SpriteKit node. These nodes are simple; we attach a child node to our scene, or to existing nodes, for each item we want to draw. Sprites, particle emitters, and text labels are all considered nodes in SpriteKit.

Note

The game loop is a common game design pattern used to constantly update the game many times per second and maintain the same gameplay speed on fast or slow hardware. SpriteKit wires new nodes into the game loop automatically. As you gain expertise with SpriteKit, you may wish to explore the game loop further to understand what is going on "under the hood".

The topics in this chapter include the following:

  • Preparing your project
  • Drawing your first sprite
  • Animation—movement, scaling, and rotation
  • Working with textures
  • Organizing art into texture atlases
  • Centering the camera on a sprite
主站蜘蛛池模板: 固始县| 清丰县| 海林市| 昌都县| 渝中区| 太湖县| 榆中县| 栖霞市| 同心县| 南靖县| 安宁市| 进贤县| 绥宁县| 深水埗区| 广饶县| 双江| 长顺县| 美姑县| 城市| 抚远县| 庆云县| 慈利县| 连州市| 大新县| 大新县| 蒙城县| 平度市| 闽清县| 平湖市| 蒙城县| 固阳县| 莱西市| 武邑县| 禄劝| 资兴市| 孝义市| 湟源县| 田东县| 苍南县| 麟游县| 南汇区|