【发布时间】:2020-04-22 02:38:11
【问题描述】:
你能告诉我如何在点击时使用按钮加快和减慢球的速度吗? 我使用了代码,但它还没有工作,
this.upButton = this.add.sprite(230, 530, 'down-bubble').setInteractive({ cursor: 'pointer' });
this.downButton = this.add.sprite(80, 530, 'up-bubble').setInteractive({ cursor: 'pointer' });
this.input.on('gameobjectup', function (pointer, gameobject) {
if (gameobject === this.downButton && this.spinSpeed.timeScale > 100)
{
this.spinSpeed.timeScale -= 10.1;
}
else if (gameobject === this.upButton && this.spinSpeed.timeScale < 19.9)
{
this.spinSpeed.timeScale += 10.1;
}
});
generateDance() {
this.spinSpeed = 0.003;
return this.tweens.addCounter({
from: 220,
to: 160,
duration: 9000,
delay: 2000,
ease: 'Sine.easeInOut',
repeat: -1,
yoyo: true
});
}
【问题讨论】:
-
你能添加你用来创建球的代码吗?以及调用您的
generateDance()方法的代码? -
你好,先生,这是调用球的代码
标签: javascript typescript phaser-framework