WIP: converting card loading to hard-coded solution due to load errors

This commit is contained in:
betalars 2025-04-07 17:26:06 +02:00
parent 8998c93480
commit 8067575f2a
7 changed files with 158 additions and 97 deletions

View File

@ -0,0 +1,34 @@
class_name HardCards extends Node
static var all_cards: Array[Dictionary] = [
{
"out-of-world": ["unique", "few_friends", []],
"rejection": ["finding_friends", "laughed", []],
"confusion": ["inner_conflict", "outer_conflict", []]
},
{
"homework": ["good_grades", "upset_teachers", []],
"teachers": ["volunteering", "becoming_teacher", []],
"joy": ["worried_mother", "thomas_gifted", []]
},
{
"comic_heroes": ["effort", "thomas_gifted", []],
"boy_stuff": ["pretending", "girls", []],
"teasing": ["stubborn", "good_intended", []]
},
{
"jui_jutsu": ["body", "girly", []],
"void": ["wet", "stop", []],
"hit": ["confidence", "vent", []]
},
]
static func get_cards_by_scene_id(id: int) -> Array:
var output:Array
for card_name in all_cards[id].keys():
var card_id:StringName = "%d.%s" % [id, card_name]
output.append(Card.new(card_name, card_id))
return output

View File

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

View File

@ -0,0 +1,46 @@
[gd_resource type="SpriteFrames" load_steps=7 format=3 uid="uid://db35k2lntld0o"]
[ext_resource type="Texture2D" uid="uid://sv0nhkkur1tt" path="res://logic-scenes/board/card-textures/cardsheet.png" id="1_l4v2i"]
[sub_resource type="AtlasTexture" id="AtlasTexture_ykk13"]
atlas = ExtResource("1_l4v2i")
region = Rect2(0, 0, 600, 440)
[sub_resource type="AtlasTexture" id="AtlasTexture_l43eo"]
atlas = ExtResource("1_l4v2i")
region = Rect2(600, 0, 600, 440)
[sub_resource type="AtlasTexture" id="AtlasTexture_x2vcn"]
atlas = ExtResource("1_l4v2i")
region = Rect2(0, 440, 600, 440)
[sub_resource type="AtlasTexture" id="AtlasTexture_e7401"]
atlas = ExtResource("1_l4v2i")
region = Rect2(600, 440, 600, 440)
[sub_resource type="AtlasTexture" id="AtlasTexture_j7wh6"]
atlas = ExtResource("1_l4v2i")
region = Rect2(0, 880, 600, 440)
[resource]
animations = [{
"frames": [{
"duration": 1.0,
"texture": SubResource("AtlasTexture_ykk13")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_l43eo")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_x2vcn")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_e7401")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_j7wh6")
}],
"loop": true,
"name": &"default",
"speed": 5.0
}]

View File

@ -1,6 +1,10 @@
@tool @tool
extends Area2D extends Area2D
class_name Card class_name Card
var card_id
#FIXME remove this legacy stuff without loosing the evil notes ...
var compatible_sticky_notes: Array[StickyNote] = [] var compatible_sticky_notes: Array[StickyNote] = []
@export var evil_sticky_notes: Array[StickyNote] = [] @export var evil_sticky_notes: Array[StickyNote] = []
var own_sticky_notes: Array[StickyNote] = [] var own_sticky_notes: Array[StickyNote] = []
@ -74,6 +78,12 @@ var is_dragged: bool = false:
var is_mouse_entered: bool = false var is_mouse_entered: bool = false
var mouse_offset: Vector2 var mouse_offset: Vector2
func _init(card_name: String = "card", own_id:StringName = "-1") -> void:
text = card_name
card_id = own_id
name = "c_%s" % card_name
func _ready(): func _ready():
input_event.connect(_on_input_event) input_event.connect(_on_input_event)
@ -97,8 +107,8 @@ func _ready():
%BackgroundSprite.frame = text.hash() % %BackgroundSprite.sprite_frames.get_frame_count(%BackgroundSprite.animation) %BackgroundSprite.frame = text.hash() % %BackgroundSprite.sprite_frames.get_frame_count(%BackgroundSprite.animation)
$Label.text = self.text $Label.text = self.text
#$Label.theme = State.current_main_theme $Label.theme = State.current_main_theme
#State.theme_changed.connect(func change_theme(new_theme): $Label.theme = new_theme) State.theme_changed.connect(func change_theme(new_theme): $Label.theme = new_theme)
wiggle_pos = float(text.hash() % 100) wiggle_pos = float(text.hash() % 100)
if not Engine.is_editor_hint(): if not Engine.is_editor_hint():
@ -205,9 +215,8 @@ func attach_sticky_note(sticky_note: StickyNote) -> bool:
sticky_note.attached_to = self sticky_note.attached_to = self
if name == "c_hit" and sticky_note.name == "p_effort": if name == "c_hit" and sticky_note.name == "p_effort":
#Steam.setAchievement("FIGHT_FOR_GOOD") Steam.setAchievement("FIGHT_FOR_GOOD")
#Steam.storeStats() Steam.storeStats()
pass
return true return true

View File

@ -1,60 +1,19 @@
[gd_scene load_steps=10 format=3 uid="uid://dy5rd437h5hsw"] [gd_scene load_steps=5 format=3 uid="uid://dy5rd437h5hsw"]
[ext_resource type="Script" uid="uid://2loic2eeec5b" path="res://logic-scenes/board/card.gd" id="1_emip0"] [ext_resource type="Script" uid="uid://wv72dum1fe72" path="res://logic-scenes/board/card.gd" id="1_emip0"]
[ext_resource type="Texture2D" uid="uid://sv0nhkkur1tt" path="res://logic-scenes/board/card-textures/cardsheet.png" id="2_ioijn"] [ext_resource type="SpriteFrames" uid="uid://db35k2lntld0o" path="res://logic-scenes/board/card-textures/card-sprites.tres" id="2_mdi7r"]
[ext_resource type="Theme" uid="uid://b056fn288p8ha" path="res://logic-scenes/themes/handwriting.theme" id="3_1x4uh"]
[sub_resource type="CapsuleShape2D" id="CapsuleShape2D_foovg"] [sub_resource type="CapsuleShape2D" id="CapsuleShape2D_foovg"]
radius = 110.0 radius = 110.0
height = 336.0 height = 336.0
[sub_resource type="AtlasTexture" id="AtlasTexture_mdi7r"]
atlas = ExtResource("2_ioijn")
region = Rect2(0, 0, 600, 440)
[sub_resource type="AtlasTexture" id="AtlasTexture_e1q5p"]
atlas = ExtResource("2_ioijn")
region = Rect2(600, 0, 600, 440)
[sub_resource type="AtlasTexture" id="AtlasTexture_nu76f"]
atlas = ExtResource("2_ioijn")
region = Rect2(0, 440, 600, 440)
[sub_resource type="AtlasTexture" id="AtlasTexture_es87b"]
atlas = ExtResource("2_ioijn")
region = Rect2(600, 440, 600, 440)
[sub_resource type="AtlasTexture" id="AtlasTexture_7bi75"]
atlas = ExtResource("2_ioijn")
region = Rect2(0, 880, 600, 440)
[sub_resource type="SpriteFrames" id="SpriteFrames_hkrkt"]
animations = [{
"frames": [{
"duration": 1.0,
"texture": SubResource("AtlasTexture_mdi7r")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_e1q5p")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_nu76f")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_es87b")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_7bi75")
}],
"loop": true,
"name": &"default",
"speed": 5.0
}]
[node name="card" type="Area2D"] [node name="card" type="Area2D"]
script = ExtResource("1_emip0") script = ExtResource("1_emip0")
metadata/type = "card" metadata/type = "card"
[node name="CollisionShape2D" type="CollisionShape2D" parent="."] [node name="CollisionShape2D" type="CollisionShape2D" parent="."]
position = Vector2(-0.0713516, 0.997451)
rotation = 1.5708 rotation = 1.5708
shape = SubResource("CapsuleShape2D_foovg") shape = SubResource("CapsuleShape2D_foovg")
@ -62,7 +21,7 @@ shape = SubResource("CapsuleShape2D_foovg")
unique_name_in_owner = true unique_name_in_owner = true
clip_children = 2 clip_children = 2
scale = Vector2(0.6, 0.6) scale = Vector2(0.6, 0.6)
sprite_frames = SubResource("SpriteFrames_hkrkt") sprite_frames = ExtResource("2_mdi7r")
frame = 1 frame = 1
[node name="Label" type="Label" parent="."] [node name="Label" type="Label" parent="."]
@ -78,6 +37,8 @@ offset_bottom = 88.0
grow_horizontal = 2 grow_horizontal = 2
grow_vertical = 2 grow_vertical = 2
rotation = 0.00872665 rotation = 0.00872665
theme = ExtResource("3_1x4uh")
theme_type_variation = &"card_text"
autowrap_mode = 3 autowrap_mode = 3
[node name="StickyNoteAncor" type="Node2D" parent="."] [node name="StickyNoteAncor" type="Node2D" parent="."]

View File

@ -2,6 +2,10 @@
extends Area2D extends Area2D
class_name StickyNote class_name StickyNote
var sticky_id
var parent_id
var sibling: StickyNote var sibling: StickyNote
var shift_tween: Tween var shift_tween: Tween
var modulate_tween: Tween var modulate_tween: Tween
@ -69,6 +73,11 @@ var mouse_diff: Vector2
@export_range(1.0, 10.0) var bounce_speed: float = 8 @export_range(1.0, 10.0) var bounce_speed: float = 8
var on_board: bool = false var on_board: bool = false
func _init(sticky_name: String = "card", card_id: StringName = "-1", own_id:StringName = "-1") -> void:
text = sticky_name
parent_id = card_id
sticky_id = own_id
func _ready() -> void: func _ready() -> void:
input_event.connect(_on_input_event) input_event.connect(_on_input_event)

View File

@ -8,92 +8,92 @@
radius = 48.0 radius = 48.0
height = 312.0 height = 312.0
[sub_resource type="AtlasTexture" id="AtlasTexture_260t4"] [sub_resource type="AtlasTexture" id="AtlasTexture_nj16s"]
atlas = ExtResource("2_j17jn") atlas = ExtResource("2_j17jn")
region = Rect2(0, 0, 500, 220) region = Rect2(0, 0, 500, 220)
[sub_resource type="AtlasTexture" id="AtlasTexture_1dusx"] [sub_resource type="AtlasTexture" id="AtlasTexture_23tiq"]
atlas = ExtResource("2_j17jn") atlas = ExtResource("2_j17jn")
region = Rect2(500, 0, 500, 220) region = Rect2(500, 0, 500, 220)
[sub_resource type="AtlasTexture" id="AtlasTexture_3dfo6"] [sub_resource type="AtlasTexture" id="AtlasTexture_aomh0"]
atlas = ExtResource("2_j17jn")
region = Rect2(0, 220, 500, 220)
[sub_resource type="AtlasTexture" id="AtlasTexture_ltrdw"]
atlas = ExtResource("2_j17jn")
region = Rect2(500, 220, 500, 220)
[sub_resource type="AtlasTexture" id="AtlasTexture_spwka"]
atlas = ExtResource("2_j17jn")
region = Rect2(0, 440, 500, 220)
[sub_resource type="AtlasTexture" id="AtlasTexture_62rvp"]
atlas = ExtResource("2_j17jn")
region = Rect2(500, 440, 500, 220)
[sub_resource type="AtlasTexture" id="AtlasTexture_v1axh"]
atlas = ExtResource("2_j17jn")
region = Rect2(1000, 440, 500, 220)
[sub_resource type="AtlasTexture" id="AtlasTexture_5ria3"]
atlas = ExtResource("2_j17jn")
region = Rect2(1000, 220, 500, 220)
[sub_resource type="AtlasTexture" id="AtlasTexture_7ii0f"]
atlas = ExtResource("2_j17jn") atlas = ExtResource("2_j17jn")
region = Rect2(1000, 0, 500, 220) region = Rect2(1000, 0, 500, 220)
[sub_resource type="AtlasTexture" id="AtlasTexture_7upwc"] [sub_resource type="AtlasTexture" id="AtlasTexture_n3svg"]
atlas = ExtResource("2_j17jn") atlas = ExtResource("2_j17jn")
region = Rect2(1500, 0, 500, 220) region = Rect2(1500, 0, 500, 220)
[sub_resource type="AtlasTexture" id="AtlasTexture_drssb"] [sub_resource type="AtlasTexture" id="AtlasTexture_tfg7a"]
atlas = ExtResource("2_j17jn")
region = Rect2(0, 220, 500, 220)
[sub_resource type="AtlasTexture" id="AtlasTexture_dtics"]
atlas = ExtResource("2_j17jn")
region = Rect2(500, 220, 500, 220)
[sub_resource type="AtlasTexture" id="AtlasTexture_e0ocs"]
atlas = ExtResource("2_j17jn")
region = Rect2(1000, 220, 500, 220)
[sub_resource type="AtlasTexture" id="AtlasTexture_bpwg2"]
atlas = ExtResource("2_j17jn") atlas = ExtResource("2_j17jn")
region = Rect2(1500, 220, 500, 220) region = Rect2(1500, 220, 500, 220)
[sub_resource type="AtlasTexture" id="AtlasTexture_anws8"] [sub_resource type="AtlasTexture" id="AtlasTexture_xaxol"]
atlas = ExtResource("2_j17jn")
region = Rect2(0, 440, 500, 220)
[sub_resource type="AtlasTexture" id="AtlasTexture_ifitb"]
atlas = ExtResource("2_j17jn")
region = Rect2(500, 440, 500, 220)
[sub_resource type="AtlasTexture" id="AtlasTexture_6slhe"]
atlas = ExtResource("2_j17jn")
region = Rect2(1000, 440, 500, 220)
[sub_resource type="AtlasTexture" id="AtlasTexture_4tk5m"]
atlas = ExtResource("2_j17jn") atlas = ExtResource("2_j17jn")
region = Rect2(1500, 440, 500, 220) region = Rect2(1500, 440, 500, 220)
[sub_resource type="SpriteFrames" id="SpriteFrames_5scpe"] [sub_resource type="SpriteFrames" id="SpriteFrames_2amsi"]
animations = [{ animations = [{
"frames": [{ "frames": [{
"duration": 1.0, "duration": 1.0,
"texture": SubResource("AtlasTexture_260t4") "texture": SubResource("AtlasTexture_nj16s")
}, { }, {
"duration": 1.0, "duration": 1.0,
"texture": SubResource("AtlasTexture_1dusx") "texture": SubResource("AtlasTexture_23tiq")
}, { }, {
"duration": 1.0, "duration": 1.0,
"texture": SubResource("AtlasTexture_3dfo6") "texture": SubResource("AtlasTexture_aomh0")
}, { }, {
"duration": 1.0, "duration": 1.0,
"texture": SubResource("AtlasTexture_ltrdw") "texture": SubResource("AtlasTexture_n3svg")
}, { }, {
"duration": 1.0, "duration": 1.0,
"texture": SubResource("AtlasTexture_spwka") "texture": SubResource("AtlasTexture_tfg7a")
}, { }, {
"duration": 1.0, "duration": 1.0,
"texture": SubResource("AtlasTexture_62rvp") "texture": SubResource("AtlasTexture_dtics")
}, { }, {
"duration": 1.0, "duration": 1.0,
"texture": SubResource("AtlasTexture_v1axh") "texture": SubResource("AtlasTexture_e0ocs")
}, { }, {
"duration": 1.0, "duration": 1.0,
"texture": SubResource("AtlasTexture_5ria3") "texture": SubResource("AtlasTexture_bpwg2")
}, { }, {
"duration": 1.0, "duration": 1.0,
"texture": SubResource("AtlasTexture_7ii0f") "texture": SubResource("AtlasTexture_xaxol")
}, { }, {
"duration": 1.0, "duration": 1.0,
"texture": SubResource("AtlasTexture_7upwc") "texture": SubResource("AtlasTexture_ifitb")
}, { }, {
"duration": 1.0, "duration": 1.0,
"texture": SubResource("AtlasTexture_drssb") "texture": SubResource("AtlasTexture_6slhe")
}, { }, {
"duration": 1.0, "duration": 1.0,
"texture": SubResource("AtlasTexture_anws8") "texture": SubResource("AtlasTexture_4tk5m")
}], }],
"loop": true, "loop": true,
"name": &"default", "name": &"default",
@ -115,7 +115,8 @@ shape = SubResource("CapsuleShape2D_ml4q7")
[node name="BackgroundSprite" type="AnimatedSprite2D" parent="Content"] [node name="BackgroundSprite" type="AnimatedSprite2D" parent="Content"]
position = Vector2(99.5, 0) position = Vector2(99.5, 0)
scale = Vector2(0.65, 0.65) scale = Vector2(0.65, 0.65)
sprite_frames = SubResource("SpriteFrames_5scpe") sprite_frames = SubResource("SpriteFrames_2amsi")
frame = 5
[node name="Label" type="Label" parent="Content"] [node name="Label" type="Label" parent="Content"]
anchors_preset = 8 anchors_preset = 8