Skip to content

glowcoil/machinist

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Machinist is a game engine for JavaScript. It uses features of HTML5 such as the and tags.

The following is a small example featuring movement with the arrow keys and playing a sound when the spacebar is pressed:

guy = {
  sprite: new Sprite("res/test.png"),
  sound: new Sound("res/test.ogg"),
  x: 0,
  y: 0,
  update: function() {
    if (key(keys.up)) this.y -= 4;
    if (key(keys.down)) this.y += 4;
    if (key(keys.left)) this.x -= 4;
    if (key(keys.right)) this.x += 4;
  
    if (key(keys.space)) this.sound.play();
  },
  draw: function() {
    this.sprite.draw(this.x, this.y);
  }
};

level1 = new Scene(guy);

game("canvas", level1);

Game code must be loaded from an html file.

About

A game engine for JavaScript and Canvas games.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published