A JS lib that helps you to build games in webpages.
Note: Another system for installing is in conception.
- Clone project
git clone https://github.com/AeliaDev/cazan.js.git - Install dependencies
yarn - Build assets
yarn run build - Launch tests server
cd tests && node server.js
- Create a html document with a canvas (with an id)
- Include a JS file
- In the JS file, import a cazan file (minified or not)
import * as cazan from "/path/to/cazan/bundled/file.js"Note: we advise to use the non-minified bundled file in development and the minified one in production.
Note: this kind of import needs a local server to work (you can use the vscode extension live server).
- Create a function that you will call in an event listener on window of type "load" that calls this function.
function runApp() {
}
window.addEventListener("load", runApp);- Setup cazan & begin to code !
function runApp() {
let game = cazan.setup("#yourCanvasId", "2d")
game.setSize(600, 350)
let rectangle = new cazan.graphics.Rectangle(game, {x: 10, y: 10}, {x: 50, y: 50})
game.update()
}There is a little demonstration of what's possible to do for the moment in ./tests/app.js!
More details in ./tests.