Skip to content

EvitcaStudio/Kit

Repository files navigation

Kit

Kit is a lightweight, extensible 2D framework for game development in the Vylocity Game Engine. Designed to be simple and modular, Kit lets you build powerful projects through a plugin-driven architecture.

Install

npm i @evitcastudio/kit -g

global flag is so the path is set properly for the CLI tool

Resources

This script will locate all Vylocity engine-related files within the specified directory and anonymize them before placing them in the designated resources folder.

# From the CLI you will build all your resources to the out dir
kit build -i ./<in-dir> -o ./<out-dir>

During the execution of this command, a resource.json file will be automatically generated within your source directory. It is recommended to exclude this file from your version control system, as it is considered a build artifact.

Important

This API should be ran BEFORE VYLO.load() is called.

Warning

Depending on your environment the following import syntax for json may not work.

import resourceJSON from 'resource.json';
await Kit.setResources(resourceJSON);

Using Kit with plugins

import { Plugin } from 'custom-plugin';

const plugin = Kit.registerPlugin(Plugin);

Listening for plugin events

const listener = (pEvent: EmitterEvent) => {
    const { data, timestamp } = pEvent;
    // Here you can use the data that the event sent down.
}

// Here you listen for an event from the plugin: `Plugin`, under the event name of `eventName`
Kit.on('Plugin', 'eventName', listener);

// You can also stop listening for an event
Kit.off('Plugin', 'eventName', listener);

For more information check out the wiki