Skip to content

Commit

Permalink
update doc
Browse files Browse the repository at this point in the history
  • Loading branch information
lihex committed Aug 20, 2012
1 parent 451ba17 commit bb842a0
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 8 deletions.
4 changes: 2 additions & 2 deletions doc/concepts.html
Expand Up @@ -7,13 +7,13 @@ <h1>Cocos2d Basic Concepts</h1>
<p>A regular hierarchy chart may look like this:</p>
<p><img alt="Alt text" src="./images/concepts.png" /></p>
<h2>Scenes</h2>
<p>A scene (implemented with the CCScene object) is more or less an independent piece of the app workflow. Some people may call them ¡°screens¡± or ¡°stages¡±. Your app can have many scenes, but only one of them is active at a given time.</p>
<p>A scene (implemented with the CCScene object) is more or less an independent piece of the app workflow. Some people may call them "screens" or "stages". Your app can have many scenes, but only one of them is active at a given time.</p>
<p>A cocos2d CCScene is composed of one or more layers (implemented with the CCLayer object), all of them piled up. Layers give the scene an appearance and behavior; the normal use case is to just make instances of Scene with the layers that you want.</p>
<p>There is also a family of CCScene classes called transitions (implemented with the CCTransitionScene object) which allow you to make transitions between two scenes (fade out/in, slide from a side, etc).</p>
<p>Since scenes are subclasses of <a href="http://www.cocos2d-x.org/reference/native-cpp/d0/ded/classcocos2d_1_1_c_c_node.html">CCNode</a>, they can be transformed manually or by using actions. See <a href="http://www.cocos2d-iphone.org/wiki/doku.php/prog_guide:actions">Actions</a> for more detail about actions.</p>
<h2>Director</h2>
<p>The CCDirector is the component which takes care of going back and forth between scenes.</p>
<p>The CCDirector is a shared (singleton) object. It knows which scene is currently active, and it handles a stack of scenes to allow things like ¡°scene calls¡± (pausing a Scene and putting it on hold while another enters, and then returning to the original). The CCDirector is the one who will actually change the CCScene, after a CCLayer has asked for push, replacement or end of the current scene.</p>
<p>The CCDirector is a shared (singleton) object. It knows which scene is currently active, and it handles a stack of scenes to allow things like "scene calls" (pausing a Scene and putting it on hold while another enters, and then returning to the original). The CCDirector is the one who will actually change the CCScene, after a CCLayer has asked for push, replacement or end of the current scene.</p>
<h2>Layers</h2>
<p>A CCLayer has a size of the whole drawable area, and knows how to draw itself. It can be semi transparent (having holes and/or partial transparency in some/all places), allowing to see other layers behind it. Layers are the ones defining appearance and behavior, so most of your programming time will be spent coding CCLayer subclasses that do what you need.</p>
<p><img alt="Alt text" src="./images/layers.png" /></p>
Expand Down
4 changes: 2 additions & 2 deletions doc/how_to_add_a_sprite.html
Expand Up @@ -4,7 +4,7 @@ <h1>How to Add a sprite</h1>
<hr />
<p>The source code of these tutorials is here: <a href="https://github.com/lihex/Cocos2dxSimpleGame">https://github.com/lihex/Cocos2dxSimpleGame</a>. You can follow the articles to finish the game by yourself step by step, or download the finally source, simply build and run it.</p>
<h2>1.Add image resources</h2>
<p>Here¡¯re three images made by Ray Wenderlich ¡¯s wife , which would be used in SimpleGame. </p>
<p>Here're three images made by Ray Wenderlich's wife , which would be used in SimpleGame. </p>
<p><img alt="Alt text" src="./images/Player.png" />
<img alt="Alt text" src="./images/Target.png" />
<img alt="Alt text" src="./images/Projectile.png" /></p>
Expand Down Expand Up @@ -43,7 +43,7 @@ <h2>2.Add a sprite</h2>
return bRet;
}
</code></pre>
<p>Well, we can build and run the code. Now the ninja is dressed in black, hidden in the black background with red eyes. For the gameplay, we had to change the background to white. It¡¯s so easy, modify HelloWorld to inherit from CCLayerColor instead of CCLayer.</p>
<p>Well, we can build and run the code. Now the ninja is dressed in black, hidden in the black background with red eyes. For the gameplay, we had to change the background to white. [[It's]] so easy, modify HelloWorld to inherit from CCLayerColor instead of CCLayer.</p>
<p>At first, modify the declaration in HelloWorldScene.h</p>
<pre><code> // cpp with cocos2d-x
class HelloWorld : public cocos2d::CCLayerColor
Expand Down
2 changes: 1 addition & 1 deletion doc/how_to_detect_the_Collisions.html
Expand Up @@ -4,7 +4,7 @@ <h1>How to Detect the Collisions</h1>
<hr />
<p>Our hero could fire bullets now, but the bullets are only visually there, how could they kill the enemies?</p>
<p>In this chapter, we will introduce Collision Detection to implement it.</p>
<p>Firstly, it¡¯s necessary to track the enemies and the bullets.</p>
<p>Firstly, it's necessary to track the enemies and the bullets.</p>
<p>In the game, we add a tag for these two kinds of sprites to identify them. tag = 1 stands for a enemy, and tag = 2 means a bullet. Because there is already a member named m_nTag of CCNode, and the methods setTag() and getTag() also exist, CCSprite has inherited them, which we could utilize.</p>
<p>Add the two member variabls below to HelloWorld in HelloWorldScene.h, these two member variables are used to store the existing enemies and bullets.</p>
<pre><code> // cpp with cocos2d-x
Expand Down
4 changes: 2 additions & 2 deletions doc/how_to_play_music_and_sund_effect.html
Expand Up @@ -3,8 +3,8 @@
<h1>How to play music and sund effect</h1>
<hr />
<p>In this chapter, we would add background music to the game and play sound effect when the hero fires bullets.</p>
<p>Because there¡¯s so few codes to add that we could say a little more about audio engine here. Cocos2d-x has wrapped SimpleAudioEngine to cross platforms. In our game, we are able to play music and sound effect using only one line of codes. It is so convenient. Of course, audio formats supported in different platform are different, about this issue, you could refer to <a href="http://www.cocos2d-x.org/projects/cocos2d-x/wiki/Audio_formats_supported_by_CocosDenshion_on_different_platforms">Audio_formats_supported_by_CocosDenshion_on_different_platforms</a>.</p>
<p>Now let¡¯s get right to the issues.
<p>Because there is so few codes to add that we could say a little more about audio engine here. Cocos2d-x has wrapped SimpleAudioEngine to cross platforms. In our game, we are able to play music and sound effect using only one line of codes. It is so convenient. Of course, audio formats supported in different platform are different, about this issue, you could refer to <a href="http://www.cocos2d-x.org/projects/cocos2d-x/wiki/Audio_formats_supported_by_CocosDenshion_on_different_platforms">Audio_formats_supported_by_CocosDenshion_on_different_platforms</a>.</p>
<p>Now let's get right to the issues.
First, copy the sound files background-music-aac.wav and pew-pew-lei.wav to the Resource directory. We use wav here because wav is supported in all platforms and these two files have been included in the Cocos2dSimpleGame project, you could download them from the bottom of this page.
Then include <strong>SimpleaudioEngine.h</strong> in HelloWorldScene.cpp.</p>
<pre><code> // cpp with cocos2d-x
Expand Down
2 changes: 1 addition & 1 deletion doc/index.html
Expand Up @@ -19,5 +19,5 @@ <h2>Create A Simple Game Step By Step</h2>
<li>Chapter 5 - <a href="./how_to_detect_the_Collisions.html">How to Detect the Collisions</a></li>
<li>Chapter 6 - <a href="./how_to_play_music_and_sund_effect.html">How to Play Music and Sound Effect</a></li>
</ul>
<p>created by cocos2d-x.org 2012-07-24 <br />
<p>created by cocos2d-x.org 2012-07-26 <br />
</p>

0 comments on commit bb842a0

Please sign in to comment.