Without going into detail, when defining texture coordinates within an image for OpenGL ES, it is possible to sample a pixel beyond the edge of the texture you are defining. Spacing is an important property within a sprite sheet. Information is also provided about any spacing that has been used within the provided sprite sheet image. The dimensions to be used when dividing up the sprite sheet will be provided when a new sprite sheet is instantiated. The SpriteSheet class takes the image provided and chops it up into equally sized sub-images (sprites). I use the term packed because you can place smaller sprite sheets within this larger sprite sheet, thus reducing the number of separate sprite sheets used in the game.Īnother term for a sprite sheet is a texture atlas, but I will continue to use the old-school term of "sprite sheet" throughout this book. Basic sprite sheets are handled in a class called SpriteSheet, whereas the PackedSpriteSheet class handles complex sprite sheets. Although it is possible to merge both the simple and complex sprite sheet functionality into a single class, I have split them into two different classes to make things easier to understand. Complex, where the images in the sprite sheet could all have different dimensions.įor Sir Lamorak's Quest, we are going to be using both kinds of sprite sheets.Basic, where all the images in the sprite sheet have the same dimensions.Introduction to Sprite SheetsĪs mentioned in Chapter 2, there are two different types of sprite sheets, as follows: This chapter reviews the SpriteSheet and PackedSpriteSheet classes and shows how to extract specific images from within a larger image sprite sheet. You gain the ability to easily define and reuse image elements of the game, even in animations.You reduce the number of times you need to ask OpenGL ES to bind to a new texture, which helps with performance.There are two key benefits to using sprite sheet, as follows: If you remember from Chapter 2, "The Three Ts: Terminology, Technology, and Tools," a sprite sheet is a large image that contains a number of smaller images. Having done all that hard work, and with the classes in place for representing and rendering images, we can move on to the other components needed in the game engine for Sir Lamorak's Quest.Īs the title suggests, this chapter is all about sprite sheets. Learning iOS Game Programming: A Hands-On Guide to Building Your First iPhone GameĬhapter 5, "Image Rendering," was large and covered a number of complex concepts.
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |