123456789101112131415161718192021222324252627 |
- class_name BrickLifeDisplay
- extends Node2D
- const LABEL_OFFSET = Vector2(5, 15)
- var default_font
- var life := 0
- func _ready() -> void:
- create_font()
- func _draw() -> void:
- draw_string(default_font, position + LABEL_OFFSET, str(life))
- func create_font() -> void:
- var label = Label.new()
- default_font = label.get_font("font")
- func _on_Brick_life_changed(new_life: int) -> void:
- life = new_life
- update()
|