web-game-engine
TypeScript icon, indicating that this package has built-in type declarations

1.2.4 • Public • Published

web-game-engine

A 2D game engine based on the standard Web APIs.

See the examples/ folder for example projects, and go here to play them.

Get started with Vite + web-game-engine

  1. Initialize a new Vite project. Choose Vanilla and Typescript
npm create vite@latest
  1. cd into the directory
  2. Install web-game-engine
npm i web-game-engine
  1. Delete src/counter.ts and src/style.css. Replace the contents of src/main.ts with
import { ExamplePlayer, Game, TextObject } from 'web-game-engine';

const game = new Game(document.querySelector('#app'));

new ExamplePlayer(50, 50)
  .activate(game);
new TextObject(() => `FPS: ${game.currentFps.toFixed(1)}`, 8, 8)
  .activate(game);

game.play();
  1. Play the game by running in dev mode
npm run dev
  1. Build, and deploy the dist folder
npm run build

Readme

Keywords

Package Sidebar

Install

npm i web-game-engine

Weekly Downloads

3

Version

1.2.4

License

ISC

Unpacked Size

36.1 kB

Total Files

32

Last publish

Collaborators

  • magnetenstad