Plugins

KAPLAY uses a flexible plugin system that helps you extend the library’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, what kaplay() returns
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],
});

k.hi(); // from myPlugin

Creating a plugin

We recommend using our templates:

Both are minimal and simple templates for create and publish plugins on NPM.

Browse Plugins

Community Plugins

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

kaplay logo

Making Your First Game

Expanding KAPLAY