How to create a sprite and move it???

Hello everyone, i just start learning Cocos2dx in Windows. I use Visual Studio and Cocos2d-x-2.2.2. I understood HelloWorld example and i can change the spite, change the text… But now i want to create my own example, just add a sprite and move it or using some easy action… I searched a lot of keywords about Cocos2dx C++ but i don’t find anythings, most of them are written for iOs platform and i can’t use it. So please help me to write my own example.

P/s: Sorry for my English, i don’t use it frequently.

http://www.cocos2d-x.org/wiki/Step_by_Step_Cocos2dxSimpleGame_Series

more easy is difficult :wink:

In HelloWorld.cpp, the very essentials:

  • create the sprite
CCSprite *mySprite = CCSprite::create("spriteName.png");
  • add the sprite to the scene
addChild(mySprite);
  • run the action
mySprite->runAction(CCMoveBy::create(ccp(1000, 1000)));

And the link ‘fabrice’ provided as well, to go into more details :slight_smile:

Have fun!

fabrice wrote:

http://www.cocos2d-x.org/wiki/Step_by_Step_Cocos2dxSimpleGame_Series

more easy is difficult :wink:
Thank u, i did 3 steps but i had some difficulty with declare some functions in the .h files. However, i read it carefully and i done it. Thank u again :slight_smile:

davidejones88 wrote:

In HelloWorld.cpp, the very essentials:

  • create the sprite
CCSprite *mySprite = CCSprite::create("spriteName.png");
  • add the sprite to the scene
addChild(mySprite);
  • run the action
mySprite->runAction(CCMoveBy::create(ccp(1000, 1000)));

And the link ‘fabrice’ provided as well, to go into more details :slight_smile:

Have fun!

I think your instruction so easy to understand :). Thank u!