Using a sprite sheet in code
In this recipe we are going to look at playing an animation sequence using the sprite sheet we just created in the prior recipe.
Getting ready
This recipe assumes you have completed the Creating a sprite sheet recipe or have a sprite sheet acquired from another source. Make sure your sprite sheet is composed of sprites of an identical size. In this example, our sheet is 2 rows of 4 columns of sprites, with the bottom-right sprite being empty, for a total of seven sprites.
Create a new project, and then add a reference to GameEngine2D.
How to do it...
- In
AppMain.cs
replace the existing code with the following code:using System; using Sce.PlayStation.Core; using Sce.PlayStation.HighLevel.GameEngine2D; namespace Ch3_Example4 ...
Get PlayStation®Mobile Development Cookbook 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.