My hero sprite is on a physics sprite. If the player (user) doesn't move the hero for 2 seconds while touching the sprite I want to end the game. In the update method I am checking to see if the two sprites are touching for longer than 2 seconds and…
I'm animating a sprite in my game (via sprite sheets etc.). It's a simple animation, which I want to happen throughout the life of game. The sprite is also a physics body.
And when the screen is touched, I want sprite to perform some actions.
I've…
I want to move two different objects, pane1 and pane2, simultaneously using CCActionMoveTo, and I want to call a function once these two objects finish moving.
CCActionMoveTo * actionMove1 = [CCActionEaseOut actionWithAction:
…
Please help me as am fed with the searches and new to cocos 2d. Only am getting is the last sprite got moving if i schedule addRed and i want all the sprites moving randomly in the screen. Any help will be Appreciated and thanks in…
Is there a limit to how big a Label can be in cocos2d-x 3.0? I'm trying to create a 'typewriter' effect and it seems to work when the string is 45 characters or less. If it's any more if fails with the usual EXC_BAD_ACCESS. Below is the code I'm…
I'm Using Cocos2d Android.
I have a scrolling background in Cocos2d, i use this method to make it work :
public void moveBackground(float dt) {
bg1.setPosition(CGPoint.ccp(bg1.getPosition().x, bg1.getPosition().y
- speed));
…
In cocos2d v3, I could not find something like CCTargetedAction.
It is required in my project, so I copied code from cocos2d v2.
@interface CCTargetedAction : CCActionInterval
/** This is the target that the action will be forced to run with…
I'm using cocos2d and I create a CCDrawNode.
The moment I call addChild: to add the CCDrawNode I call the following method to make the node scale forever:
CCActionScaleBy *scaleAction = [CCActionScaleBy actionWithDuration:0.3f…
I have an Init method and spawn() method which is called by a CCAction every 2 seconds!
What i want is to move pipePair node across the screen every 2 seconds, something like in the flappy bird game! But in my case am not able to add multiple pairs…
Could someone help me figure out how to safely stop all actions when closing a Win32 cocos2dx app that is running CCRepeatAction. I have tried adding sprite->stopAllActions(); in the Destructor, OnExit() and in the update(float delta); methods but…
I'm trying to do what I did hundred of times with cocos2d, but with cocos2d-x seems I have less luck.
If i do
CCsequence *squence = CCSequence::create(someAction1, someAction2, NULL);
the compiler says:
No matching function for call to…
I am wondering if it is possible to run a fadeOut action half way through a moveTo action all on the same node. Here is my code:
id show = [CCShow action];
id move = [CCMoveTo actionWithDuration:2.5f position:ccp(70, 275)];
id seq = [CCSequence…
I am working on a sidescroller game in cocos2d.
I have a CCAction derived from a CCAnimation that runs on a CCSprite.
I run the CCAction with CCRepeatForever, but I’m not able to change the animation frame rate while the action is being…
In my code (sample) below I would like to change the sprite's image during the sequence of actions.
spriteActions = [CCRepeatForever actionWithAction:
[CCSequence actions:
[CCShow action],
…
I have two sprites that I want to run a sequence of actions on. Though one sprite is created before the other I would like the latter sprites actions to synchronise with the former. How can this be achieved bearing in mind that some actions of the…