Quit-Rolling-Around-gmtk-ja.../UI/Card.gd

21 lines
491 B
GDScript3
Raw Normal View History

2022-07-16 10:33:31 +01:00
tool
extends Control
2022-07-16 12:06:46 +01:00
export (Resource) var card_info
2022-07-16 10:33:31 +01:00
const TYPE_COLORS = [
Color("#db4758"), # DAMAGE
Color("#3cc361"), # UTILITY
2022-07-16 13:50:18 +01:00
Color("#bcb64f"), # SPECIAL
2022-07-16 10:33:31 +01:00
Color("#bc5ec6"), # EFFECT
2022-07-16 12:06:46 +01:00
Color("#a4a4a4"), # MOVEMENT
2022-07-16 10:33:31 +01:00
]
func _ready():
2022-07-16 12:06:46 +01:00
# change the color of the panel to match the appropriate type
2022-07-16 10:33:31 +01:00
var card_style = $PanelContainer.get('custom_styles/panel').duplicate(true)
2022-07-16 12:06:46 +01:00
card_style.set_bg_color(TYPE_COLORS[card_info.type])
2022-07-16 10:33:31 +01:00
$PanelContainer.set('custom_styles/panel', card_style)