git clone https://github.com/MatheusLM/phaser-js-template-tutorial.git
https://www.apachefriends.org/download.html
preload() {
// Set the base url where the loader go to get the assets
this.load.setBaseURL("./assets/");
// Load some images
this.load.image("background", "background.png");
this.load.image("logo", "logo.png");
// On complete the loader, go to GameScene
this.load.on("complete", () => {
this.scene.start("GameScene");
});
}
create() {
...
// Add images, objects, etc
...
}
All game logic (like animations, movements, etc) have to be called on this function, to work and update each frame.
update() {
...
this.checkKeyboardInput();
// You can add more logic here, this is just an example
...
}