new World(game)
"This world is but a canvas to our imagination." - Henry David Thoreau
<p> A game has only one world. The world is an abstract place in which all game objects live. It is not bound by stage limits and can be any size. You look into the world via cameras. All game objects live within the world at world-based coordinates. By default a world is created the same size as your Stage.
Parameters:
| Name | Type | Description |
|---|---|---|
game |
Phaser.Game | Reference to the current game instance. |
- Source:
Members
-
bounds
-
- Source:
Properties:
Name Type Description boundsPhaser.Rectangle Bound of this world that objects can not escape from.
-
camera
-
- Source:
Properties:
Name Type Description cameraPhaser.Camera Camera instance.
-
<readonly> centerX
-
- Source:
Properties:
Name Type Description centerXnumber Gets the X position corresponding to the center point of the world.
-
<readonly> centerY
-
- Source:
Properties:
Name Type Description centerYnumber Gets the Y position corresponding to the center point of the world.
-
currentRenderOrderID
-
- Source:
Properties:
Name Type Description currentRenderOrderIDnumber Reset each frame, keeps a count of the total number of objects updated.
-
game
-
- Source:
Properties:
Name Type Description gamePhaser.Game A reference to the currently running Game.
-
group
-
- Source:
Properties:
Name Type Description groupPhaser.Group Object container stores every object created with
create*methods. -
height
-
- Source:
Properties:
Name Type Description heightnumber Gets or sets the current height of the game world.
-
<readonly> randomX
-
- Source:
Properties:
Name Type Description randomXnumber Gets a random integer which is lesser than or equal to the current width of the game world.
-
<readonly> randomY
-
- Source:
Properties:
Name Type Description randomYnumber Gets a random integer which is lesser than or equal to the current height of the game world.
-
width
-
- Source:
Properties:
Name Type Description widthnumber Gets or sets the current width of the game world.
Methods
-
<protected> boot()
-
Initialises the game world.
- Source:
-
destroy()
-
Destroyer of worlds.
- Source:
-
postUpdate()
-
This is called automatically every frame, and is where main logic happens.
- Source:
-
setSize(width, height)
-
Updates the size of this world.
Parameters:
Name Type Description widthnumber New width of the world.
heightnumber New height of the world.
- Source:
-
update()
-
This is called automatically every frame, and is where main logic happens.
- Source: