KaBoom! — A new world (1/4)
Kaboom Js is a very user friendly JS library that allows you to utilize sprites and quickly create fast and fun games. Utilizing components and loading assets to build levels with multiple attributes. When you’re finished loading the script & your assets the rest comes easy. In this quick blog I’ll show how I tested and used a classic mario-type Kaboomjs example.
We start off with our index.html file an add the kaboomjs script you can find over at their website. https://kaboomjs.com/
From here we jump into our game.js file and start setting up the canvas.
This will create a fullscreen canvas for which we load up our sprites & background. Next we load our sprites & declare our layers, stating which is the default and in what order the application should load them.
Here we’ve created a new directory and added our sprite files. Since this is going to be a Mario game we’ve added mario himself, spike traps, steel bricks, mushrooms, etc.
Next we have to set a function to define the layers of the game to load and the priority. You can utilize an arrow function or simple define it like this:
layers([“game”, “ui”], “game”); in this instance game is the default layer.
With everything loaded Next week we’ll show some functionality between our UI and game layers.