试图在屏幕上加载图像

时间:2017-02-10 03:10:45

标签: phaser-framework httpserver

尝试在屏幕上加载图片。我只想在后台设置此图片,但无法通过黑屏。感谢

使用http-server

公用文件夹中的

public    
-assets    
--img    
---xlogo.png  
--js
---index.js
-systems    
--phaser.js

INDEX.HTML

<html>
  <head>
    <title>X Game</title>

    <script src="systems/phaser/phaser.js"></script>

    <script src="assets/js/index.js"></script>

  </head>
  <body>

    <div id="test-1"></div>

  </body>
</html>

-INDEX.JS -

var game = new Phaser.Game(800, 600, Phaser.CANVAS, 'test-1', { preload: preload, create: create, update: update });

function preload() {

    game.load.image('xlogo', 'assets/img/xlogo.png');

}

function create() {

    game.add.sprite(0, 0, 'xlogo');

}

function update() {
}

0 个答案:

没有答案