Skip to content

Instantly share code, notes, and snippets.

@indatawetrust
Last active May 19, 2016 11:10
Show Gist options
  • Save indatawetrust/6b06e229848275c158a57b5e9eb385ed to your computer and use it in GitHub Desktop.
Save indatawetrust/6b06e229848275c158a57b5e9eb385ed to your computer and use it in GitHub Desktop.
cocos2d-x vector array
Vector <Sprite *> spriteArray;
for(int i=0;i<5;i++)
{
auto sprite = Sprite::create("ball.png");
spriteArray.pusbBack();
}
int k = 1;
for(auto str: spriteArray)
{
str->setPosition(Vec2(k * 50,50)); k++;
this->addChild(str,1);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment