Questions tagged [ccaction]

CCAction is a class from the popular Cocos2d engine

CCAction is a class from the popular Cocos2d engine

Class Reference

64 questions
4
votes
1 answer

Cocos2d - move a sprite from point A to point B in a sine wave motion

What would be the best way to do this? I see the CCEaseSineInOut action but it doesn't look like that could be used to do this. I need to move from one side of the screen to the other. The sprite should move in a sine-wave pattern across the screen.
soleil
  • 12,133
  • 33
  • 112
  • 183
2
votes
1 answer

Anyway to modify the destination of CCMoveTo after action started?

I want to move a node and call a block after move done. But sometimes I need to move the node to another position while that node is moving (change destination). I can't simply stop the previous action and start new one because than the callback…
Bryan Chen
  • 45,816
  • 18
  • 112
  • 143
2
votes
2 answers

Cocos2D V3 does not have CCCallFuncND How pass structure address to selector?

With Cocos2D V3 after action has completed on a sprite I need to update data contained in a structure. How can I pass a data structure address to a selector that executes after my sprite action has completed? Any help much appreciated.
2
votes
2 answers

Sprite animation not working in NSThread method in Cocos2d

I created a Thread like the below one: [NSThread detachNewThreadSelector:@selector(connectionFinishedThread) toTarget:self withObject:nil]; inside this method, i created one sprite and given animation for this sprite. Animation not visible. My code…
Hari Babu
  • 891
  • 1
  • 9
  • 22
2
votes
3 answers

cocos2d :: CCmoveTO

Hi, i am new to cocos2dx programming........ I am trying to make a projectile motion of a target sprite // in addtarget() part int i(0); while(i<20) { p=HelloWorld::nextPoint(p,0.5);//p is a struct see below. cocos2d::CCFiniteTimeAction*…
1
vote
2 answers

Cocos2D getting progress of CCAction

I have a Cocos2D game with Box2D physics. In my GameScene.mm, I'm working on a method to zoom to a given scale: -(void) zoomToScale:(float)zoom withDuration:(ccTime)duration { id action = [CCScaleTo actionWithDuration:duration scale:zoom]; …
numegil
  • 1,916
  • 7
  • 26
  • 38
1
vote
1 answer

What causes a sprite to be distorted, when no scales are applied

A picture is worth a thousand words. Here's mine: Above depicts two sprites, the one on the centre right is the player, and the one on the centre left is an AI player. Both of their initializations use the same superClass. We should see similar…
ThompsonCodes
  • 35
  • 1
  • 9
1
vote
2 answers

How to change a CCSprite's position during a move action

Is it possible to change a CCSprite's position during a move action, like CCMoveBy? I have a subclass of CCSprite that cycles through a bunch of actions, some of which are moves. I check to see if it has gone offscreen, and then attempt to move it…
Steve
  • 6,332
  • 11
  • 41
  • 53
1
vote
2 answers

How to slow down the All actions of cocos2dx Game

I'm implementing a game on cocos2d-x. Now I implemented a "Replay of My Game" feature (Game shows from start) But I want to replay my game at the speed of 1x , 2x , 3x , 4x. When changing speed to 2x all actions (move and rotate etc.) should work…
1
vote
1 answer

CCActionSequence/CCActionDelay not delaying each action?

I have a function which creates a CCSprite and moves it across the screen: func fireWeapon(target: CGPoint) { let projectile = CCBReader.load("Projectile") as! CCSprite projectile.position = player.position; self.addChild(projectile); …
1
vote
1 answer

Cocos2d implementation of Pause - The Game scene/layer issue

I am trying to create pause screen for my game. The game is developed upon continuous scrolling background (top to bottom) with obstacles which are moving independently (left to right). Below is the code: PauseScene.h @interface PauseScene :…
Paresh Thakor
  • 1,795
  • 2
  • 27
  • 47
1
vote
1 answer

Cocos2d-x: add parameter in callfuncN_selector

I want to run actions for a sprite like below: CCRotateTo* actionTo = CCRotateTo::create(0.2, 0.0f, -90.0f); CCRotateTo* actionToBack = CCRotateTo::create(0.2, 0.0f, -180.0f); CCFiniteTimeAction* actionChangeTexture = CCCallFuncN::create(this, …
Lex Nguyen
  • 401
  • 11
  • 23
1
vote
0 answers

CCActionFollow will not follow the target object and scroll layer

I have a ball object that falls straight down a level made in SpriteBuilder as a layer. The level is added to the gameplay scene, which has a ccnode (_levelNode) as a child of the physics node. However, when the game runs it either doesn't scroll,…
Ninwinz
  • 50
  • 6
1
vote
2 answers

Trying to use CCEaseOut to slow CCSprite Movement

I am trying to make my CCSprite come a gliding stop instead of an abrupt halt however I'm not too sure how to do this. I'm moving a CCSprite using CCActionMoveTo and CCEaseOut based on where the user taps; the sprite does move however doesn't glide…
1
vote
1 answer

How to run an action after the current action (not stopping the current action and run he new one) in cocos2d

I have an issue of using the runAction in cocos2d. I would like to run an action when the touch begin and run an action when touch is ended. Implemented like the code below: -(void) touchBegan:(UITouch *)touch withEvent:(UIEvent *)event { …
matee
  • 91
  • 1
  • 10
1
2 3 4 5