如何缩放Phaser 3动画?

时间:2018-10-30 14:51:37

标签: phaser-framework

如何缩放与主体配对的动画?可以说动画帧是256x256,但是我想在可变大小的主体上使用它吗?

我在配置中或创建动画后找不到任何比例尺属性。有任何想法吗?这是我的代码:

function preload()
{
    this.load.image('human', 'assets/sprites/x2kship.png');
    this.load.atlas('our-sheet', 'data/atlas.png', 'data/atlas.json');
}

function create ()
{
    var humanWalk = {
        key: 'human-walk',    
        frames: [
            {key: "our-sheet", frame: "human1.png"},
            {key: "our-sheet", frame: "human2.png"},
            {key: "our-sheet", frame: "human3.png"},
            {key: "our-sheet", frame: "human4.png"},
        ],
        frameRate: 6,
        repeat: -1
    };

    this.anims.create(humanWalk);

    human = this.matter.add.sprite(100, 100, 'human');
    human.setCircle(10);
    human.anims.load('human-walk');
    human.anims.play('human-walk');

0 个答案:

没有答案