{
winSize = Director::getInstance()->getWinSize();
Vec2 origin = Director::getInstance()->getVisibleOrigin();
sp1=Sprite::create("HelloWorld.png");
sp1->setPosition(Vec2(winSize.width/2, winSize.height/2));
this->addChild(sp1);
sp2=Sprite::create("HelloWorld.png");
sp2->setPosition(Vec2( winSize.width/2+sp1->getContentSize().width-4, winSize.height/2));
this->addChild(sp2);
this->scheduleUpdate();
}
void HelloWorld:: update(float f)
{
sp1->setPositionX(sp1->getPositionX()-20);
sp2->setPositionX(sp2->getPositionX()-20);
if (sp1->getPositionX()+sp1->getContentSize().width/2<=0) {
sp1->setPositionX(winSize.width+sp1->getContentSize().width/2-4);
}
if (sp2->getPositionX()+sp2->getContentSize().width/2<=0) {
sp2->setPositionX(winSize.width+sp2->getContentSize().width/2-4);
}
}