Me making games using HTML5 Games: Novice to Ninja by Sitepoint.
Go to file
Arne van Iterson 9f43f63ddf 1.1.6 2020-08-11 18:07:36 +02:00
examples
lib Fixed eslint issue 2020-08-11 18:07:09 +02:00
res
.eslintignore
.eslintrc.js
.gitignore
.npmignore
LICENCE
README.md
package-lock.json 1.1.6 2020-08-11 18:07:36 +02:00
package.json 1.1.6 2020-08-11 18:07:36 +02:00

README.md

asdf-games

asdf-games

My attempt at making the framework featured in the book HTML5 Games: Novice to Ninja. You can find the book here.

I turned the framework featured in the book into an npm package for use with browserify or Electron. If you are on Github or Gitea now, you can find the npm package here.

Installation

To use asdf framework in your projects, you need to:

  • Install npm on your device (if you don't have it already)
  • Run npm install asdf-games
  • Use the snippet below to start off or check out one of the examples, keep in mind that the examples are not comepletely up to date.
  • Thanks to my friend Job, this project supports TypeScript typings. Make sure your editor supports them to make your life easier.

Example usage

// Require asdf
const asdf = require("asdf-games");

// Add whatever classes you need here
const [ Game, Sprite, Texture, KeyControls ] = asdf; 

// Game(width, height, disable pixel smoothening)
var game = new Game(720, 480, true);

// Any picture URL used in new Texture() must be relative to the location of the HTML file
const playerTexture = new Texture('player.png');

var player = new Sprite(texture);
player.pos = {
    x: (game.w / 2) - (player.w / 2),
    y: (game.h / 2) - (player.h / 2)
}

// Add your entities to the game's scene
game.scene.add(player);

game.run(() => {
    // Game loop
});