binarygalwalkin / diorama.js

A small Html5 2D game engine, based on canvas.

Home Page:https://gtibo.github.io/doc_dio/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Diorama.js

References

Demos and examples on codepen

Installation

Download this repository, and de-zip it. It contain an Empty project folder with a single scene and basic assets. Launch the project by opening the index.html file in a web browser. Then you will only need to refresh your page after any change in the code to see them applied in your game.

Usage

You can use any code editor you want to edit a project. To display something on the screen diorama require at least one scene.

let demo = new Scene("demo");
demo.init = function() {
	// this function is called by default every time a scene is started
	// all the variables written here will be reserved to this scene only
	// to access methods or variables from the parent element (diorama) use "this.world"
	// example > this.world.W to get the width of the canvas
};
demo.render = function() {
	// this function is executed 60 times per secondes by default
};

don't forget to add your scenes to your game object the add.scene function links the scene with the world

let manifest = createManifest();
    manifest.add.scene(demo);
let game = new Diorama(manifest);

By default diorama starts with the first added scene, but you can specify in the manifest by which scene you want your project to start

let manifest = createManifest();
    manifest.set.start_screen("menu");
	manifest.add.scene(menu);
	manifest.add.scene(inGame);

Diorama is under the MIT license

About

A small Html5 2D game engine, based on canvas.

https://gtibo.github.io/doc_dio/

License:MIT License


Languages

Language:JavaScript 97.0%Language:CSS 1.5%Language:HTML 1.5%