问答详情
源自:2-3 phaser环境搭建

老师。我的图片为什么没加载。背景也是。

var game =new Phaser.Game(375,667,Phaser.AUTO);

var helloState={
preload:function (){
    game.stage.backgroundColor="#a8d4bf"
    game.load.image("logo","/source/logo.png")
    },

create:function (){
    var text=game.add.text(game.world.centerX,25,"hello world11",{fill:'#fff'})
    text.anchor.set(0.5);
    var 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");


http://img4.mukewang.com/60531dd60001df3004820763.jpg

提问者:留白的云 2021-03-18 17:31

个回答

  • 天天敲代码
    2021-03-31 18:03:20

    已经看见你评论了很多,特意在这回一条,加油,在慕课网一起进步。还有学完了,来个中肯评价?

  • 学音乐的程序员
    2021-03-18 23:47:08

    图片在哪里加载完成的?

    你的背景图片没加载,你就一个hellostate。