How to run or execute an SKAction from outside of the object?

adimona

I have some code like following:

-(void) createBall {

    _ballSprite = [SKSpriteNode spriteNodeWithImageNamed:@"ball0001"];
    _ballSprite.position = CGPointMake(firstNode.position.x, firstNode.position.y);
     SKAction *ballScale =[SKAction scaleXTo:-0.5 duration:0];
     SKAction *ballMove = [SKAction moveByX:0 y:-300 duration:0];
     SKAction *ballMoveScale = [SKAction sequence:@[ballScale,ballMove];
     SKAction *ballScaleMove = [SKAction sequence:@[ballMove,ballScale]; //Unused variable
     [_ballSprite runAction:ballMoveScale];
     [self addChild:_ballSprite];

}

Now how do I run let say ballScaleMove from out side eg. inside the touchBegan handler or at initWithSize ..etc.?

-(void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event {

///here maybe
[_ballSprite runAction:ballScaleMove];  // Error undeclare identifier 'ballScaleMove';


}
eharo2

You need to define your properties or iVars as global. define them in the @interface of your class

@interface
@property Class *myProperty;
@end

Then you can access them with self.myProperty or _myProperty (accessing the implicit iVar for your property)

I hope it helps

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

Force object to run/execute methods in sequence

From Dev

SKAction playSoundFileNamed from Singleton

From Dev

How to access an object in c sharp from outside my method?

From Dev

How to run main in a Scala object from Maven

From Dev

How do I run execute commands from a file?

From Dev

How to execute and receive results from AsyncTasks outside of the main thread?

From Dev

How can I run python in a given timezone (change timezone from outside)?

From Dev

SPECjvm: How to execute outside installation folder

From Dev

How to execute two separate queries from one DBCommand object?

From Dev

How to run code from included filepath of object into function scope outside object?

From Dev

How to call Highcharts tooltip formatter function from outside the config object?

From Dev

How do I stop the object from going outside the screen?

From Dev

How to execute python from conda environment by dvc run

From Dev

Airflow - how to execute DAG from its last successful instance run?

From Dev

How to run a php file with wamp from outside of the www directory?

From Dev

How to asynchronously execute method from unique_ptr to object?

From Dev

SKAction playSoundFileNamed from Singleton

From Dev

SKAction from stringWithFormat

From Dev

How do I run execute commands from a file?

From Dev

How to execute and receive results from AsyncTasks outside of the main thread?

From Dev

Will calling System.exit(0); from an object outside of main run garbage collection?

From Dev

How to install grunt outside of a project and run tasks from the project directory

From Dev

Run systemd script in chroot from outside the chroot?

From Dev

How can a run a compiled java or c program from a shell file from outside its directory?

From Dev

How to execute two separate queries from one DBCommand object?

From Dev

How to run code from included filepath of object into function scope outside object?

From Dev

How to execute an sh file from a short cut in the desktop to run an app

From Dev

iex- How to run an elixir project from outside the app folder

From Dev

How to update a Vue component props object from outside?

Related Related

  1. 1

    Force object to run/execute methods in sequence

  2. 2

    SKAction playSoundFileNamed from Singleton

  3. 3

    How to access an object in c sharp from outside my method?

  4. 4

    How to run main in a Scala object from Maven

  5. 5

    How do I run execute commands from a file?

  6. 6

    How to execute and receive results from AsyncTasks outside of the main thread?

  7. 7

    How can I run python in a given timezone (change timezone from outside)?

  8. 8

    SPECjvm: How to execute outside installation folder

  9. 9

    How to execute two separate queries from one DBCommand object?

  10. 10

    How to run code from included filepath of object into function scope outside object?

  11. 11

    How to call Highcharts tooltip formatter function from outside the config object?

  12. 12

    How do I stop the object from going outside the screen?

  13. 13

    How to execute python from conda environment by dvc run

  14. 14

    Airflow - how to execute DAG from its last successful instance run?

  15. 15

    How to run a php file with wamp from outside of the www directory?

  16. 16

    How to asynchronously execute method from unique_ptr to object?

  17. 17

    SKAction playSoundFileNamed from Singleton

  18. 18

    SKAction from stringWithFormat

  19. 19

    How do I run execute commands from a file?

  20. 20

    How to execute and receive results from AsyncTasks outside of the main thread?

  21. 21

    Will calling System.exit(0); from an object outside of main run garbage collection?

  22. 22

    How to install grunt outside of a project and run tasks from the project directory

  23. 23

    Run systemd script in chroot from outside the chroot?

  24. 24

    How can a run a compiled java or c program from a shell file from outside its directory?

  25. 25

    How to execute two separate queries from one DBCommand object?

  26. 26

    How to run code from included filepath of object into function scope outside object?

  27. 27

    How to execute an sh file from a short cut in the desktop to run an app

  28. 28

    iex- How to run an elixir project from outside the app folder

  29. 29

    How to update a Vue component props object from outside?

HotTag

Archive