Massive work on level, UI, sound, and player functionality, small progress on netcode. Renamed project to Net Gunner.
This commit is contained in:
24
scripts/trap_icon.gd
Normal file
24
scripts/trap_icon.gd
Normal file
@@ -0,0 +1,24 @@
|
||||
class_name TrapIcon extends Control
|
||||
|
||||
const trap_icons : Dictionary = {
|
||||
Game.TrapType.BOMB : preload("res://visuals/images/icons/bomb.png"),
|
||||
Game.TrapType.GAS : preload("res://visuals/images/icons/gas.png"),
|
||||
Game.TrapType.PITFALL : preload("res://visuals/images/icons/pitfall.png"),
|
||||
Game.TrapType.FORCE_PANEL : preload("res://visuals/images/icons/force_panel.png"),
|
||||
Game.TrapType.SWITCH : preload("res://visuals/images/icons/switch.png"),
|
||||
Game.TrapType.MINE : preload("res://visuals/images/icons/mine.png"),
|
||||
}
|
||||
|
||||
@onready var icon_image : TextureRect = %Icon
|
||||
@onready var qty_label : Label = %Label
|
||||
|
||||
func setup(type : Game.TrapType, qty : int) -> void:
|
||||
icon_image.texture = trap_icons[type]
|
||||
set_quantity(qty)
|
||||
|
||||
func set_quantity(qty : int) -> void:
|
||||
qty_label.text = str(qty)
|
||||
if qty < 1:
|
||||
icon_image.modulate = Color.DIM_GRAY
|
||||
else:
|
||||
icon_image.modulate = Color.WHITE
|
||||
Reference in New Issue
Block a user