Scene (Scene) is the direct expression of the game elements, the game is built from a number of different scenes. The game inside the level switch, the map switch is actually the game scene switch. And all of these processes are controlled by the Director .
Open in Project AppDelegate.cpp file.
650) this.width=650; "style=" Border-bottom:medium none;border-left:medium none;border-top:medium none;border-right: Medium none; "Title=" Click to view the original "border=" 0 "alt=" study Note 5: Figure 1.png "src=" http://www.byjth.com/content/uploadfile/201508/ 8e451440646226.png "width=" 507 "height=" 369 "/>
#include  
auto scene = helloworld
director->runwithscene (scene); //Initialize the game into the first scene call it
The entrance to the game scene is realized through 2 lines of code.
The first is to call Helloworld::createscene () to create the scene, and then run the created scene.
Opening the CCScene.h file in the D:\cocos2d-x-3.4\cocos\2d directory, we can see that the scene is a subclass of Node, just as an abstract concept.
functions for creating scenes: Static Scene * Create () //Creates a new scene object.
650) this.width=650; "style=" Border-bottom:medium none;border-left:medium none;border-top:medium none;border-right: Medium none; "Title=" Click to view the original "border=" 0 "alt=" study Note 5: Figure 2.png "src=" http://www.byjth.com/content/uploadfile/201508/ 69d51440646365.png "width=" 567 "height=" 327 "/>
In addition to the common methods of Director control scenarios, please refer to:
COCOS2DX Study Note 4: Directors (director) http://www.byjth.com/biji/23.html
usually we create a subclass of a scene and load the game resources into the subclasses, adding layers to the scene (Layer) , start music playback, and so on.
This article by closed eyes on the dark finishing editing, reprint please specify: http://www.byjth.com/biji/24.html | Close your eyes on the Dark column _ Original blog
This article from "Close your eyes on the Dark" blog, reprint please contact the author!
COCOS2DX Study Note 5: Scenes (Scene)