Camera

Camera

Methods


camera_fade(colour, time)


Fades the screen to the colour over the given amount of time.

Check out the third party documentation for a more in depth explanation.

Parameters:
Name Type Description
colour

colour to fade the screen to

time Number

how long to take to fade

Code Equivalent:

function toHexColor(color) {
   return color.replace("#", "0x");
}
game.camera.fade(toHexColorFunc(colour), time, true);

camera_flash(colour, time)


Fills the game with the colour specified, then fades the colour away over the given amount of time.

Check out the third party documentation for a more in depth explanation.

Parameters:
Name Type Description
colour

colour to show

time Number

how long to take to fade the colour away

Code Equivalent:
game.camera.flash(toHexColorFunc(colour), time, true);

camera_focus_on(object)

Parameters:
Name Type Description
object

object to focus on

Code Equivalent:
game.camera.focusOn(object);

camera_focus_on_xy(posX, posY)

Parameters:
Name Type Description
posX Number

x position to focus on

posY Number

y position to focus on

Code Equivalent:
game.camera.focusOnXY(posX, posY);

camera_reset()


Resets the camera by making it focus back to 0,0 and unfollowing all objects. Also resets any camera effects.

Check out the third party documentation for a more in depth explanation.

Code Equivalent:
game.camera.reset();

camera_reset_fx()

Code Equivalent:
game.camera.resetFX();

camera_set_bounds_to_world()


Updates the camera bounds to match the game world bounds.

Check out the third party documentation for a more in depth explanation.

Code Equivalent:
game.camera.setBoundsToWorld();

camera_set_position(posX, posY)

Parameters:
Name Type Description
posX Number

x position for the camera

posY Number

y position for the camera

Code Equivalent:
game.camera.setPosition(posX, posY);

camera_set_size(width, height)

Parameters:
Name Type Description
width Number

the width of the camera view port

height Number

the height of the camera view port

Code Equivalent:
game.camera.setSize(width, height);

camera_shake(intensity, direction, duration)


Creates a camera shake effect by moving the camera randomly at the given intensity for the given amount of time.

Check out the third party documentation for a more in depth explanation.

Parameters:
Name Type Description
intensity Number

how much the camera should move while shaking

direction

which direction the camera should shake

duration Number

how long the camera should shake

Code Equivalent:
game.camera.shake(intensity, duration, true, Phaser.Camera.direction);

camera_unfollow()

Code Equivalent:
game.camera.unfollow();

game_camera()

Code Equivalent:
game.camera