有没有办法在火焰引擎中暂停/播放视差背景



在我的游戏中,我有一个视差背景,当玩家移动时,它会产生动画。我希望当玩家不移动时视差停止。有可能吗?

Flame中的ParallaxComponent只包装了一个控制一切的Parallax对象。该类具有baseVelocity属性,该属性应始终设置为玩家的速度(以防玩家可以任意更改速度(。如果玩家只能移动(以相同的速度(或停止,你可以将其设置为0或不为0。

final c = ParallaxComponent();
// you can do this on your `update` method setting it to `player.velocity`
c.parallax?.baseVelocity = Vector2.zero();
// if `parallax` is null it just means it has not been loaded yet

最新更新