繁体   English   中英

fixedToCamera时更改Phaser.Text的位置

[英]Changing position of Phaser.Text when fixedToCamera

当Phaser.Text元素的属性fixedToCamera设置为true时,如何更改其位置。 在下面的代码中,counterText.x的值始终重置为45;

var game = new Phaser.Game(500, 500, 'phaser-example', { create: create, update: update});

var counter = 0;

function create() {
  counterText = game.add.text(45, 45, 'Text', {
    font: "26px Verdana",
    fill: "#fff"
  });
  counterText.fixedToCamera = true;
}

function update() {
 counterText.x = counter++;
}

我认为这里的问题是,当fixedToCamera为true时,Text不再使用“ position”,而是使用“ cameraOffset”。 因此,如果您按照职位的要求进行修改,那么一切都会正常进行。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM