There're a lot of programs that helps you to do that. To get around that you'll need to use a static file that serves the files through HTTP. You might have encountered errors when trying to loadSprite() from local file system, that is because browser won't allow loading local files with JavaScript. Just run $ esbuild game.js -bundle > build.jsĪnd it'll find the Kaboom package and include it in the built build.js, include build.js in your HTML and you're good to go. Once you have esbuild installed, and you have this in a. There's a lot of options like esbuild, webpack, parcel, vite, etc, here I'll give a short example of how to use Kaboom with esbuild. $ npm install kaboomīut you'll need to use a bundler to use Kaboom with NPM. With NPM it's easier have some other packages and do version control, also it's easier to get typescript autocomplete support and stuff, but it requires a bit more setup. The example above is using Kaboom with es6 module, you can also just include it with a tag Using NPM The Kaboom package is deployed to NPM, so it's availbale on various CDN providers, like unpkg, skypack, jsdelivr, etc. This will give you the standard fullscreen Kaboom canvas. add a piece of text at position (120, 80) add([ import kaboom lib import kaboom from "" Getting the package from a CDN provider is the quickest and easiest way to start using Kaboom.
0 Comments
Leave a Reply. |