0.20.0 • Published 10 months ago

fisk-engine v0.20.0

Weekly downloads
-
License
MIT
Repository
-
Last release
10 months ago

Fisk-Engine

Fisk-Engine is a Typescript based HTML5 game engine designed to work in all modern browsers that support the Canvas API.

Install

npm install fisk-engine --save-dev

Usage

For a full example of the usage see the example folder for a fully working browser game that uses the keyboard arrows keys as inputs.

import {FiskGame, GameStage} from "fisk-engine";

const myStage = new GameStage({entities: [...]});

const myGame = new FiskGame({
    width: 1280,
    height: 720,
    selector: '...',
    initialStage: myStage
});

Interfaces

GameEntity

Basic entity that must be implemented for other game entities and systems to interact with it.

interface GameEntity {
	x: number;
	y: number;
	width: number;
	height: number;
	hitbox?: {
		x: number,
		y: number,
		width: number,
		height: number
	}
}

Logical

Extends GameEntity, must be implemented and have logical boolean set to true to be passed into logic loop in engine.

interface Logical extends GameEntity {
	logical: boolean;
	logic: (game: FiskGame) => void;
}

Renderable

Extends GameEntity, must be implemented and have renderable boolean set to true to be passed into render loop in engine.

interface Renderable extends GameEntity {
    renderable: boolean;
	render: (ctx: CanvasRenderingContext2D) => void;
}

Collidable

Extends GameEntity, must be implemented and have collidable boolean set to true to be passed into collisionQueue for give GameStage.

interface Collidable extends GameEntity {
	collidable: boolean;
	collisionResponse?: (response: any) => void;
}

Interactable

Extends GameEntity, must be implemented and have interactive boolean set to true to have event methods called for given events. Available events: onClick, onTouch, keyDown and keyUp.

interface Interactable extends GameEntity {
	interactive: boolean;
	onClick?: (event: MouseEvent, game: FiskGame) => void;
	onTouch?: (event: TouchEvent, game: FiskGame) => void;
	onKeydown?: (event: KeyboardEvent, game: FiskGame) => void;
	onKeyup?: (event: KeyboardEvent, game: FiskGame) => void;
}
0.20.0

10 months ago

0.19.1

1 year ago

0.19.0

1 year ago

0.18.1

1 year ago

0.18.0

1 year ago

0.17.1

1 year ago

0.17.0

2 years ago

0.16.0

3 years ago

0.15.4

3 years ago

0.15.3

3 years ago

0.15.2

3 years ago

0.15.1

4 years ago

0.15.0

4 years ago

0.14.0

4 years ago

0.13.0

4 years ago

0.12.0

4 years ago

0.12.1

4 years ago

0.12.2

4 years ago

0.11.0

4 years ago

0.10.0

4 years ago

0.9.0

4 years ago

0.8.0

4 years ago

0.7.2

4 years ago

0.7.1

4 years ago

0.7.0

4 years ago

0.6.0

4 years ago

0.5.0

4 years ago

0.4.1

4 years ago

0.3.0

4 years ago

0.2.0

4 years ago

0.1.1

4 years ago

0.1.0

4 years ago