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.
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…
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.
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…
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*…
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];
…
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…
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…
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…
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);
…
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 :…
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,
…
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,…
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…
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
{
…