我有兩個問題要公開。流星+移相器/ Pixi
第一:我正在一個網站上工作,我正在使用流星來處理前端後端和數據庫,因爲我沒有太多的經驗處理各種各樣的接口。我喜歡流星,但我需要添加動畫圖形(主要是2D動畫),我正在考慮使用Phaser或Pixi,但我不確定是否有任何這些是正確的工具(我沒有試圖做一場比賽,只是動畫)。我想知道是否有其他工具最適合做我之前描述的工作。
第二:我已經用相位器進行了一些實驗,我從環境js下載了用於流星的相位器包,但我甚至無法將圖像加載到瀏覽器。看起來移相器不能加載圖像(儘管路徑是正確的),但流星發送一個200 OK響應給瀏覽器是空的,並且頭上的類型是錯誤的,它說text/html,當它應該說圖像/ PNG。我的問題涉及這個問題Meteor and Phaser - error loading asset,但提出的解決方案並不適合我。
我的文件結構:
NPM-移相器的debug.log,test.html的公共 移相器,移相器test.css - test.js
我的移相器,test.js:
if (Meteor.isClient) {
Template.game.helpers({
game: function(){
var game = new Phaser.Game(800, 600, Phaser.AUTO, '', { preload: preload, create: create, update: update });
function preload() {
game.load.image('sky', 'public/sky2.png');
game.load.image('ground', 'public/platform.png');
game.load.image('star', '/star.png');
game.load.spritesheet('dude', 'public/dude.png', 32, 48);
}
function create() {
game.add.sprite(100, 100 , 'star');
game.add.sprite(300, 300 , 'ground');
game.add.sprite(150, 150, 'sky');
game.add.sprite(200, 200, 'dude');
}
function update() {
}
}
});
}
if (Meteor.isServer) {
Meteor.startup(function() {
// code to run on server at startup
});
}
任何幫助將不勝感激。
謝謝你們!
參考圖像非常感謝Michel,這確實解決了我的問題! –