Question

Hoping someone can help me here. I am attempting to sequentially runAction on two sprites. If I remove hand.setScale the same result occurs as the code below, i.e. the sprite covers the entire screen (800x600). hand sprite is 13px x 12px. If modify the setScale to (0.5) the sprite hand doesn't display at all. If I declare and set the hand sprite in the main function just below the declaration of the splat sprite and then in the wipe_splat function set the visibility of hand to true this doesn't display the sprite either. Eventually I want to move the hand sprite across the screen. For now however I am simply trying to display it.

//main function
var splat = cc.Sprite.create(res.splat_img);
splat.setPosition(399, 299);   // (screen dimenstion - object dimension) / 2
layer.addChild(splat, 3, 4);

splat.runAction(cc.Sequence.create(cc.ScaleTo.create(0.25, 401, 301),  cc.EaseIn.create(cc.Spawn.create(cc.MovveTo.create(6, cc.p(400, 100)),cc.FadeTo.create(6, 225)), 5), cc.CallFunc.create(this.wipe_splat, this, layer)));

function wipe_splat(layer)
{
    var hand = cc.Sprite.create(res.hand_img);
    hand.setPosition(25, 25);   // (screen dimenstion - object dimension) / 2
    hand.setScale(1);
    layer.addChild(hand, 4, 5);
};
Was it helpful?

Solution

You need to use the delay action

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top