我使用,我想縮小在實際遊戲中的一些大的圖像使遊戲中移相器:如何在不改變位置的情況下縮放Phaser/PixiJS中的精靈大小?
create() {
//Create the sprite group and scale it down to 30%
this.pieces = this.add.group(undefined, "pieces", true);
this.pieces.scale.x = 0.3;
this.pieces.scale.y = 0.3;
//Add the players to the middle of the stage and add them to the 'pieces' group
var middle = new Phaser.Point(game.stage.width/2, game.stage.height/2);
var player_two = this.add.sprite(middle.x - 50, middle.y, 'image1', undefined, this.pieces);
var player_one = this.add.sprite(middle.x, middle.y-50, 'image2', undefined, this.pieces);
}
然而,因爲精靈在大小縮放,他們的首發位置也被縮放,所以出現在舞臺中間,它們只出現在距離中間距離的30%。
如何在不影響其位置的情況下縮放精靈圖像?
(代碼是偶然的打字稿,但我認爲這個特定的例子也是這樣的javascript這可能是無關緊要的)