query(opt: QueryOpt): GameObj[]

Get a list of game objects in an advanced way.

paramopt- The query options.

const bean = k.add(["friend", "bean"]);
const bean2 = k.add(["friend", "bean"]);
const bag = k.add(["friend", "bag"]);

// get bean
query({
    include: "bean",
}) // will return [bean, bean2];

// get all friends excluding bean
query({
    include: "friend",
    exclude: "bean",
}); // will return [bag]

kaplay logo

Misc

Layer