Summary
Congratulations! You have built your first cross-platform app and stepped through the code to see how it works. At this point, you should have a basic idea of how a Cocos2d app is put together. You have created scenes to contain different screens of your game, and you have used the CCDirector
class to move between them. You have created different types of nodes to display content on the screen, including CCLabelTTF
for text content, CCButton
to create a button on screen, and CCSprite
to display an image. You have used CCActions
in the form of CCActionRotateBy
and CCActionMoveTo
, and you modified their behavior using CCActionRepeatForever
. You also learned how to create a solid rectangle of color using CCNodeColor
.
You should now have a play with the sample code and see what you can do. Try changing the durations and text, and the colors of the background. You could also try to replace the image with your own or have more than one image.
In the next chapter, you will build on the knowledge gained in this chapter by going over the details of nodes, sprites and scenes. You will also build your very first game and deploy it to your device.