From 73af278cc1deca2b18b41b2dcaa6862e1a269ff7 Mon Sep 17 00:00:00 2001 From: Daniel Olsen Date: Sun, 5 Oct 2025 04:02:52 +0200 Subject: [PATCH] we are trying to make cards --- growth/BaseCard/BaseCard.gd | 7 ++- growth/BaseCard/BaseCard.tscn | 54 +++++++++++++++- growth/BaseCard/margin_container.gd | 8 +++ growth/BaseCard/margin_container.gd.uid | 1 + growth/Cards/DashCard.tscn | 6 +- growth/assets/Card/Card_template_grey.png | Bin 0 -> 2431 bytes .../assets/Card/Card_template_grey.png.import | 40 ++++++++++++ growth/hand.gd | 13 ++-- growth/hand.tscn | 59 +++++++++++++++--- growth/level.tscn | 3 +- growth/project.godot | 1 + 11 files changed, 173 insertions(+), 19 deletions(-) create mode 100644 growth/BaseCard/margin_container.gd create mode 100644 growth/BaseCard/margin_container.gd.uid create mode 100644 growth/assets/Card/Card_template_grey.png create mode 100644 growth/assets/Card/Card_template_grey.png.import diff --git a/growth/BaseCard/BaseCard.gd b/growth/BaseCard/BaseCard.gd index 4752872..6997bb3 100644 --- a/growth/BaseCard/BaseCard.gd +++ b/growth/BaseCard/BaseCard.gd @@ -3,12 +3,17 @@ extends Control class_name BaseCard @export var behaviors = [] - +@export var art: Texture2D @export var title = "" +@export var description = "" func _ready() -> void: for behavior in behaviors: $Behaviors.add_child(behavior.instantiate()) + + $MarginContainer/VSplitContainer/Art.texture = art + $MarginContainer/VSplitContainer/VSplitContainer2/Title.text = title + $MarginContainer/VSplitContainer/VSplitContainer2/Description.text = description func activate(world, activator): for behavior in $Behaviors.get_children(): diff --git a/growth/BaseCard/BaseCard.tscn b/growth/BaseCard/BaseCard.tscn index 77ef18d..713b177 100644 --- a/growth/BaseCard/BaseCard.tscn +++ b/growth/BaseCard/BaseCard.tscn @@ -1,9 +1,57 @@ -[gd_scene load_steps=2 format=3 uid="uid://b0g5wd4n3py3x"] +[gd_scene load_steps=5 format=3 uid="uid://b0g5wd4n3py3x"] [ext_resource type="Script" uid="uid://c4x7n1r3ce1bc" path="res://BaseCard/BaseCard.gd" id="1_hoajl"] +[ext_resource type="Texture2D" uid="uid://bj4es23jrau8v" path="res://assets/Card/Card_template_grey.png" id="2_111jl"] +[ext_resource type="Script" uid="uid://bpnlg41p6hsel" path="res://BaseCard/margin_container.gd" id="3_j30jg"] +[ext_resource type="Texture2D" uid="uid://dpd4hnlfynh0i" path="res://assets/icons/Cursor_projectile_symbol.png" id="4_op1lx"] -[node name="Card" type="PanelContainer"] -offset_right = 1.0 +[node name="Card" type="AspectRatioContainer"] +anchors_preset = -1 +anchor_left = 0.156 +anchor_top = 0.81200004 +anchor_right = 0.156 +anchor_bottom = 0.81200004 +offset_left = -249.6 +offset_top = -730.80005 +offset_right = 180.4 +offset_bottom = -49.80005 +ratio = 0.64 +stretch_mode = 0 script = ExtResource("1_hoajl") +metadata/_edit_use_anchors_ = true [node name="Behaviors" type="Node" parent="."] + +[node name="NinePatchRect" type="NinePatchRect" parent="."] +layout_mode = 2 +texture = ExtResource("2_111jl") +patch_margin_left = 49 +patch_margin_top = 41 +patch_margin_right = 39 +patch_margin_bottom = 46 +axis_stretch_horizontal = 1 +axis_stretch_vertical = 1 + +[node name="MarginContainer" type="MarginContainer" parent="."] +layout_mode = 2 +script = ExtResource("3_j30jg") + +[node name="VSplitContainer" type="VSplitContainer" parent="MarginContainer"] +layout_mode = 2 + +[node name="Art" type="TextureRect" parent="MarginContainer/VSplitContainer"] +layout_mode = 2 +texture = ExtResource("4_op1lx") +expand_mode = 4 + +[node name="VSplitContainer2" type="VSplitContainer" parent="MarginContainer/VSplitContainer"] +layout_mode = 2 + +[node name="Title" type="RichTextLabel" parent="MarginContainer/VSplitContainer/VSplitContainer2"] +layout_mode = 2 +text = "Hello! +" + +[node name="Description" type="RichTextLabel" parent="MarginContainer/VSplitContainer/VSplitContainer2"] +layout_mode = 2 +text = "This is an example of speech, an audio compression service designed specifically for the reproduction of human speech" diff --git a/growth/BaseCard/margin_container.gd b/growth/BaseCard/margin_container.gd new file mode 100644 index 0000000..cd0c554 --- /dev/null +++ b/growth/BaseCard/margin_container.gd @@ -0,0 +1,8 @@ +extends MarginContainer + +func _process(_a) -> void: + var margin_value = 100 + add_theme_constant_override("margin_top", margin_value) + add_theme_constant_override("margin_left", margin_value) + add_theme_constant_override("margin_bottom", margin_value) + add_theme_constant_override("margin_right", margin_value) diff --git a/growth/BaseCard/margin_container.gd.uid b/growth/BaseCard/margin_container.gd.uid new file mode 100644 index 0000000..585b2a8 --- /dev/null +++ b/growth/BaseCard/margin_container.gd.uid @@ -0,0 +1 @@ +uid://bpnlg41p6hsel diff --git a/growth/Cards/DashCard.tscn b/growth/Cards/DashCard.tscn index e176f76..716d73e 100644 --- a/growth/Cards/DashCard.tscn +++ b/growth/Cards/DashCard.tscn @@ -1,7 +1,11 @@ -[gd_scene load_steps=3 format=3 uid="uid://ee0t3qv6gyam"] +[gd_scene load_steps=4 format=3 uid="uid://ee0t3qv6gyam"] [ext_resource type="PackedScene" uid="uid://b0g5wd4n3py3x" path="res://BaseCard/BaseCard.tscn" id="1_wwyou"] [ext_resource type="PackedScene" uid="uid://b3piw7awjaxgj" path="res://CardInjects/DashCardInject.tscn" id="2_2qs8v"] +[ext_resource type="Texture2D" uid="uid://dc513yugo5okh" path="res://assets/icons/Core_0.png" id="3_11w2b"] [node name="Card" instance=ExtResource("1_wwyou")] behaviors = [ExtResource("2_2qs8v")] +art = ExtResource("3_11w2b") +title = "Dash" +description = "Lololl" diff --git a/growth/assets/Card/Card_template_grey.png b/growth/assets/Card/Card_template_grey.png new file mode 100644 index 0000000000000000000000000000000000000000..8db187386e7e5712d8f262392b9b62e175a73a12 GIT binary patch literal 2431 zcmeAS@N?(olHy`uVBq!ia0y~yVEh8Y9Bd2>45zQ%?_ywJ;4JWnEM{Qf76M_$OLy!3 zFfcGkm$*ih1m~xflqVLYGB~H^6jv521ecViWacY`h|zfq|3D)5S5Q;?~;Pr3NJti z!G{Pz`EVr-IJJau{)#&7DJ~|MR`cM@9_D#f_3EKJjtgFVXFGSs<^{?xn)()S?^+O@ zBG$FQTA3yG0;?>GY`N!!vym4ZFKm3ldUp;;z_Gla^)Bmy$6xpaN?2rBWLY4>-Ek0g zf+fFWF2phjlsH^)yufJf3?d!HOF(>(Zh;a8ff7e{21juu221P(Mu!WmvJ7wriZnz6 znjTDpa4A?X`NjYLo_-dD=^$$aNAh&;YgoW-#lW!(lpdfAg%?eHAUOs&14SCFp-B&v%%JK% z9Cs9tK@B-bcoA|2L3h$Zfv+%X!UClnh;va>7^z`O3%8=XA@%|z$hi;?e7RJkfruke zWHo@YCNqcyk3Tda1B(}jxWO@q7N^W`L5G_S(1ZXkB;agrD+V6^T@N6}GwCD6|AXy! z&>c!B<{Qr`LJWXg3ui!_e^2+tBILBW{39a+TnU(gCG}zvQmF$Kig3>&rQ36$auQ-0 zJTarCdvI9_P2_NuaI@eHBts#d0u{w*f~XNSFbc3`c8oaYKr0O>P$18<>jWgZU=0l6 zB)u050S4!g0vH^z9916|beqFdFq{FAgq2iVesVxd*#@paq*4@AVk7bhQi%!?#8m;n zO%N}^Qj(z=3M%di8iY{LV8;kGzM-oT%3=VS0cV35sFhyBngXP(*AT$_qIChYLI@}% zId*}{Y;a;%cu}SJ;=sbE4`h{IH04cfSnybnYuAEk6@?c&x|{S~By?7_bL=V>`oed( z%#Op#N%cjO-iwGu_Y^^z^8Dzq7_`OaPL}>?6|Z4T_Z?>+p4K=f%Wn?@RkUvEe}x21Gisb hjTLaVWN_FgeIwQ2JBv*JJq88_22WQ%mvv4FO#l+d**E|I literal 0 HcmV?d00001 diff --git a/growth/assets/Card/Card_template_grey.png.import b/growth/assets/Card/Card_template_grey.png.import new file mode 100644 index 0000000..9ea9555 --- /dev/null +++ b/growth/assets/Card/Card_template_grey.png.import @@ -0,0 +1,40 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://bj4es23jrau8v" +path="res://.godot/imported/Card_template_grey.png-deb4271023a967a43e0471453c8fbf91.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://assets/Card/Card_template_grey.png" +dest_files=["res://.godot/imported/Card_template_grey.png-deb4271023a967a43e0471453c8fbf91.ctex"] + +[params] + +compress/mode=0 +compress/high_quality=false +compress/lossy_quality=0.7 +compress/uastc_level=0 +compress/rdo_quality_loss=0.0 +compress/hdr_compression=1 +compress/normal_map=0 +compress/channel_pack=0 +mipmaps/generate=false +mipmaps/limit=-1 +roughness/mode=0 +roughness/src_normal="" +process/channel_remap/red=0 +process/channel_remap/green=1 +process/channel_remap/blue=2 +process/channel_remap/alpha=3 +process/fix_alpha_border=true +process/premult_alpha=false +process/normal_map_invert_y=false +process/hdr_as_srgb=false +process/hdr_clamp_exposure=false +process/size_limit=0 +detect_3d/compress_to=1 diff --git a/growth/hand.gd b/growth/hand.gd index 2829ce9..e7bb2d3 100644 --- a/growth/hand.gd +++ b/growth/hand.gd @@ -1,4 +1,4 @@ -extends Panel +extends Control @export var player: NodePath @export var world: NodePath @@ -26,6 +26,9 @@ func _ready() -> void: for i in range(get_node(player).hand_size): draw_card() + var actual_dash_card = dash_card_scene.instantiate() + $HBoxContainer/Slot1.add_child(actual_dash_card) + func _process(delta): if Input.is_action_pressed("play_card"): play_card() @@ -35,9 +38,9 @@ func _process(delta): cycle_card(1); func play_card(): - var cards = get_cards(); - if active_card_index >= 0 and active_card_index < cards.size(): - var card = cards[active_card_index] + var slots = $HBoxContainer.get_children() + if active_card_index >= 0 and active_card_index < slots.size(): + var card = slots[active_card_index].get_node("Card") card.activate(get_node(world), get_node(player)); print(active_card_index) @@ -82,4 +85,4 @@ func get_card_container() -> Array: return $MarginContainer/HBoxContainer func get_active_card() -> Card: - return get_cards().get(active_card_index) \ No newline at end of file + return get_cards().get(active_card_index) diff --git a/growth/hand.tscn b/growth/hand.tscn index 0eae93d..ac9e496 100644 --- a/growth/hand.tscn +++ b/growth/hand.tscn @@ -1,18 +1,63 @@ -[gd_scene load_steps=2 format=3 uid="uid://co8jnr2dew5ts"] +[gd_scene load_steps=5 format=3 uid="uid://co8jnr2dew5ts"] [ext_resource type="Script" uid="uid://bykc0ufv25ij5" path="res://hand.gd" id="1_u4p2i"] +[ext_resource type="PackedScene" uid="uid://ee0t3qv6gyam" path="res://Cards/DashCard.tscn" id="2_wymn8"] +[ext_resource type="PackedScene" uid="uid://cwrwbf1ib5845" path="res://Cards/RocketLauncherCard.tscn" id="3_3q536"] +[ext_resource type="PackedScene" uid="uid://bbjra84inrnnu" path="res://Cards/FirewallCard.tscn" id="4_6wjrw"] -[node name="Hand" type="Panel"] +[node name="Hand" type="Control"] +layout_mode = 3 +anchors_preset = 0 offset_right = 40.0 offset_bottom = 40.0 script = ExtResource("1_u4p2i") player = NodePath("../../Player") world = NodePath("../..") -[node name="MarginContainer" type="MarginContainer" parent="."] -layout_mode = 0 -offset_right = 40.0 -offset_bottom = 40.0 +[node name="HBoxContainer" type="HBoxContainer" parent="."] +layout_mode = 1 +anchors_preset = 15 +anchor_right = 1.0 +anchor_bottom = 1.0 +offset_right = 460.0 +offset_bottom = 484.0 +grow_horizontal = 2 +grow_vertical = 2 -[node name="HBoxContainer" type="HBoxContainer" parent="MarginContainer"] +[node name="Slot1" type="PanelContainer" parent="HBoxContainer"] layout_mode = 2 + +[node name="Card2" parent="HBoxContainer/Slot1" instance=ExtResource("3_3q536")] +layout_mode = 2 + +[node name="Slot2" type="Control" parent="HBoxContainer"] +visible = false +layout_mode = 2 + +[node name="Card" parent="HBoxContainer/Slot2" instance=ExtResource("2_wymn8")] +layout_mode = 0 +anchors_preset = 0 +anchor_left = 0.0 +anchor_top = 0.0 +anchor_right = 0.0 +anchor_bottom = 0.0 +offset_left = 0.0 +offset_top = 0.0 +offset_right = 500.0 +offset_bottom = 681.0 + +[node name="Slot3" type="Control" parent="HBoxContainer"] +visible = false +layout_mode = 2 + +[node name="Card" parent="HBoxContainer/Slot3" instance=ExtResource("4_6wjrw")] +layout_mode = 0 +anchors_preset = 0 +anchor_left = 0.0 +anchor_top = 0.0 +anchor_right = 0.0 +anchor_bottom = 0.0 +offset_left = 0.0 +offset_top = 0.0 +offset_right = 430.0 +offset_bottom = 681.0 diff --git a/growth/level.tscn b/growth/level.tscn index 2a94f4a..e019d92 100644 --- a/growth/level.tscn +++ b/growth/level.tscn @@ -2,10 +2,9 @@ [ext_resource type="PackedScene" uid="uid://dhhnr3xkxbxlu" path="res://player.tscn" id="1_vonw3"] [ext_resource type="PackedScene" uid="uid://bsv3h2lpv7h77" path="res://virus.tscn" id="2_oi3di"] -[ext_resource type="PackedScene" uid="uid://co8jnr2dew5ts" path="res://hand.tscn" id="3_oi3di"] [ext_resource type="PackedScene" uid="uid://bldi3fw0vmlu3" path="res://music.tscn" id="3_oi3di"] [ext_resource type="TileSet" uid="uid://c20bl25rqyf68" path="res://assets/tiles/new_tile_set.tres" id="4_0b4ue"] -[ext_resource type="PackedScene" path="res://hand.tscn" id="5_f2txt"] +[ext_resource type="PackedScene" uid="uid://co8jnr2dew5ts" path="res://hand.tscn" id="5_f2txt"] [node name="Level" type="Node2D"] diff --git a/growth/project.godot b/growth/project.godot index 8a94af2..6b71004 100644 --- a/growth/project.godot +++ b/growth/project.godot @@ -67,5 +67,6 @@ dash={ [rendering] +textures/canvas_textures/default_texture_filter=0 renderer/rendering_method="gl_compatibility" renderer/rendering_method.mobile="gl_compatibility"