Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Cocos2d Game Development Essentials

You're reading from   Cocos2d Game Development Essentials For new users - a quickstart guide to bringing your mobile game ideas to life with Cocos2D

Arrow left icon
Product type Paperback
Published in Jan 2015
Publisher
ISBN-13 9781784390327
Length 136 pages
Edition 2nd Edition
Languages
Tools
Arrow right icon
Author (1):
Arrow left icon
Ben Trengrove Ben Trengrove
Author Profile Icon Ben Trengrove
Ben Trengrove
Arrow right icon
View More author details
Toc

The building blocks, nodes

In Cocos2d, everything you see on screen is a subclass of the CCNode class. Even the scenes your game has are subclasses of the CCNode class.

There are some important subclasses that will be used in almost every game. Therefore, it is important to know them. These are as follows:

  • CCSprite: This represents an image that can be animated
  • CCNodeColor: This is a plain colored node
  • CCLabelTTF: This is a node that renders text in any TrueType font
  • CCButton: This is an interactive node that can have an action attached
  • CCLayoutBox: This is a node that lays out other nodes in a vertical or horizontal layout

Tip

The CCLayoutBox node replaces the CCMenu class, which was in the previous versions of Cocos2d.

The reason every class inherits from the CCNode class is that there are some important properties that all visible elements on-screen need. These are as follows:

  • contentSize: This is the size of the element in the unit that is specified in the contentSizeType property
  • position: This...
lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime
Banner background image