How to move two different Sprite at the same time?
How to move two different Sprite at the same time?
Bug #3079 [Closed]
- Status changed from New to Resolved
- Status changed from Resolved to Closed
Status: | Closed | |
---|---|---|
Start date: | 2013-10-29 | |
Priority: | Low | |
Due date: | ||
Assignee: | - | |
% Done: | 0% |
|
Category: | - | |
Target version: | - |
Hello everyone, I have problem regarding on moving sprites. I have no issue when I want to move one sprite animation using the functions I have used. But when I want to move two different sprites animation at the same time, my previous sprite animation had stop moving. =(
By the way, these are the function I’ve used.
var animation1 = cc.CallFunc.create(function(node)
{
this.Walking(image);
isWalking = true;
this.scheduleUpdate();
}, this);
this.runAction( cc.Sequence.create(cc.DelayTime.create(4), animation1));
Walking:function()
{
var size = cc.Director.getInstance().getWinSize();
this.item = cc.TextureCache.getInstance().addImage(image);
this.walkSprite = cc.Sprite.createWithTexture(this.item, cc.rect(0, 0, 1296, 280));
this.walkSprite.setAnchorPoint(cc.p(0, 0));
this.walkSprite.setPosition( cc.p(x, y) );
this.addChild(this.walkSprite, 0);
var animFrames = [];
for(var x = 0; x < action; x+*)
{
var frame = cc.SpriteFrame.createWithTexture);
animFrames.push;
}
var animation = cc.Animation.create;
var animate = cc.Animate.create;
this.walkSprite.runAction);
},
update:function
{
var size = cc.Director.getInstance.getWinSize;
if{
var handX = this.actionSprite.getPosition.x* speed;
var handY = this.actionSprite.getPosition().y;
this.actionSprite.setPosition(cc.p(handX, handY));
}
Thank you in advance and GOD bless for your help.