Cocos Creator API

0.7.1

Cocos Creator is a highly customizable game development tool that utilizes the power of cocos2d-x.

game

Module: cc

An object to boot the game.

Properties

frame Object

The outer frame of the game canvas, parent of cc.container.

container Object

The container of game canvas, equals to cc.container.

canvas Object

The canvas of the game, equals to cc._canvas.

config Object

Config of game

There are no properties that match your current filter settings. You can change your filter settings in the index section on this page. index

Methods

onStart ( )

Callback when the scripts of engine have been load.

onStop ( )

Callback when game exits.

setFrameRate
(
  • frameRate
)

Set frameRate of game.

name type description
frameRate Unknown

step ( )

Run the game frame by frame.

pause ( )

Pause the game.

resume ( )

Resume the game from pause.

isPaused ( ) Boolean

Check whether the game is paused.

returns:

type: Boolean

restart ( )

Restart game.

prepare
(
  • cb
)

Prepare game.

name type description
cb Unknown

run
(
  • [config ]
  • [onStart ]
)

Run game with configuration object and onStart function.

name type description
config optional Object | Function

Pass configuration object or onStart function

onStart optional Function

function to be executed after game initialized

addPersistRootNode
(
  • node
)

Add a persistent root node to the game, the persistent node won't be destroyed during scene transition

name type description
node Node

The node to be made persistent

removePersistRootNode
(
  • node
)

Remove a persistent root node

name type description
node Node

The node to be removed from persistent node list

isPersistRootNode
(
  • node
)
Boolean

Check whether the node is a persistent root node

name type description
node Node

The node to be checked

returns:

type: Boolean

There are no methods that match your current filter settings. You can change your filter settings in the index section on this page. index