pos(x: number , y: number ): PosComp

Set the position of a Game Object, relative to its parent.

paramx- The x position to set.

paramy- The y position to set.

// This game object will draw a "bean" sprite at (100, 200)
let bean = add([
    pos(100, 200),
    sprite("bean"),
]);

// This game object will draw a rectangle at (105, 205) world coordinate.
// The position will be 5 pixels to the right and 5 pixels down from the parent bean.
let rect = bean.add([
    pos(5, 5),
    rect(100, 100),
]);

returnsThe position comp.

sincev2000.0

groupComponents

subgroupTransform

pos(xy: number ): PosComp

pos(p: Vec2 ): PosComp

pos(): PosComp