Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cocos2d - a way to get the current scene?

I'm looking for a way to get the current scene so that I'll be able to tell which scene is running at any time.

Thanks!

like image 550
jkigel Avatar asked Apr 22 '11 12:04

jkigel


People also ask

What programming language does Cocos2d use?

Cocos2D suits companies that decide to build games and interactive apps that are 2D, developed with the C++ programming language, JavaScript, C# and Lua, and can be played on both Android and iOS mobile technologies, as well as across all the main operating systems (Windows, Mac, Linux).

How much does Cocos2d cost?

6. What is the cost of using Cocos Creator? Cocos Creator is free to use and has no royalty fees. That means all money you make with the game stays with you and the 3rd party tools you used to make the game.

Is Cocos2d a game engine?

Cocos2d-x. Cocos2d-x is a mature open source cross-platform game development framework that supports 2D and 3D game creation. The engine provides rich functions such as graphics rendering, GUI, audio, network, physics, user input, etc., and is widely used in game development and interactive application construction.


1 Answers

Check out CCDirector. You can get the running scene like this:

[[CCDirector sharedDirector] runningScene];

From the documentation of cocos2D:

-(CCScene*) runningScene [read, assign]

The current running Scene. Director can only run one Scene at the time

Sandro Meier

like image 106
Sandro Meier Avatar answered Oct 04 '22 18:10

Sandro Meier