ios - Calling my enemy class method from the game scene -


I'm still quite new to programming and what I tried to do is the following: so I have my enemies The scene in a different class separated from the game. In every enemy class.m file I declare six methods, each method represents a new level, which will be called from the game scene. Then in the ways I declare the image of the phantom, path, particle type shooting etc. Here is an example of the level 1 method in the NEMEX.M file:

  @implementation EnemyClass + (zero) Levels of enemies 1 {Animation = @ "Enemy 1"; SKSpriteNode * Enemy = [SKSpriteNode spriteNodeWithImageNamed: EnemyName]; PathSpeed ​​= 3; CGPathRef Path = CGPathCreateWithEllipseInRect (CGRectMake (0,0400,400), NULL); SKAction * followTrack = [follow SKAction Path: Offset as Path: No Orientopyath: Yes Duration: Path Speed]; SKAction * Forever [repeat repeat term: followTrack]; SKAction * addEnemy = [skeleton runblock: ^ {[AddChild himself: enemy]; }]; SKAction * Enemy's Failure = [Sketch Sequence: @ [Andney, Forever]]; [Self-driving action: enemy ability]; However, Xcode tells two issues:  
  No known class method for selector "addChild"  
< P>

  No known class method for selector "run action"  

I am calling this method from GameScene.m:

  @interface and class: NSObject + ( Zero) Enemy: 1; + (Zero) enemiesLevel2; + (Zero) enemiesLevel3; + (Zero) enemiesLevel4; + (Zero) enemiesLevel5; + (Zero) enemiesLevel6; @end  

It may look like a silent question, but I am still new and I appreciate any help! BTW: I had imported the Phantom Kit frame

your anonym class As addChild or run action methods, because it is not derived from the subclass of SKNode or sqnd it happens.

Change:

@interface EnemyClass: NSObject

to

  @interface EnemyClass: SKNode  

Update:

In addition to this, you have defined class code as enemiesLevel1 If you intend to sue addChild with them, then they need examples of methods

Here is a question that can help you:

Be sure to read all the answers, because some of them have good information that you should be aware of.


Comments

Popular posts from this blog

java - org.apache.http.ProtocolException: Target host is not specified -

java - Gradle dependencies: compile project by relative path -

ruby on rails - Object doesn't support #inspect when used with .include -