Cocos2d: Making a CocosNode subclass

Member
Posts: 22
Joined: 2008.10
Post: #1
Hi!

Im getting into iPhone game development with Cocos2d.

I'm trying to make a class for my character that contains various animations/sprites and some additional functionality that I want to be able to add to the Scene or Layer directly through addChild().

I figured that inheriting the CocosNode should be a good start, but what functions/properties are used to return the actually texture data that's beeing displayed on the layer? In other words, what do i need to implement for my class to show up when added to the scene?

Thanks in advance!
Quote this message in a reply
Moderator
Posts: 508
Joined: 2002.09
Post: #2
If I recall correctly Cocos2d has a Sprite class which takes a UIImage I believe. Use that in your draw function

"When you dream, there are no rules..."
Quote this message in a reply
Post Reply 

Possibly Related Threads...
Thread: Author Replies: Views: Last Post
  UIView Subclass not displaying controls... flipflop 7 6,866 May 13, 2010 01:16 PM
Last Post: flipflop