const?game?=?new?Phaser.Game(375,?667,?Phaser.AUTO);
const?helloState?=?{
????preload:?function?()?{
????????game.stage.backgroundColor?=?"#a8d4bf";
????????game.load.image("logo",?"/source/logo.png");
????},
????create:?function?()?{
????????const?text?=?game.add.text(game.world.centerX,?25,?"hello?world",?{fill:?'#fff'});
????????text.anchor.set(0.5);
????????const?logo?=?game.add.image(game.world.centerX,?game.world.centerY,?"logo");
????????logo.anchor.set(0.5);
????}
}
game.state.add("helloState",?helloState);
game.state.start("helloState");
2020-12-13
你用的是適配小游戲之后的phaser,由于GameGlobal判斷不太嚴(yán)謹(jǐn),導(dǎo)致瀏覽器環(huán)境報錯,更嚴(yán)謹(jǐn)?shù)淖龇ǎ?if(typeof GameGlobal != 'undefined'){}
代碼已改 可以在這下載 https://gitee.com/codeveryday/phaser-ce_wechat
在build目錄
2020-12-12
Uncaught ReferenceError: GameGlobal is not defined
??? <anonymous> http://127.0.0.1:8080/js/phaser.js:45
??? <anonymous> http://127.0.0.1:8080/js/phaser.js:51
Uncaught ReferenceError: Phaser is not defined
??? <anonymous> http://127.0.0.1:8080/js/main.js:1
瀏覽器報上面錯誤