2D Graphics Programming for Games
John Pile Jr.
Format: PDF / Kindle (mobi) / ePub
The success of Angry Birds, Peggle, and Fruit Ninja has proven that fun and immersive game experiences can be created in two dimensions. Furthermore, 2D graphics enable developers to quickly prototype ideas and mechanics using fewer resources than 3D.
2D Graphics Programming for Games provides an in-depth single source on creating 2D graphics that can be easily applied to many game platforms, including iOS, Android, Xbox 360, and the PlayStation Suite. The author presents examples not only from video games but also from art and animated film.
The book helps new programmers learn the concepts and techniques used to produce appealing 2D graphics. It starts with the basics and then covers topics pertaining to motion and depth, such as cel animation, tiling, and layering. The text also describes advanced graphics, including the use of particle systems, shaders, and splines. Code samples in the text and online allow readers to see a particular line of code in action or as it relates to the code around it. In addition, challenges and suggested projects encourage readers to work through problems, experiment with solutions, and tinker with code.
Full of practical tools and tricks, this color book gives novices in-depth guidance on making professional, high-quality graphics for games. It also improves the relationship between programmers and artists by explaining how certain art and design challenges can be solved with a programmatic solution.
associated with each sprite have been stored in individual variables. Your challenge is to create a more robust code architecture to store and render multiple sprites on multiple sprite sheets. A good place to start is with an object-oriented architecture. A sprite class could include a reference to the texture as well as sprite source data. An object class could include a reference to the sprite class as well as the appropriate destination data. Challenge 3.3. Create a process for parsing the
development. In so doing, we could then have an expectation for a better end-product. I think that is a great suggestion, and hopefully it is something you’ll think about as you start to work with artists on your projects. It is a reminder that, in many ways, the discipline of game development is still new, and there is a lot we can still learn from traditional media. Exercises Questions 4.1. How many milliseconds pass between cels that are animated to play at 30 fps? 4.1. The sprite sheet for
assets sprite sheets added to your content folder and then add the following member variables: 1 5 10 // .. // Source Data private Texture2D r un Cy c le Te xt u re ; private Rectangle c u r r e n t C e l L o c a t i o n ; private Vector2 ru nn e rC el Or i gi n ; private Texture2D snowman Texture ; private Rectangle s n o w m a n C e l L o c a t i o n ; private Vector2 snowmanCelOrigin ; // Destination Data private Vector2 ru nnerPosi tion ; private Vector2  sn o w m e n P o s i t i o n s =
Platform-Specific Localization In addition to these international issues, it is likely that for clarity (and it is often required by a publisher), you will need to place graphics of the buttons inline (see Figure 7.3) or other system features in place of the letters or descriptions. For example, an up arrow may have to be overlaid on an image of the Figure 7.3. Platform-specific localization: press direction pad instead of simply writing “press A to continue. up.” 7.4 Safe Frames When
set of snowflake textures. 8.4.5 Other Effects Figure 8.16. Example: silly effect of head on fire. We have seen how particles can be emitted from points and by lines when we offset the origin. But what if we were to update the effect origin through our game code? We would then have the ability, for example, to create effects like flames shooting out from the top of a character’s head (Figure 8.16). We can achieve a variety of other effects with particles that might not seem as obvious as the