Skip to content

Commit 7943393

Browse files
committed
Update 3.md
- improving description. - fixing typo.
1 parent 322ea4f commit 7943393

File tree

1 file changed

+18
-19
lines changed

1 file changed

+18
-19
lines changed

3.md

+18-19
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ properties, including `rotation`, `position`, `scale`, `color`, etc.
66

77
## Creating Sprites
88
There are different ways to create Sprites depending upon what you need to
9-
accomplish. You can create a `Sprite` from a number of graphic formats including:
9+
accomplish. You can create a `Sprite` from an image with various of graphic formats including:
1010
PNG, JPEG, TIFF, and others. Let's go through some create methods and talk about
1111
each one.
1212

@@ -18,13 +18,13 @@ auto mySprite = Sprite::create("mysprite.png");
1818

1919
![](3/i1.png "")
2020

21-
This creates a `Sprite` using the 'mysprite.png' image. The result is that the
21+
The statement above creates a `Sprite` using the 'mysprite.png' image. The result is that the
2222
created `Sprite` uses the whole image. `Sprite` has the same dimensions
2323
of `mysprite.png`. If the image file is 200 x 200 the resulting `Sprite` is 200 x 200.
2424

2525
### Creating a Sprite with a Rect
2626

27-
In the previous example, the created `Sprite` has the same size as the original PNG.
27+
In the previous example, the created `Sprite` has the same size as the original image file.
2828
If you want to create a `Sprite` with only a certain portion of the image file,
2929
you can do it by specifying a `Rect`.
3030

@@ -37,13 +37,12 @@ auto mySprite = Sprite::create("mysprite.png", Rect(0,0,40,40));
3737
![](3/i4.png "")
3838

3939
`Rect` starts at the top left corner. This is the opposite of what you might be
40-
used to when laying out screen position as this starts in the lower left corner.
41-
Thus the resulting `Sprite` is only a portion of the PNG. In this case the `Sprite`
40+
used to when laying out screen position as it starts from the lower left corner.
41+
Thus the resulting `Sprite` is only a portion of the image file. In this case the `Sprite`dimension
4242
is 40 x 40 starting at the top left corner.
4343

44-
If you dont specify a `Rect` cocos2d-x does this automatically for the full width
45-
and height of the image file you specify. To cement another example, if we use a
46-
PNG that is 200 x 200 the following 2 statements would have the same result.
44+
If you don't specify a `Rect`, cocos2d-x will automatically using the full width and height of the image file you specify. Take a look at example below, if we use an
45+
image with dimension 200 x 200 the following 2 statements would have the same result.
4746
```cpp
4847
auto mySprite = Sprite::create("mysprite.png");
4948

@@ -87,7 +86,7 @@ Load your _sprite sheet_ into the `SpriteFrameCache`, probably in `AppDelegate`:
8786
// load the Sprite Sheet
8887
auto spritecache = SpriteFrameCache::getInstance();
8988

90-
// the .pist file can be generated with any of the tools mentioned below
89+
// the .plist file can be generated with any of the tools mentioned below
9190
spritecache->addSpriteFramesWithFile("sprites.plist");
9291
```
9392
Now that we have a _sprite sheet_ loaded into `SpriteFrameCache` we can create `Sprite`
@@ -115,7 +114,7 @@ auto newSprite = Sprite::createWithSpriteFrame(newspriteFrame);
115114
![](3/i3.png "")
116115
117116
### Tools for creating Sprite Sheets
118-
A _sprite sheet_ is a a manual, tedious process if doing so by hand. Fortunately
117+
Creating _sprite sheet_ manually is a tedious process. Fortunately
119118
there are tools that can generate them automatically. These tools also can provide
120119
many more adjustments you can make to optimize your _sprite sheet_ even further.
121120
Here are a few tools:
@@ -135,12 +134,12 @@ auto mySprite = Sprite::create("mysprite.png");
135134
![](3/i1.png "")
136135

137136
### Anchor Point and Position
138-
_Anchor Point_ is a point that you set as a way of specifying what part of
139-
the `Sprite` will be used when setting the position of it. _Anchor Point_ effects
137+
_Anchor Point_ is a point that you set as a way to specifying what part of
138+
the `Sprite` will be used when setting the position of it. _Anchor Point_ affects
140139
only properties that can be transformed. This includes _scale_, _rotation_, _skew_.
141140
This excludes _color_ and _opacity_. _Anchor Point_ uses a bottom left coordinate
142141
system. This means that when specifying X and Y coordinate values you need to make
143-
sure to start at the bottom lefthand corner to do your calculations. By default
142+
sure to start at the bottom left hand corner to do your calculations. By default
144143
the _anchor point_ of all `Node` objects is (0.5, 0.5).
145144

146145
Setting _anchor point_ is easy:
@@ -155,7 +154,7 @@ mySprite->setAnchorPoint(0, 0);
155154
mySprite->setAnchorPoint(0, 1);
156155

157156
// bottom right
158-
mySprite->setAnchorPoint(1,0);
157+
mySprite->setAnchorPoint(1, 0);
159158

160159
// top right
161160
mySprite->setAnchorPoint(1, 1);
@@ -169,17 +168,17 @@ _Anchor Point_ effects only properties that can be transformed. This includes
169168
_scale_, _rotation_, _skew_.
170169
171170
#### Position
172-
A _sprites_ position is effected by _achnor point_ as it is this point that is
171+
A _sprites_ position is affected by _anchor point_ as it is this point that is
173172
used as a starting point for positioning. Let's visually look at how this happens.
174173
Notice the colored line and where the _sprites_ position is in relation to it.
175-
Notice as we change the _anchor point_ values the _sprites_ postion changes.
176-
It is important to note that all it took was changing the _anchor point_. We did
174+
Notice as we change the _anchor point_ values, the _sprites_ position changes.
175+
It is important to note that all it took was changing the _anchor point_ value. We did
177176
not use a `setPosition()` statement to achieve this:
178177
179178
![](3/i9.png "")
180179
181180
There are more ways to set position than just _anchor point_. `Sprite` objects
182-
can also be set using specific `setPosition()` statements.
181+
can also be set using specific `setPosition()` statement.
183182
```cpp
184183
// position a sprite to a specific position of x = 100, y = 200.
185184
mySprite->setPosition(Vec2(100, 200);
@@ -232,7 +231,7 @@ mySprite->setSkewY(20.0f);
232231
```
233232
![](3/i7.png "")
234233
235-
### Sprite properties not effected by anchor point
234+
### Sprite properties not affected by anchor point
236235
There are a few properties of `Sprite` objects that are not affected by
237236
_anchor point_. Why? Because they only change superficial qualities like *color*
238237
and *opacity*.

0 commit comments

Comments
 (0)