API Docs for: 0.0.2
Show:

Atlantis.Camera2D Class

Module: Engine
Parent Module: Atlantis

A camera used in a 2D scene to manage scrolling

Constructor

Atlantis.Camera2D

(
  • x
  • y
  • width
  • height
)

Parameters:

  • x Number

    The position on X of the camera.

  • y Number

    The position on Y of the camera.

  • width Number

    The size of the camera.

  • height Number

    The size of the camera.

Methods

follow

(
  • sprite
)

Follow a sprite

Parameters:

  • sprite Atlantis.Sprite

    A sprite to follow.

getRelativePosition

(
  • sprite
)
Object

Gets the relative position of a sprite relative to the camera position.

Parameters:

  • sprite Atlantis.Sprite

    The sprite to use.

Returns:

Object:

Return a structure with x and y coordinates.

getSpritePosition

() Object

Gets the position of the sprite on screen relative to the camera position.

Returns:

Object:

Return a structure with x and y coordinates.

update

()

Update the camera position. If a sprite is attached to it, its position is managed by the camera.