iphone - How to create Enemies class in cocos2d -
i using cocos2d iphone want create class enemies
see code
#import <foundation/foundation.h> #import "cocos2d.h" @interface enemies : ccsprite { float imageheight; } @property float imageheight; +(id) enemies; @end @implementation enemies @synthesize imageheight; +(id) enemies{ return [[[self alloc] initwithfile:@"enemy.png"] autorelease]; } @end
i want set imageheight
float imageheight = [enemy texture].contentsize.height;
so whenever create instance of class enemies should have imageheight set properly?
thanks
note: trying improve this code
ahmed, keep enemies
method same, , add class:
-(id) init { if (self = [super init]) { float textureheight = [enemy texture].contentsize.height; [self setimageheight:textureheight]; } return self; }
this set imageheight
new instances of enemies
class.
Comments
Post a Comment