Class vs Structs Both: Store values, initialize, subscripts, extensible & protocol Class can inherit, de-initialize, reference counting & typecast Functions vs Methods Methods are FUNCTIONS INSIDE A CLASS Functions can be inside or OUTSIDE A CLASS! Cannot use functionName(param1,param2) to call a function declared inside a class {} Methods: It is implicitly passed the object for which it was called It is able to operate on data that is contained within the class Instance Methods vs Type Methods (Instance Method vs Class Methods I think) Methods are functions that are associated with a particular type. Classes, structures, and enumerations can all define instance methods, which encapsulate specific tasks and functionality for… Read More
Continue ReadingCocos2d Tips: Design Game Objects for your game
Keep your game classes organized and logically ordered. Create a GameObject class, a GameCharacter class and then subclass these. Its important to keep your Game Objects ordered as well as your code. The more you order your objects, the cleaner your code will be as well. A GameObject is anything used in a game from labels to sprites to power ups. Its important to create a base class for all objects because, as a simple example, you want to be able to constrain all game objects to your screen. Its not unthinkable to believe that at some point you might inadvertently cause a game object to be pushed off screen.… Read More
Continue Reading