Compare commits

..

5 Commits

Author SHA1 Message Date
Artur 5ee8c97455 Merge branch 'main' of https://gitty.informatik.hs-mannheim.de/3002102/gae_wild_jam 2026-04-15 17:49:11 +02:00
Artur b9f024685b Merge branch 'better-perk-display' 2026-04-15 17:48:25 +02:00
Artur 452325a0b4 fixed explosion calculation and finished cards + xp bar 2026-04-15 17:22:15 +02:00
Artur David 681471259b improved card size 2026-04-15 16:09:46 +02:00
Artur c2cbeba20c created card ui 2026-04-15 07:11:06 +02:00
8 changed files with 227 additions and 14 deletions

View File

@ -0,0 +1,101 @@
[gd_scene format=3 uid="uid://bbhpa50ef6702"]
[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"]
[ext_resource type="Texture2D" uid="uid://cdktimg5axaxj" path="res://assets/Fire Pixel Bullet 16x16/All_Fire_Bullet_Pixel_16x16_01.png" id="4_nlhlf"]
[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 = 5.0
font = ExtResource("3_n4umd")
font_size = 12
[sub_resource type="AtlasTexture" id="AtlasTexture_n4umd"]
atlas = ExtResource("4_nlhlf")
region = Rect2(258, 241, 25, 14)
[sub_resource type="LabelSettings" id="LabelSettings_ni87r"]
font = ExtResource("4_40ty6")
font_size = 11
[node name="PerkCard" type="Control" unique_id=1471811151]
custom_minimum_size = Vector2(200, 300)
layout_mode = 3
anchors_preset = 0
script = ExtResource("1_t8gqh")
[node name="Card" type="TextureRect" parent="." unique_id=1832247473]
texture_filter = 1
custom_minimum_size = Vector2(200, 300)
layout_mode = 0
offset_right = 40.0
offset_bottom = 40.0
texture = SubResource("AtlasTexture_fgk3h")
[node name="Name" type="Label" parent="Card" unique_id=2006873472]
layout_mode = 1
anchors_preset = 5
anchor_left = 0.5
anchor_right = 0.5
offset_left = -50.5
offset_top = 43.0
offset_right = 50.5
offset_bottom = 92.0
grow_horizontal = 2
text = "Zweizeilige
Überschrift
"
label_settings = SubResource("LabelSettings_qag4p")
horizontal_alignment = 1
[node name="TextureRect" type="TextureRect" parent="Card/Name" unique_id=2128840891]
layout_mode = 1
anchors_preset = 7
anchor_left = 0.5
anchor_top = 1.0
anchor_right = 0.5
anchor_bottom = 1.0
offset_left = -24.5
offset_top = -10.0
offset_right = 24.5
offset_bottom = 19.0
grow_horizontal = 2
grow_vertical = 0
texture = SubResource("AtlasTexture_n4umd")
[node name="Description" 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 = -65.0
offset_top = -176.0
offset_right = 69.0
offset_bottom = -43.0
grow_horizontal = 2
grow_vertical = 0
text = "Text in Zeile Eins
Text in Zeile Eins
Text in Zeile Eins
Text in Zeile Eins
Text in Zeile Zwei
Text in Zeile Drei
Text in Zeile Vier
Text in Zeile Fünf"
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 = 200.0
offset_bottom = 300.0
[connection signal="pressed" from="Button" to="." method="_on_button_pressed"]

View File

@ -17,6 +17,20 @@
[ext_resource type="Script" uid="uid://duauc778wc3hd" path="res://scripts/pause_menu.gd" id="18_264po"]
[ext_resource type="FontFile" uid="uid://8v71dcws4q6o" path="res://assets/fonts/slkscre.ttf" id="19_1kice"]
[ext_resource type="Script" uid="uid://586y330mhx8" path="res://scripts/options_menu_ingame.gd" id="20_1kice"]
[ext_resource type="Texture2D" uid="uid://dp8o40ssuh8ip" path="res://assets/Tiny RPG Mana Soul GUI v1.0/20250421barB-Sheet.png" id="16_ssvqc"]
[sub_resource type="Resource" id="Resource_ssvqc"]
script = ExtResource("6_ir15t")
weight = 1.0
enemy = ExtResource("7_ca42v")
metadata/_custom_type_script = "uid://b4jrogrq54c8f"
[sub_resource type="Resource" id="Resource_264po"]
script = ExtResource("6_ir15t")
min_time = 10.0
weight = 0.5
enemy = ExtResource("8_rysoc")
metadata/_custom_type_script = "uid://b4jrogrq54c8f"
[sub_resource type="TileSetAtlasSource" id="TileSetAtlasSource_vtaks"]
texture = ExtResource("7_gee14")
@ -2388,24 +2402,70 @@ 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
[node name="NinePatchRect" type="NinePatchRect" parent="CanvasLayer/ProgressBar" unique_id=1364517669]
texture_filter = 1
layout_mode = 1
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
offset_left = -6.5
offset_top = -1.0
offset_right = 5.5
offset_bottom = 2.0
grow_horizontal = 2
grow_vertical = 2
texture = ExtResource("16_ssvqc")
draw_center = false
region_rect = Rect2(0, 0, 95, 15)
patch_margin_left = 7
patch_margin_top = 5
patch_margin_right = 8
patch_margin_bottom = 6
[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="ColorRect" type="ColorRect" parent="CanvasLayer/LevelUpManager" unique_id=1319513730]
layout_mode = 1
offset_left = -656.0
offset_top = -9.0
offset_right = 642.0
offset_bottom = 728.0
color = Color(0, 0, 0, 0.0627451)
[node name="HBoxContainer" type="HBoxContainer" parent="CanvasLayer/LevelUpManager" unique_id=957625333]
layout_mode = 0
offset_right = 40.0
offset_bottom = 40.0
custom_minimum_size = Vector2(1000, 400)
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
theme_override_constants/separation = 50
alignment = 1
[node name="PerkEffects" type="Node2D" parent="." unique_id=2027136639]
script = ExtResource("16_ca42v")

View File

@ -3,4 +3,5 @@ class_name Perk
@export var name: String
@export var description: String
@export var icon: Texture2D = null
var effect: Callable

View File

@ -3,6 +3,7 @@ extends Area2D
# Called when the node enters the scene tree for the first time.
func _ready():
await get_tree().physics_frame
for body in get_overlapping_bodies():
if body.is_in_group("enemies"):
body.hit()

View File

@ -2,7 +2,9 @@ extends Control
@onready var perk_effects = get_node("/root/Game/PerkEffects")
var perks
@onready var perkCard = preload("res://scenes/PerkCard.tscn")
# Called when the node enters the scene tree for the first time.
func _ready() -> void:
perks = perk_effects.available_perks
@ -17,18 +19,23 @@ func _process(delta: float) -> void:
func show_perks():
if perks.is_empty():
return
var tween = create_tween()
tween.tween_property($ColorRect, "color:a", 0.6, 0.3)
get_tree().paused = true
var shuffled = perks.duplicate()
shuffled.shuffle()
var chosen = shuffled.slice(0, 3)
for x in chosen:
var button = Button.new()
button.text = x.name + "\n" + x.description
button.pressed.connect(func(): select_perk(x))
$HBoxContainer.add_child(button)
var card = perkCard.instantiate()
$HBoxContainer.add_child(card)
card.setup(x, func(): select_perk(x))
func select_perk(perk):
perk.effect.call()
get_tree().paused = false
perks.erase(perk)
for child in $HBoxContainer.get_children(): child.queue_free()
var tween = create_tween()
tween.tween_property($ColorRect, "color:a", 0.0, 0.3)
await tween.finished

View File

@ -0,0 +1,42 @@
extends Control
@export var icon: Texture2D
# Called when the node enters the scene tree for the first time.
var on_select: Callable
func setup(perk: Perk, select: Callable):
$Button.modulate.a = 0
$Card/Name.text = perk.name
$Card/Description.text = perk.description
if perk.icon != null:
$Card/Name/TextureRect.texture = perk.icon
animate_in()
$Button.modulate.a = 0.3
$Button.mouse_entered.connect(func(): $Button.modulate.a = 0.6)
$Button.mouse_exited.connect(func(): $Button.modulate.a = 0.3)
on_select = select
func _on_button_pressed() -> void:
await animate_out()
on_select.call()
pass # Replace with function body.
func animate_in():
await get_tree().process_frame
var start_y = global_position.y + 500
var end_y = global_position.y
global_position.y = start_y
var tween = create_tween()
tween.tween_property(self, "global_position:y", end_y, 0.3).set_ease(Tween.EASE_OUT).set_trans(Tween.TRANS_QUAD)
func animate_out():
var start_y = global_position.y
var end_y = global_position.y - 500
global_position.y = start_y
var tween = create_tween()
tween.tween_property(self, "global_position:y", end_y, 0.3).set_ease(Tween.EASE_IN).set_trans(Tween.TRANS_QUAD)
await tween.finished

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)