流星和相位器-错误加载资源

Meteor and Phaser - error loading asset

本文关键字:错误 加载 资源 流星      更新时间:2023-09-26

我用流星运行相位器,当从目录加载.png文件时,我得到一个错误。谁能提供一些指导,如何解决它。

我的环境是

ubuntu 14.04
Meteor 1.1.0.2
Phaser v2.3.0

我的目录结构和文件夹是

cmt@ubuntu:~/projects/myMeteorProjects/issueReplication2$ ls -R
.:
client  index.css  index.html  public  server
./client:
client.js   phaser.js
./public:
car.png

index . html是

<head>
  <title>phaser and meteor</title>
</head>
<body>
  <h1>Phaser and Meteor</h1>
  {{> game1}}
</body>
<template name="game1">
  {{phaserGame}}

client.js是

Template.game1.helpers({
    phaserGame: function() {
    var game = new Phaser.Game(320,320, Phaser.AUTO, 'firstGame', { preload:
 preload, create: create, update:update }); 
    return game;
    function preload() {
        game.load.image('car', './public/car.png');
    }
    function create() {
        car = game.add.sprite(50, 50, 'car');
    }
    function update() {
    }
    function moveBullets (bullet) { 
    }
    function accelerateToObject(obj1, obj2, speed) {
    }
    }
})

最后在Chrome中的错误是

Phaser.Loader - image[car]: error loading asset from URL ./public/car.png

'./public/car.png''/car.png'的变化