Fork me on GitHub
View source

package haxepunk

class Camera


extended by StaticCamera

Available since:

4.0.0

Constructor

View source

new (x : Float = 0, y : Float = 0) : Void

Variables

read only fullScaleX : Float

read only fullScaleY : Float

read only height : Float

pixelSnapping : Bool

Whether this graphic will be snapped to the nearest whole number pixel position when rendering. If this is true for either an individual Graphic or for the Camera, snapping will occur.

scale : Float

scaleX : Float

scaleY : Float

read only screenScaleX : Float

read only screenScaleY : Float

read only width : Float

x : Float

y : Float

Functions

View source

anchor (target : Position, anchorX : Float = 0.5, anchorY : Float = 0.5) : Void

Anchor the Camera to an Entity or other object with position. The Camera will keep the target in the specified part of the screen.


Available since:

4.0.0

View source

floorX (x : Float) : Float

Return an X value that, after scaling, will result in an integer.

View source

floorY (y : Float) : Float

Return a Y value that, after scaling, will result in an integer.

View source

onCamera (entity : Entity) : Bool

View source

setTo (x : Float, y : Float, px : Float = 0, py : Float = 0) : Void

Set the Camera's position. If provided, px and py determine the part of the screen to move to the given position; 0.5 will center the camera, and 1.0 will set the right edge.

View source

shake (duration : Float = 0.5, magnitude : Int = 4) : Void

Cause the screen to shake for a specified length of time.


Parameters:
duration   

Duration of shake effect, in seconds.

magnitude   

Number of pixels to shake in any direction.


Available since:

2.5.3

View source

shakeStop () : Void

Stop the screen from shaking immediately.


Available since:

2.5.3

View source

update () : Void