Game Development Reference
In-Depth Information
What just happened?
Things only begin happening in the static method. We create a new
GameSprite
class,
then we call
initWithFile
on it. This is a
GameSprite
method inherited from its su-
per class; it returns a Boolean value for whether that operation succeeded. The static meth-
od ends by returning an
autorelease
version of the
GameSprite
object.
The
setPosition
override makes sure
_nextPosition
receives the position inform-
ation whenever the sprite is placed somewhere. And the helper
radius
method returns
half of the sprite's texture width.