vec2(x: number, y: number): Vec2

Create a 2D vector.

// { x: 0, y: 0 }
vec2()

// { x: 10, y: 10 }
vec2(10)

// { x: 100, y: 80 }
vec2(100, 80)

// move to 150 degrees direction with by length 10
player.pos = pos.add(Vec2.fromAngle(150).scale(10))

returnsThe vector.

sincev2000.0

vec2(xy: number): Vec2

kaplay logo

Misc

Layer