Meteor 和 Phaser - 加载资产时出错
Meteor and Phaser - error loading asset
I 运行 Phaser with Meteor 从目录加载 .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'
I 运行 Phaser with Meteor 从目录加载 .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'