Cocos2d-x by Example:Beginner's Guide(Second Edition)
上QQ阅读APP看书,第一时间看更新

Extending Sprite

No, there is nothing wrong with Sprite. I just picked a game where we need a bit more information from some of its sprites. In this case, we want to store where a sprite is and where it will be once the current iteration of the game is completed. We will also need a helper method to get the sprite's radius.

So let's create our GameSprite class.