Plugins

KAPLAY uses a flexible plugin system that helps you extend the engine’s functionality with new methods, constants, or even new components.

Let’s take a look at how the default plugin myplugin() is implemented.

// k is the KAPLAY context
function myPlugin(k) {
    return {
        hi() {
            k.debug.log("Hi from myPlugin!");
        },
    };
}

Now you can use the plugin in your game:

const k = kaplay({
    plugins: [myPlugin],
});

// call the method!
k.hi();

Also there’s exist an alternative way to use plugins:

const k = kaplay();

k.plug(myPlugin);

You can explore plugins made by the community in our Discord.

kaplay logo

Making Your First Game

Expanding KAPLAY