feat: Add bonus flash effect for player pickups and update rendering logic
Signed-off-by: Hans Kokx <hans.d.kokx@gmail.com>
This commit is contained in:
@@ -102,5 +102,18 @@ void main() {
|
||||
}
|
||||
expect(player.lives, 9);
|
||||
});
|
||||
|
||||
test('successful pickups trigger bonus flash and it fades over time', () {
|
||||
final player = Player(x: 1.5, y: 1.5, angle: 0)..health = 50;
|
||||
final food = HealthCollectible(x: 1, y: 1, mapId: MapObject.food);
|
||||
|
||||
expect(player.bonusFlash, 0.0);
|
||||
player.tryPickup(food);
|
||||
expect(player.bonusFlash, 1.0);
|
||||
|
||||
player.tick(const Duration(milliseconds: 16));
|
||||
expect(player.bonusFlash, lessThan(1.0));
|
||||
expect(player.bonusFlash, greaterThan(0.0));
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user