wasya1212 Posted November 1, 2019 Share Posted November 1, 2019 I create simple scene, but I can't see any images or text. All images are loaded. Update is not called. What's wrong? export default class Play extends Phaser.Scene { constructor () { super('game'); this.staticBg = null; this.scrollingBg = null; this.text = null; } preload() { this.load.image('static-bg', 'img/Simpsons_22_15_P1_640x360_279961667900.jpg'); } create() { console.log("play"); // work this.add.image(0, 0, 'static-bg').setOrigin(0, 0).setScale(1.5, 1.7); // doesnt work this.text = this.add.text(10, 70); this.text.setText('Power: ' + 100); } update () { this.text.setText('Power: ' + 100); } } Game.js import Game from "./js/game"; import { Preload, Play } from './js/states'; const config = { title: "Donuts", width: 1000, height: 800, parent: "game", // backgroundColor: "#18216D", pixelArt: true, scene: [ // Preload, Play ], physics: { default: 'arcade', arcade: { debug: false, gravity: { y: 300 } } } }; window.onload = () => { let game = new Game(config); game.start(); }; Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.