From ba33997007bf63971fd6afd827903112bc96c0e7 Mon Sep 17 00:00:00 2001 From: betalars Date: Sun, 28 May 2023 12:38:46 +0200 Subject: [PATCH] cards ingest their compatible postits based on groups --- src/dev-util/board of devs.tscn | 70 +++++++++++++++++++------------- src/logic-scenes/board/card.gd | 12 +++++- src/logic-scenes/board/card.tscn | 2 - 3 files changed, 52 insertions(+), 32 deletions(-) diff --git a/src/dev-util/board of devs.tscn b/src/dev-util/board of devs.tscn index 14d1edf..6cefc7e 100644 --- a/src/dev-util/board of devs.tscn +++ b/src/dev-util/board of devs.tscn @@ -12,189 +12,203 @@ anchor_bottom = 1.0 grow_horizontal = 2 grow_vertical = 2 -[node name="c_homework" parent="." groups=["c_homework"] instance=ExtResource("1_xrckx")] +[node name="childhood" type="Control" parent="."] +anchors_preset = 0 +offset_right = 40.0 +offset_bottom = 40.0 + +[node name="c_homework" parent="childhood" instance=ExtResource("1_xrckx")] offset_left = 34.0 offset_top = 31.0 offset_right = 334.0 offset_bottom = 251.0 text = "I never put in much effort for homework " -compatible_postits = Array[Node]([null, null]) -[node name="p_good_grades" parent="c_homework" groups=["c_body", "c_boy_stuff", "c_teachers"] instance=ExtResource("2_ucudl")] +[node name="p_good_grades" parent="childhood/c_homework" groups=["c_body", "c_boy_stuff", "c_teachers"] instance=ExtResource("2_ucudl")] offset_left = 324.0 offset_top = 16.0 offset_right = 624.0 offset_bottom = 116.0 text = "but at least I get good grades." -[node name="p_upset_peers" parent="c_homework" groups=["c_Joy", "c_backlash", "c_boy_stuff", "c_comic_heroes", "c_teachers"] instance=ExtResource("2_ucudl")] +[node name="p_upset_peers" parent="childhood/c_homework" groups=["c_Joy", "c_backlash", "c_boy_stuff", "c_comic_heroes", "c_teachers"] instance=ExtResource("2_ucudl")] offset_left = 327.0 offset_top = 118.0 offset_right = 627.0 offset_bottom = 218.0 text = "and my peers were upset about that." -[node name="c_teachers" parent="." groups=["c_teachers"] instance=ExtResource("1_xrckx")] +[node name="c_teachers" parent="childhood" instance=ExtResource("1_xrckx")] offset_left = 35.0 offset_top = 261.0 offset_right = 335.0 offset_bottom = 481.0 text = "I like my teachers more than my classmates " -[node name="p_volunteering" parent="c_teachers" groups=["c_Joy", "c_backlash", "c_boy_stuff"] instance=ExtResource("2_ucudl")] +[node name="p_volunteering" parent="childhood/c_teachers" groups=["c_Joy", "c_backlash", "c_boy_stuff"] instance=ExtResource("2_ucudl")] offset_left = 318.0 offset_top = 13.0 offset_right = 618.0 offset_bottom = 113.0 text = "doing voluntary social service at my school would be great." -[node name="p_becoming_teacher" parent="c_teachers" groups=["c_Joy", "c_backlash", "c_homework"] instance=ExtResource("2_ucudl")] +[node name="p_becoming_teacher" parent="childhood/c_teachers" groups=["c_Joy", "c_backlash", "c_homework"] instance=ExtResource("2_ucudl")] offset_left = 321.0 offset_top = 115.0 offset_right = 621.0 offset_bottom = 215.0 text = "maybe I want to become a teacher." -[node name="c_Joy" parent="." groups=["c_joy"] instance=ExtResource("1_xrckx")] +[node name="c_Joy" parent="childhood" instance=ExtResource("1_xrckx")] offset_left = 40.0 offset_top = 489.0 offset_right = 340.0 offset_bottom = 709.0 text = "I can put ages into things I enjoy " -[node name="p_worried_mother" parent="c_Joy" groups=["c_body", "c_boy_stuff", "c_comic_heroes", "c_homework", "c_teachers"] instance=ExtResource("2_ucudl")] +[node name="p_worried_mother" parent="childhood/c_Joy" groups=["c_body", "c_boy_stuff", "c_comic_heroes", "c_homework", "c_teachers"] instance=ExtResource("2_ucudl")] offset_left = 320.0 offset_top = 7.0 offset_right = 620.0 offset_bottom = 107.0 text = "my mother would be worried about that" -[node name="p_thomas" parent="c_Joy" groups=["c_backlash", "c_comic_heroes", "c_homework", "c_teachers"] instance=ExtResource("2_ucudl")] +[node name="p_thomas" parent="childhood/c_Joy" groups=["c_backlash", "c_comic_heroes", "c_homework", "c_teachers"] instance=ExtResource("2_ucudl")] offset_left = 323.0 offset_top = 109.0 offset_right = 623.0 offset_bottom = 209.0 text = "Mr Thomas thinks that makes me gifted." -[node name="c_comic_heroes" parent="." groups=["c_comic_heroes"] instance=ExtResource("1_xrckx")] +[node name="voice_training" type="Control" parent="."] +anchors_preset = 0 +offset_right = 40.0 +offset_bottom = 40.0 + +[node name="c_comic_heroes" parent="voice_training" instance=ExtResource("1_xrckx")] offset_left = 685.0 offset_top = 26.0 offset_right = 985.0 offset_bottom = 246.0 text = "Comic heroes are my role models " -[node name="p_effort" parent="c_comic_heroes" groups=["c_Joy", "c_hit", "c_teachers"] instance=ExtResource("2_ucudl")] +[node name="p_effort" parent="voice_training/c_comic_heroes" groups=["c_Joy", "c_hit", "c_teachers"] instance=ExtResource("2_ucudl")] offset_left = 324.0 offset_top = 16.0 offset_right = 624.0 offset_bottom = 116.0 text = "when I put in the effort, I can make the world a better place" -[node name="p_upset_peers" parent="c_comic_heroes" groups=["c_Joy", "c_body", "c_boy_stuff", "c_hit"] instance=ExtResource("2_ucudl")] +[node name="p_upset_peers" parent="voice_training/c_comic_heroes" groups=["c_Joy", "c_body", "c_boy_stuff", "c_hit"] instance=ExtResource("2_ucudl")] offset_left = 327.0 offset_top = 118.0 offset_right = 627.0 offset_bottom = 218.0 text = "and I want to be like agent q!" -[node name="c_boy_stuff" parent="." groups=["c_comic_heroes"] instance=ExtResource("1_xrckx")] +[node name="c_boy_stuff" parent="voice_training" instance=ExtResource("1_xrckx")] offset_left = 691.0 offset_top = 270.0 offset_right = 991.0 offset_bottom = 490.0 text = "I like boy stuff" -[node name="p_slut" parent="c_boy_stuff" groups=["c_Joy", "c_body", "c_hit", "c_homework", "c_teachers"] instance=ExtResource("2_ucudl")] +[node name="p_slut" parent="voice_training/c_boy_stuff" groups=["c_Joy", "c_body", "c_hit", "c_homework", "c_teachers"] instance=ExtResource("2_ucudl")] offset_left = 318.0 offset_top = 13.0 offset_right = 618.0 offset_bottom = 113.0 text = "others think I only pretend to." -[node name="p_girls" parent="c_boy_stuff" groups=["c_Joy", "c_body", "c_comic_heroes", "c_hit", "c_homework", "c_teachers"] instance=ExtResource("2_ucudl")] +[node name="p_girls" parent="voice_training/c_boy_stuff" groups=["c_Joy", "c_body", "c_comic_heroes", "c_hit", "c_homework", "c_teachers"] instance=ExtResource("2_ucudl")] offset_left = 321.0 offset_top = 115.0 offset_right = 621.0 offset_bottom = 215.0 text = "and girls don't get that." -[node name="c_backlash" parent="." groups=["c_backlash"] instance=ExtResource("1_xrckx")] +[node name="c_backlash" parent="voice_training" instance=ExtResource("1_xrckx")] offset_left = 691.0 offset_top = 493.0 offset_right = 991.0 offset_bottom = 713.0 text = "Despite the backlash, I stood up for Jojo in front of my class" -[node name="p_cross_friend" parent="c_backlash" groups=["c_Joy", "c_boy_stuff", "c_comic_heroes", "c_hit"] instance=ExtResource("2_ucudl")] +[node name="p_cross_friend" parent="voice_training/c_backlash" groups=["c_Joy", "c_boy_stuff", "c_comic_heroes", "c_hit"] instance=ExtResource("2_ucudl")] offset_left = 320.0 offset_top = 7.0 offset_right = 620.0 offset_bottom = 107.0 text = "I would never cross a friend, even if it was for my own good." -[node name="p_reward" parent="c_backlash" groups=["c_Joy"] instance=ExtResource("2_ucudl")] +[node name="p_reward" parent="voice_training/c_backlash" groups=["c_Joy"] instance=ExtResource("2_ucudl")] offset_left = 323.0 offset_top = 109.0 offset_right = 623.0 offset_bottom = 209.0 text = "those who put in the effort should be rewarded." -[node name="c_body" parent="." groups=["c_body"] instance=ExtResource("1_xrckx")] +[node name="juijutsu" type="Control" parent="."] +anchors_preset = 0 +offset_right = 40.0 +offset_bottom = 40.0 + +[node name="c_body" parent="juijutsu" instance=ExtResource("1_xrckx")] offset_left = 1332.0 offset_top = 34.0 offset_right = 1632.0 offset_bottom = 254.0 text = "My body makes me uncomfortable " -[node name="p_boobs" parent="c_body" groups=["c_boy_stuff"] instance=ExtResource("2_ucudl")] +[node name="p_boobs" parent="juijutsu/c_body" groups=["c_boy_stuff"] instance=ExtResource("2_ucudl")] offset_left = 324.0 offset_top = 16.0 offset_right = 624.0 offset_bottom = 116.0 text = "boobs are just not made for fighting." -[node name="p_fat" parent="c_body" instance=ExtResource("2_ucudl")] +[node name="p_fat" parent="juijutsu/c_body" instance=ExtResource("2_ucudl")] offset_left = 327.0 offset_top = 118.0 offset_right = 627.0 offset_bottom = 218.0 text = "I despise all the fat on my hips." -[node name="c_hit" parent="." groups=["c_hit"] instance=ExtResource("1_xrckx")] +[node name="c_hit" parent="juijutsu" instance=ExtResource("1_xrckx")] offset_left = 1338.0 offset_top = 278.0 offset_right = 1638.0 offset_bottom = 498.0 text = "I know how to properly hit people " -[node name="p_confidence" parent="c_hit" groups=["c_Joy", "c_backlash", "c_boy_stuff", "c_comic_heroes", "c_homework"] instance=ExtResource("2_ucudl")] +[node name="p_confidence" parent="juijutsu/c_hit" groups=["c_Joy", "c_backlash", "c_boy_stuff", "c_comic_heroes", "c_homework"] instance=ExtResource("2_ucudl")] offset_left = 318.0 offset_top = 13.0 offset_right = 618.0 offset_bottom = 113.0 text = "..., that gives me a lot of confidence." -[node name="p_vent" parent="c_hit" groups=["c_Joy", "c_backlash", "c_boy_stuff", "c_comic_heroes", "c_homework", "c_teachers"] instance=ExtResource("2_ucudl")] +[node name="p_vent" parent="juijutsu/c_hit" groups=["c_Joy", "c_backlash", "c_boy_stuff", "c_comic_heroes", "c_homework", "c_teachers"] instance=ExtResource("2_ucudl")] offset_left = 321.0 offset_top = 115.0 offset_right = 621.0 offset_bottom = 215.0 text = "and that’s a great vent." -[node name="c_void" parent="." groups=["c_void"] instance=ExtResource("3_10nsr")] +[node name="c_void" parent="juijutsu" instance=ExtResource("3_10nsr")] offset_left = 1338.0 offset_top = 501.0 offset_right = 1638.0 offset_bottom = 721.0 -[node name="p_wet" parent="c_void" groups=["c_void"] instance=ExtResource("2_ucudl")] +[node name="p_wet" parent="juijutsu/c_void" groups=["c_void"] instance=ExtResource("2_ucudl")] offset_left = 320.0 offset_top = 7.0 offset_right = 620.0 offset_bottom = 107.0 text = "… I was wet, so I must have been into it." -[node name="p_stop" parent="c_void" groups=["c_void"] instance=ExtResource("2_ucudl")] +[node name="p_stop" parent="juijutsu/c_void" groups=["c_void"] instance=ExtResource("2_ucudl")] offset_left = 323.0 offset_top = 109.0 offset_right = 623.0 diff --git a/src/logic-scenes/board/card.gd b/src/logic-scenes/board/card.gd index 1fcc2e0..5e73e61 100644 --- a/src/logic-scenes/board/card.gd +++ b/src/logic-scenes/board/card.gd @@ -13,9 +13,17 @@ var own_postits: Array[PostIt] = [] @export var voice_line: AudioStream = null func _ready(): + print(own_postits) + print(get_children()) if not Engine.is_editor_hint() and is_inside_tree(): - for postit in self.get_children(false): - self.own_postits.append(postit as PostIt) + for postit in self.get_children(): + if postit is PostIt: self.own_postits.append(postit as PostIt) + + for postit in get_tree().get_nodes_in_group(name): + if postit is PostIt: self.compatible_postits.append(postit as PostIt) + + compatible_postits.append_array(own_postits) + $BackgroundSprite.frame = randi() % $BackgroundSprite.sprite_frames.get_frame_count($BackgroundSprite.animation) $Label.text = self.text diff --git a/src/logic-scenes/board/card.tscn b/src/logic-scenes/board/card.tscn index 349c676..9c165a8 100644 --- a/src/logic-scenes/board/card.tscn +++ b/src/logic-scenes/board/card.tscn @@ -56,13 +56,11 @@ offset_right = 150.0 offset_bottom = 110.0 focus_mode = 2 script = ExtResource("1_emip0") -compatible_postits = Array[Resource("res://logic-scenes/board/post-it.gd")]([null, null, null]) [node name="BackgroundSprite" type="AnimatedSprite2D" parent="."] position = Vector2(150, 110) scale = Vector2(0.6, 0.6) sprite_frames = SubResource("SpriteFrames_ckivt") -frame = 3 [node name="Label" type="Label" parent="."] layout_mode = 1