02 Add Method - JcerelusDev/CanvasGameJs GitHub Wiki
How to use the add Method
First you initialize the game object.
The (add) Method can add any html element that was created using the document.createElement method to your document.
example : button,div,p,span and so on.
There are 2 ways to use the add method
Example :
const game = new Stage();
game.add(game.stage);
- You have to specifiy the before text if you want to add the stage before any other elements
const game = new Stage();
game.add(game.stage,"before");
How to set the width and height of the stage
game.stage.width = 400
game.stage.height = 400
the value depends on you
Good to know
You can set the width and height using the setSize. This is gonna be the next topic.