0
var game = new Phaser.Game(800, 600, Phaser.CANVAS, 'phaser-example', { preload: preload, create: create});
function preload() {
// You can fill the preloader with as many assets as your game requires
// Here we are loading an image. The first parameter is the unique
// string by which we'll identify the image later in our code.
// The second parameter is the URL of the image (relative)
}
function create() {
// This creates a simple sprite that is using our loaded image and
// displays it on-screen
// and assign it to a variable
var image = game.add.sprite(0, 0, 'einstein');
game.physics.enable(image, Phaser.Physics.ARCADE);
image.body.velocity.x=150;
//my attempt below
if(image.body.coordinate.x > 1){
var image = game.add.sprite(0, 0, 'einstein');
}
}
我目前正嘗試將圖像精靈重置爲座標0,0,當它離開屏幕時完全離開屏幕,所以基本上一旦它離開畫布就會重置並重置幾個小時嘗試了很多東西任何提示將不勝感激。正如我一直試圖主動獲取座標,以便它知道何時在第一個圖像消失時加載圖像。如何在到達框架結尾時將其位置重置回原點? javascript
感謝
如何做任何提示? – 2015-03-02 20:33:54
它似乎只檢查一次,它總是輸出越界 – 2015-03-02 21:15:04
雅它仍然只是越界並不會重置 – 2015-03-02 21:21:16