PosComp
:The pos component.
group
Component Types
pos
: Vec2Object's current world position.
move
(xVel: number, yVel: number): voidMove how many pixels per second. If object is 'solid', it won't move into other 'solid' objects.
move
(vel: Vec2): voidmoveBy
(dx: number, dy: number): voidMove how many pixels, without multiplying dt, but still checking for 'solid'.
moveBy
(d: Vec2): voidmoveTo
(dest: Vec2, speed?: number): voidMove to a spot with a speed (pixels per second), teleports if speed is not given.
moveTo
(x: number, y: number, speed?: number): voidscreenPos
(newPos?: Vec2): Vec2 | nullGet / Set the position of the object on the screen.
since
v2000.0
worldPos
(newPos?: Vec2): Vec2 | nullGet / Set the position of the object relative to the root.
since
v2000.0
toScreen
(this: GameObj<PosComp | FixedComp>, p: Vec2): Vec2Transform a local point (relative to this) to a screen point (relative to the camera)
toWorld
(this: GameObj<PosComp>, p: Vec2): Vec2Transform a local point (relative to this) to a world point (relative to the root)
since
v3001.0
fromScreen
(this: GameObj<PosComp | FixedComp>, p: Vec2): Vec2Transform a screen point (relative to the camera) to a local point (relative to this)
since
v3001.0
fromWorld
(this: GameObj<PosComp>, p: Vec2): Vec2Transform a world point (relative to the root) to a local point (relative to this)
since
v3001.0
toOther
(this: GameObj<PosComp>, other: GameObj<PosComp>, p: Vec2): Vec2Transform a point relative to this to a point relative to other
since
v3001.0
fromOther
(this: GameObj<PosComp>, other: GameObj<PosComp>, p: Vec2): Vec2Transform a point relative to other to a point relative to this
since
v3001.0