Game AI – iPhone

Here is a little preview of an Cocos2d CCSprite that rotates to follow a player.

The Cocos2d iphone framework is an open source game programming framework written in Objective-C. The Cocos2d game programming framework targets iOS devices and OSX Mac platform.

Read full article here >>

CGPoint Pass By Reference

The following example shows how to pass CGPoint by reference in Objective-C.

Class Interface

@interface
  -(void)multiplyX:(CGPoint *)point by:(float)a
@end

Class Implementation

@implementation
-(void)multiplyX:(CGPoint *)point by:(float)a {
   (*point).x = (*point).x * a;
}
@end

Read full article here >>

CGRect, CGSize, CGPoint

If you have used any C structs in Objective-C programming for screen alignment or sizing then you have used either CGPoint, CGRect and CGSize.

The Objective-C programming language can appear a little intimidating due to it’s unique syntax. However, once your gain the syntax knowledge it is much less intimidating.

Read full article here >>