created card ui

better-perk-display
Artur 2026-04-15 07:11:06 +02:00
parent 3459ab5342
commit c2cbeba20c
6 changed files with 102 additions and 11 deletions

View File

@ -0,0 +1,68 @@
[gd_scene format=3 uid="uid://cgl06rqop270h"]
[ext_resource type="Script" uid="uid://dw5y2tp34fxys" path="res://scripts/perk_card.gd" id="1_t8gqh"]
[ext_resource type="Texture2D" uid="uid://duo145bmwho8d" path="res://assets/UI assets pack 2/UI books & more.png" id="2_nlhlf"]
[ext_resource type="FontFile" uid="uid://cq0jx2aapggkg" path="res://assets/fonts/slkscrb.ttf" id="3_n4umd"]
[ext_resource type="FontFile" uid="uid://brooj0hba7650" path="res://assets/fonts/slkscr.ttf" id="4_40ty6"]
[sub_resource type="AtlasTexture" id="AtlasTexture_fgk3h"]
atlas = ExtResource("2_nlhlf")
region = Rect2(561, 17, 46, 62)
[sub_resource type="LabelSettings" id="LabelSettings_qag4p"]
line_spacing = 0.0
font = ExtResource("3_n4umd")
font_size = 5
[sub_resource type="LabelSettings" id="LabelSettings_ni87r"]
font = ExtResource("4_40ty6")
font_size = 3
[node name="PerkCard" type="Control" unique_id=1471811151]
layout_mode = 3
anchors_preset = 0
script = ExtResource("1_t8gqh")
[node name="Card" type="TextureRect" parent="." unique_id=1832247473]
texture_filter = 1
layout_mode = 0
offset_right = 40.0
offset_bottom = 40.0
texture = SubResource("AtlasTexture_fgk3h")
[node name="Description" type="Label" parent="Card" unique_id=2006873472]
layout_mode = 1
anchors_preset = 5
anchor_left = 0.5
anchor_right = 0.5
offset_left = -20.5
offset_top = 7.0
offset_right = 20.5
offset_bottom = 23.0
grow_horizontal = 2
text = "AOE
-Feuerball"
label_settings = SubResource("LabelSettings_qag4p")
horizontal_alignment = 1
[node name="Name" type="Label" parent="Card" unique_id=859816848]
layout_mode = 1
anchors_preset = 7
anchor_left = 0.5
anchor_top = 1.0
anchor_right = 0.5
anchor_bottom = 1.0
offset_left = -20.0
offset_top = -36.0
offset_right = 20.0
grow_horizontal = 2
grow_vertical = 0
text = "Das ist ein test"
label_settings = SubResource("LabelSettings_ni87r")
horizontal_alignment = 1
autowrap_mode = 2
[node name="Button" type="Button" parent="." unique_id=1274377333]
layout_mode = 0
offset_right = 46.0
offset_bottom = 62.0

View File

@ -2406,8 +2406,13 @@ script = ExtResource("10_vtaks")
[node name="CanvasLayer" type="CanvasLayer" parent="." unique_id=1323249211]
[node name="ProgressBar" type="ProgressBar" parent="CanvasLayer" unique_id=825658619]
offset_right = 607.0
anchors_preset = 5
anchor_left = 0.5
anchor_right = 0.5
offset_left = -303.5
offset_right = 303.5
offset_bottom = 27.0
grow_horizontal = 2
max_value = 5.0
step = 1.0
show_percentage = false
@ -2415,15 +2420,26 @@ show_percentage = false
[node name="LevelUpManager" type="Control" parent="CanvasLayer" unique_id=292400493]
process_mode = 3
layout_mode = 3
anchors_preset = 0
offset_right = 40.0
offset_bottom = 40.0
anchors_preset = 5
anchor_left = 0.5
anchor_right = 0.5
grow_horizontal = 2
script = ExtResource("16_rysoc")
[node name="HBoxContainer" type="HBoxContainer" parent="CanvasLayer/LevelUpManager" unique_id=957625333]
layout_mode = 0
offset_right = 40.0
offset_bottom = 40.0
layout_mode = 1
anchors_preset = 8
anchor_left = 0.5
anchor_top = 0.5
anchor_right = 0.5
anchor_bottom = 0.5
offset_left = -20.0
offset_top = 350.0
offset_right = 20.0
offset_bottom = 390.0
grow_horizontal = 2
grow_vertical = 2
alignment = 1
[node name="PerkEffects" type="Node2D" parent="." unique_id=2027136639]
script = ExtResource("16_ca42v")

View File

@ -24,6 +24,8 @@ func show_perks():
for x in chosen:
var button = Button.new()
button.text = x.name + "\n" + x.description
button.custom_minimum_size = Vector2(200, 500)
button.size_flags_horizontal = Control.SIZE_SHRINK_CENTER
button.pressed.connect(func(): select_perk(x))
$HBoxContainer.add_child(button)

View File

@ -0,0 +1,4 @@
extends Control
@export var icon: Texture2D
# Called when the node enters the scene tree for the first time.

View File

@ -0,0 +1 @@
uid://dw5y2tp34fxys

View File

@ -12,17 +12,17 @@ func _ready() -> void:
cauldron = witch.get_node("CauldronBar")
var dsh = Perk.new()
dsh.name = "Doppelter Shuriken"
dsh.description = "Wirft zwei Shurikens statt einem"
dsh.description = "Wirft zwei Shurikens\n statt einem"
dsh.effect = double_shuriken
available_perks.append(dsh)
var faoe = Perk.new()
faoe.name = "AOE-Fireball"
faoe.description = "Feuerbälle erzeugen eine Explosion bei Berührung"
faoe.description = "Feuerbälle erzeugen\n eine Explosion\n bei Berührung"
faoe.effect = fireball_aoe
available_perks.append(faoe)
var bexp = Perk.new()
bexp.name = "Brewing-Explosion"
bexp.description = "Die Hexe erzeugt eine Explosion am Ende des Brauens"
bexp.description = "Die Hexe erzeugt\n eine Explosion am\n Ende des Brauens"
bexp.effect = brew_explosion
available_perks.append(bexp)