1.1.3 โ€ข Published 4 years ago

@g-gine/gamegine-client v1.1.3

Weekly downloads
-
License
SEE LICENSE IN li...
Repository
github
Last release
4 years ago

Gamegine

Description โšก

Modern typescript game engine with focus on type safety and easiness of use. It provides simple and clean API with entity-management and renderign capabilities.

More info on our website.

Documentation ๐Ÿ“–

Complete documentation can be found here.

Examples ๐Ÿงช

Simple rectangle drawing

import { Gamegine, State, Entity, Drawing, Color, Point } from '@g-gine/gamegine-client';

class Player extends Entity {

   private rect = new Drawing(this.position, 60, 60);

   public onCreate(game: Gamegine) {
      this.rect.setFillColor(Color.BLUE);
      this.rect.fillRect(0, 0, 60, 60);
      game.renderer.addChild(this.rect);
   }

}

class StartState extends State {

   public onCreate() {
      const position = new Point(100, 100);
      this.entities.add(new Player(position));
   }

}

window.addEventListener('load', () => {
   const game = new Gamegine('#canvas-selector'); // Change selector to your canvas 
   game.run(new StartState(game));
});

Loading and displaying texture

import { Gamegine, Assets, State, Entity, Sprite } from '@g-gine/gamegine-client';

class GoodLookingPlayer extends Entity {

   private sprite: Sprite = new Sprite(this.position, Assets.textures.player);

   public onCreate(game: Gamegine) {
      game.renderer.addChild(this.sprite);
   }

}

class StartState extends State {

   public onCreate() {
      const position = new Point(100, 100);
      this.entities.add(new GoodLookingPlayer(position));
   }

}

window.addEventListener('load', () => {
   const opts = { 
      renderer: { 
         fullscreen: true, // sets fullscreen
         pixelated: true   // sets pixel-art graphics settings
      } 
   }
   const game = new Gamegine('#canvas-selector', opts); // Change selector to your canvas 
   const assets = {
      textures: {
         player: 'path/to/player.png'
      }
   };
   // Await assets to load
   Assets.load(assets)
      .then(() => game.run(new StartState(game)));
});

Graphics ๐ŸŽจ

Our engine implements graphics objects for basic use, such as: sprites, animation, text displays and so on. You can also easily implement your own renderables.

Entity management ๐Ÿงพ

Gamegine manages all entities for you. You simply add/remove entities to EntityManager, which will keep track of added entities and call respective methods in right time.

Traits ๐ŸŽ“

Traits are classes that can extend behaviour of entities. This allows you to set same behaviour to different entities withou using complex inheretance.

For more examples and tutorials, visit our official websites.

Bugs and improvements ๐Ÿž

When you find bug, please, contact me or place issue with complete bug report (way to reproduce bug, stack-trace of error, etc.) I would be aslo glad, if you suggest possible improvements.

1.1.3

4 years ago

1.1.1

4 years ago

1.1.0

4 years ago

1.1.2

4 years ago

1.0.2

4 years ago

1.0.1

4 years ago

1.0.0

4 years ago