PosComp:

The pos component.

groupComponent Types

pos: Vec2

Object's current world position.

move(xVel: number , yVel: number ): void

Move how many pixels per second. If object is 'solid', it won't move into other 'solid' objects.

move(vel: Vec2 ): void

moveBy(dx: number , dy: number ): void

Move how many pixels, without multiplying dt, but still checking for 'solid'.

moveBy(d: Vec2 ): void

moveTo(dest: Vec2 , speed?: number ): void

Move to a spot with a speed (pixels per second), teleports if speed is not given.

moveTo(x: number , y: number , speed?: number ): void

screenPos(newPos?: Vec2 ): Vec2 | null

Get / Set the position of the object on the screen.

sincev2000.0

worldPos(newPos?: Vec2 ): Vec2 | null

Get / Set the position of the object relative to the root.

sincev2000.0

toScreen(this: GameObj , p: Vec2 ): Vec2

Transform a local point (relative to this) to a screen point (relative to the camera)

toWorld(this: GameObj , p: Vec2 ): Vec2

Transform a local point (relative to this) to a world point (relative to the root)

sincev3001.0

fromScreen(this: GameObj , p: Vec2 ): Vec2

Transform a screen point (relative to the camera) to a local point (relative to this)

sincev3001.0

fromWorld(this: GameObj , p: Vec2 ): Vec2

Transform a world point (relative to the root) to a local point (relative to this)

sincev3001.0

toOther(this: GameObj , other: GameObj , p: Vec2 ): Vec2

Transform a point relative to this to a point relative to other

sincev3001.0

fromOther(this: GameObj , other: GameObj , p: Vec2 ): Vec2

Transform a point relative to other to a point relative to this

sincev3001.0