I'm still fairly new to programming and what I tried to do is the following: So I separated my Enemies from my game scene to a different class. In the Enemy class.m file I declared 6 methods. Every method represents a new level, which will get called from the game scene. So in the methods I declare the sprite's image, path, shooting particle type, etc.. Here's an example of the level 1 method in the EnemyClass.m file:
@implementation EnemyClass
+(void)enemiesLevel1
{
EnemyName = @"enemy1";
SKSpriteNode* enemy = [SKSpriteNode spriteNodeWithImageNamed:EnemyName];
pathSpeed = 3;
CGPathRef path = CGPathCreateWithEllipseInRect(CGRectMake(0,0,400,400), NULL);
SKAction *followTrack = [SKAction followPath:path
asOffset:NO
orientToPath:YES
duration:pathSpeed];
SKAction *forever = [SKAction repeatActionForever:followTrack];
SKAction *addEnemy = [SKAction runBlock:^{
[self addChild: enemy];
}];
SKAction *enemySequence = [SKAction sequence:@[addEnemy, forever]];
[self runAction: enemySequence];
}
However, Xcode is states two issues:
No known class method for selector "addChild"
and
No known class method for selector "runAction"
I'm calling the method from GameScene.m with:
[EnemyClass enemiesLevel1]
Here's EnemyClass.h if anyone's wondering:
@interface EnemyClass : NSObject
+(void)enemiesLevel1;
+(void)enemiesLevel2;
+(void)enemiesLevel3;
+(void)enemiesLevel4;
+(void)enemiesLevel5;
+(void)enemiesLevel6;
@end
It may seem like a dumb question, but I am still new and I would greatly appreciate any help! BTW: I did import the sprite kit framework.