Skip to content

cat-125/game-engine

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

About engine

This engine is a simple web engine that provides powerful tools for you.

Performance

image Screenshot from examples/demo

Using

Basic guide

This is basic beginner guide. It will teach you how to create a scene, add objects to it and add behaviors to them.

Html

Create HTML file and import scripts you need. In this example, we will only use Mesh and StaticMesh object types.

<script src="/engine/engine.js"></script>
<script src="/objects/mesh.js"></script>

<script src="main.js"></script>

At the end is our script.

Then add canvas. It is used to render the game.

<canvas id="canvas" width="300" height="300"></canvas>

JavaScript

Let's add some JavaScript. Here's scene and some objects.

// Scene
// First argument is canvas ID that's used to render scene.
let scene = new Scene('canvas');

// Cube
let cube = new Mesh({
  // position
  x: 150,
  y: 150,
  // model
  // this is basic cube model, we just use it
  model: new Model([
    [-10, -10],
    [-10, 10],
    [10, 10],
    [10, -10]
  ]).get(),
  // cube color
  color: '#000'
});

// Add cube to scene
scene.create(cube);

If you run this code, nothing will happen. The scene needs to start.

scene.start();

Documentation

Can be found in wikis.

About

Simple game engine

Resources

License

Stars

Watchers

Forks

Packages

No packages published