如何从Phaser中的Spritesheet获取随机图像

时间:2019-12-09 02:50:43

标签: javascript phaser

我正在尝试使用Phaser 2进行游戏,并且我的这张Spritesheet包含许多图像,需要随机获取并使用。 这就是我只使用一张图片而不是一张Spritesheet的方式。

this.plastico2 = this.add.sprite(this.world.centerX, 20, 'plastico2');
    this.plastico2.anchor.setTo(0.5);
    this.plastico2.scale.setTo(1.5);
    this.physics.arcade.enable(this.plastico2);
    this.plastico2.body.collideWorldBounds = true;

0 个答案:

没有答案