Explorar o código

:wrench: Add maximum life for bricks

1999 life points at maximum. That should be OK.
DricomDragon %!s(int64=3) %!d(string=hai) anos
pai
achega
157c582cea
Modificáronse 1 ficheiros con 4 adicións e 0 borrados
  1. 4 0
      godot/component/entity/brick/Brick.gd

+ 4 - 0
godot/component/entity/brick/Brick.gd

@@ -7,6 +7,9 @@ signal kace_damaged
 signal life_changed
 
 
+const MAX_LIFE := 1999
+
+
 var life: int
 
 
@@ -14,6 +17,7 @@ func setup(x: int, y: int, max_life: int):
 	position.x = x * 40
 	position.y = y * 20
 	life = randi() % max_life + 1
+	life = min(life, MAX_LIFE)
 	emit_signal("life_changed", life)