Creating Game Elements
In This Chapter
Creating your own sprite objects
Adding properties and methods to custom objects
Incorporating sound effects
Detecting collisions between sprites
Setting up a basic timer
Games have things moving around, crashing into each other, and making noise. Obviously, to have a game, you’ll need these elements. You can build objects with the
Sprite element built into the
simpleGame library (refer to Chapter 5 if you need a review of building simple games with this library).
Building Your Own Sprite Objects
To make very powerful games, you’ll want to be able to build your own sprites that do exactly what you want them to do.
In this chapter, you find out how to build your own new types of objects based on existing objects. After you make an object, you can give it characteristics and behavior.
Making a stock sprite object
To get started, take a look at this simple object: