2017-04-23 62 views
-2

我需要在Phaser中添加對象,這是類似的東西,但是在wade中。 wade.addSceneObject(new SceneObject(dotSprite,0,dotPosition.x,dotPosition.y));我需要類似這樣的東西,但對於Phaser

+2

的可能的複製會[功能在移相器將對象(http://stackoverflow.com/questions/43565163/function-for-adding -object-in-phaser) –

+1

當你沒有得到答案時重新發佈一個問題在這裏不受歡迎。特別是如果你只等幾個小時。 – ceejayoz

回答

0

在移相器中添加對象(通常稱爲sprites)非常簡單。只是加載圖像中的預加載功能

function preload() { 

    game.load.image('mushroom', 'assets/sprites/mushroom2.png'); 

} 

然後添加精靈在創建功能

function create() { 

    // This simply creates a sprite using the mushroom image we loaded above and positions it at 200 x 200 
    var test = game.add.sprite(200, 200, 'mushroom'); 

} 

移相器,對如何做這樣的事情一噸的文檔。我從this example得到了代碼。

如果你是完全新的移相器,我強烈建議通過他們tutorial

相關問題