v3001 to v4000 Migration

Removed: make()

make() is an internal function that KAPLAY uses for creating the GameObjRaw interface without adding it to the tree. If you was using it, it was for one of these 2 reasons:

  1. If you were using it for prefab-like factory functions, like this:
// BEFORE
const makeEnemy = (x = 100, y = 100) => {
    const obj = make([
        sprite("alien"),
        pos(x, y),
    ]);

    return obj;
};

const car1 = add(makeEnemy()); // (100, 100)
const car2 = add(makeEnemy(400, 200)); // (400, 200)
// NOW
const enemy = add([sprite("alien")]);
const enemyPrefab = createPrefab("enemy", enemy);

const enemy1 = addPrefab("enemy"); // (100, 100)
const enemy2 = addPrefab("enemy", [pos(400, 200)]); // (400, 200)

Check the Prefab guide for more information.

  1. If you were using it for “modifying” the object before its “creation”, like this:
// BEFORE
const obj = make([sprite("bean")]);

obj.sprite = "mark";

add(obj);

TODO: Do the now

Renamed: onShow, onHidden, onResize

TODO

kaplay logo