Hydra

Hydra 2D Documentation

Test our demo games here in the interactive demo.

Import and setup

Add a script to Hydra.js from either CDN or self-host

After this, create an instance of hydra, supplying a HTML id to a canvas:

// Uses the element <canvas id="game-canvas">
const lib = new HydraCanvasLib('game-canvas');

// If you need a different window size:
const lib = new HydraCanvasLib('game-canvas', { // All are optional
    canvasWidth: 800,
    canvasHeight: 600,
    enableExperimentalDPR: false // Uses Device-Pixel Ratio for crispness
});

Setup all sprites and prerequisites, then start the game loop with FPS:

// Uses 60fps
lib.loop(60);

Features: