0

im trying to make it so that everytime a certain spot is clicked it adds the block there (still new to kaboom), but this does absoutely jack

function block(xyz) {add([
        rect(48, 64),
        area(),
        outline(4),
        pos(width(), height() - 48),
        origin(xyz),
        color(255, 180, 255),
        "tree", 
    ]);
};
on mouse click
onClick(() => {
    block(mousePos())
});
YetNT
  • 19
  • 6

1 Answers1

0

If you still need it:

import kaboom from "kaboom";

kaboom();

function block(xyz) {
  add([
    rect(48, 64),
    area(),
    outline(4),
    pos(xyz),
    color(255, 180, 255),
    "tree", 
  ]);
};

onClick(() => {
  block(mousePos())
});

So basically you want to have the pos() as xyz(pos means position), and not the origin.