we are trying to make cards

This commit is contained in:
2025-10-05 04:02:52 +02:00
parent 933d83fdbf
commit 73af278cc1
11 changed files with 173 additions and 19 deletions

View File

@@ -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():

View File

@@ -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"

View File

@@ -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)

View File

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

View File

@@ -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"

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 KiB

View File

@@ -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

View File

@@ -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)
return get_cards().get(active_card_index)

View File

@@ -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

View File

@@ -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"]

View File

@@ -67,5 +67,6 @@ dash={
[rendering]
textures/canvas_textures/default_texture_filter=0
renderer/rendering_method="gl_compatibility"
renderer/rendering_method.mobile="gl_compatibility"