We will quickly overrun our project navigator with image files if we add all our textures like we did with our bee. Luckily, Xcode provides several solutions.
We can store images in an .xcassets
file and refer to them easily from our code. Follow these steps to prepare our .xcassets
file:
Open
Assets.xcassets
from your project navigator.You will see an empty
AppIcon
entry. You can leave it there for now; we will revisit theAppIcon
later.
We will use texture atlases for most of our in-game art. Texture atlases organize assets by collecting related artwork together. They also increase performance by optimizing all of the images inside each atlas as if they were one texture. SpriteKit only needs one draw call to render multiple images out of the same texture atlas. Plus, they are very easy to use! Follow these steps to build your bee texture atlas:
First, we need to remove our old bee texture. Right...