First, you need to learn to create sprites:
1 Auto mySprite = sprite::create ("mysprite.png"); 2 Auto mySprite = sprite::create ("mysprite.png", Rect (0,0, (a));
Then change their properties ( seven basic attributes ):
① Anchor Point (important)
1Mysprite->setanchorpoint (0.5,0.5);//All wizard default anchor points2Mysprite->setanchorpoint (0,0);//Lower left corner3Mysprite->setanchorpoint (0,1);//Upper left corner4Mysprite->setanchorpoint (1,0);//Lower right corner5Mysprite->setanchorpoint (1,1);//Upper Right Corner
② position (Position)
// let elf to coordinates (100,200)mysprite->setposition (Vec2);
③ Angle (Rotation)
Clockwise is +, counterclockwise is-
1 mysprite->setrotation (20.0f// 20 degrees clockwise 2 mysprite-> Setrotation (-20.0f); // rotate counterclockwise 20 degrees 3 mysprite->setrotation (60.0f// 60 degrees clockwise 4 mysprite-> Setrotation (-60.0f); // rotate counterclockwise 60 degrees
④ Scaling (Scale)
1 mysprite->setscale (2.0); // twice times the percentage increase 2 Mysprite->setscalex (2.0); // X-axis increased by twice times 3 Mysprite->setscaley (2.0); // twice x increase in Y axis
⑤ Tilt (Skew)
1 // x-axis tilt 20 degrees 2 mysprite->setskewx (20.0f); 3 // Y-axis tilt 20 degrees 4 mysprite->setskewy (20.0f);
Sprite properties not affected by anchors: color, transparency ⑥ color
1 // set the color to go through the Color3b object 2 Mysprite->setcolor (color3b (255255255)); 3 // can also be set using the default color of the Color3b object 4 Mysprite->setcolor (color3b::white);
⑦ Transparency
// changes the sprite's transparency by a specific value. The value range is (2~255), the default value is 255 (opaque)mysprite->seropacity (();
Reference: http://cn.cocos2d-x.org/tutorial/show?id=1989
Create a wizard (basic summary) "7 Properties"