Note that there are some explanatory texts on larger screens.

plurals
  1. PORunning two Cocos2D action sequences at the same time not working
    primarykey
    data
    text
    <p>I am attempting to move the camera with two action sequences in a box2d world. The objective is to have a smooth transitions that lets the user see the whole game space as the camera pans. The first sequence contains a short delay action followed by an action to move the camera from right to left. The second sequence contains the same short delay action followed by an action to zoom out and an action to zoom back in. The zoom out and zoom in have a combined duration equal to the panning action. Unfortunately the actions in both sequences do not line up. Instead, part of one sequence will run, then part of the other sequence will run, then finally they run in a synchronized fashion for the last part of the sequences. The following is the code I am using:</p> <pre><code>[self runAction: [CCSequence actions: [CCDelayTime actionWithDuration:0.5], [CCMoveBy actionWithDuration: 1.0f position:ccp(-lastXPositionForCamera, 0)], [CCCallFunc actionWithTarget:self selector:@selector(startOver)], nil]]; // Run a second action at the same time. // This second action will cause the camera to zoom out and then back in [self runAction: [CCSequence actions: [CCDelayTime actionWithDuration:0.5], [CCScaleTo actionWithDuration: 0.5f scale:0.5f], [CCScaleTo actionWithDuration: 0.5f scale:1.0f], nil]]; </code></pre> <p>So what happens is the following: there is a slight delay followed by the camera zooming out. After the camera zooms out, the camera will begin to pan from right to left while simultaneously zooming back in. </p> <p>If I change the initial CCDelayTime to 0.4, then the behavior is slightly different. In this case, the camera starts to pan right to left after a short delay. Then it stops panning while the camera zooms out. Finally, the camera will resume panning right to left while simultaneously zooming back in.</p> <p>If there is not anything wrong with the above code, then is there a better way to make a smooth transition consisting both the zooming actions and the panning actions?</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload