Me making games using HTML5 Games: Novice to Ninja by Sitepoint.
Go to file
2020-08-11 18:07:36 +02:00
examples asdf-games is now a npm package 2020-02-29 13:45:56 +01:00
lib Fixed eslint issue 2020-08-11 18:07:09 +02:00
res Updated README and XML related classes 2020-04-19 19:44:52 +02:00
.eslintignore Added everything from chapter 4 and set up ESlint 2020-03-21 17:22:28 +01:00
.eslintrc.js Added everything from chapter 4 and set up ESlint 2020-03-21 17:22:28 +01:00
.gitignore asdf-games is now a npm package 2020-02-29 13:45:56 +01:00
.npmignore asdf-games is now a npm package 2020-02-29 13:45:56 +01:00
LICENCE asdf-games is now a npm package 2020-02-29 13:45:56 +01:00
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 Undid last two commits 2020-04-29 14:22:04 +02:00

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
});