Skip to main content

Getting Started

Create a Game

Create a game:

import { Game } from 'r-row';

const game = new Game();

Create Canvas

You can use default canvas options:

game.createCanvas();

Or create a Canvas settings object from CanvasOption interface:

import { CanvasOptions } from 'r-row';

const options: CanvasOptions = {
// your settings here
};

and pass it to the createCanvas method:

game.createCanvas(options);

Set scene to start with the game (facultative)

If you want use the Scenes system provided by R-Row, you can use this method before starting the game:

game.startScene(new MySceneClass());

A new instance of MySceneClass will be start automatically when the game start.


Start the game

game.start();

Resume

import { CanvasOption, Game } from 'r-row';
import { MyScene } from './scenes/MyScene';

const option: CanvasOptions = {
imageSmoothingEnabled: false;
}

const game = new Game()
.createCanvas(options)
.startScene(new MyScene())
.start();