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 asdfconst asdf = ; // Add whatever classes you need hereconst Game Sprite Texture KeyControls = asdf; // Game(width, height, disable pixel smoothening)var game = 720 480 true; // Any picture URL used in new Texture() must be relative to the location of the HTML fileconst playerTexture = 'player.png'; var player = texture;playerpos = x: gamew / 2 - playerw / 2 y: gameh / 2 - playerh / 2 // Add your entities to the game's scenegamescene; game;