Animate the Monsters
To help distinguish your monster generators from standard monsters, you’ll create an animation component, which you’ll use to animate the monsters. First you’ll create an extension to help build the textures. Then, you’ll build out the animation component and define the different types of animations.
Creating an Animation Extension
In Load the Textures, you built a small helper method to help load textures for animation. This time around, however, you’ll create an extension method for the SKTexture class instead. Extensions are generally preferred as they tend to be more reusable than helper methods that can easily get buried within the underbelly of your code.
In the Project Navigator, and inside the Extensions group, ...
Get Apple Game Frameworks and Technologies 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.