当我调用shiftHSL时,为什么我的精灵会消失?

时间:2015-01-17 20:37:23

标签: phaser-framework

如果我取消注释下面的shiftHSL行,则不会出现精灵。

<script src='https://rawgit.com/photonstorm/phaser/master/build/phaser.js'></script>

<script>
var game = new Phaser.Game(800, 400, Phaser.AUTO, '', {
  preload: function() { this.game.load.image('dwarf', 'res/dwarf.png') },
  create: function() {
    var bmd = game.make.bitmapData()
    bmd.width = 80
    bmd.height = 80
    bmd.circle(bmd.width / 2, bmd.width / 2, bmd.width / 2, '#ffffff')
    bmd.alphaMask('dwarf', bmd)
    // bmd.shiftHSL(0, -.5, 0)
    var sprite = game.add.sprite(100, 100, bmd)
  }
});
</script>

1 个答案:

答案 0 :(得分:1)

好的,我明白了。看起来您需要在致电shiftHSL之前致电bmd.update()