Function
rect
(w: number, h: number, opt?: RectCompOpt): RectCompAttach and render a rectangle to a Game Object.
param w- The width of the rectangle.
param h- The height of the rectangle.
param opt- Options for the rectangle component. See
const obstacle = add([
pos(80, 120),
rect(20, 40),
outline(4),
area(),
])returns The rectangle component.
group Components