Constructor
new Camera(game)
The camera presents the game to the player. It is managed automatically by Carrot.Game.
Parameters:
Name | Type | Description |
---|---|---|
game |
Carrot.Game | The core game object. |
Methods
follow(target)
Let the camera follow a sprite.
Parameters:
Name | Type | Description |
---|---|---|
target |
Carrot.Sprite | The sprite the camera shall follow. |
setBoundsToGame()
Sets the size (bounds) of the camera to the size of the game container.
setBoundsToWorld()
Sets the size (bounds) of the camera to size of the game world.
unfollow()
Let the camera stop following any entity.