Merge branch 'adi_dev' into 'main'

finalising card board for alpha release

See merge request betalars/frame-of-mind!2
This commit is contained in:
betalars 2023-07-15 13:06:07 +00:00
commit 7404c172bd
10 changed files with 228 additions and 166 deletions

View File

@ -1,14 +1,8 @@
[gd_scene load_steps=4 format=3 uid="uid://bvowj4l8dtceu"] [gd_scene load_steps=3 format=3 uid="uid://bvowj4l8dtceu"]
[ext_resource type="PackedScene" uid="uid://dy5rd437h5hsw" path="res://logic-scenes/board/card.tscn" id="1_xrckx"] [ext_resource type="PackedScene" uid="uid://dy5rd437h5hsw" path="res://logic-scenes/board/card.tscn" id="1_xrckx"]
[ext_resource type="PackedScene" uid="uid://vkcdj8c3ytbq" path="res://logic-scenes/board/post-it.tscn" id="2_ucudl"] [ext_resource type="PackedScene" uid="uid://vkcdj8c3ytbq" path="res://logic-scenes/board/post-it.tscn" id="2_ucudl"]
[sub_resource type="GDScript" id="GDScript_cr445"]
script/source = "extends Control
var has_stage: bool = false
"
[node name="board of devs" type="Control"] [node name="board of devs" type="Control"]
layout_mode = 3 layout_mode = 3
anchors_preset = 15 anchors_preset = 15
@ -16,7 +10,6 @@ anchor_right = 1.0
anchor_bottom = 1.0 anchor_bottom = 1.0
grow_horizontal = 2 grow_horizontal = 2
grow_vertical = 2 grow_vertical = 2
script = SubResource("GDScript_cr445")
[node name="childhood" type="Control" parent="."] [node name="childhood" type="Control" parent="."]
anchors_preset = 0 anchors_preset = 0
@ -27,47 +20,41 @@ offset_bottom = 181.0
[node name="c_homework" parent="childhood" instance=ExtResource("1_xrckx")] [node name="c_homework" parent="childhood" instance=ExtResource("1_xrckx")]
text = "I never put in much effort for homework " text = "I never put in much effort for homework "
metadata/type = "card" bounce_speed = 5.0
[node name="p_good_grades" parent="childhood/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")]
position = Vector2(-32, 50) position = Vector2(-32, 50)
text = "but at least I get good grades." text = "but at least I get good grades."
metadata/type = "post-it"
[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")] [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")]
position = Vector2(-32, 140) position = Vector2(-32, 140)
text = "and my peers were upset about that." text = "and my peers were upset about that."
metadata/type = "post-it"
[node name="c_teachers" parent="childhood" instance=ExtResource("1_xrckx")] [node name="c_teachers" parent="childhood" instance=ExtResource("1_xrckx")]
position = Vector2(0, 300) position = Vector2(0, 300)
text = "I like my teachers more than my classmates " text = "I like my teachers more than my classmates "
metadata/type = "card" bounce_speed = 5.0
[node name="p_volunteering" parent="childhood/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")]
position = Vector2(-32, 50) position = Vector2(-32, 50)
text = "doing voluntary social service at my school would be great." text = "doing voluntary social service at my school would be great."
metadata/type = "post-it"
[node name="p_becoming_teacher" parent="childhood/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")]
position = Vector2(-32, 140) position = Vector2(-32, 140)
text = "maybe I want to become a teacher." text = "maybe I want to become a teacher."
metadata/type = "post-it"
[node name="c_Joy" parent="childhood" instance=ExtResource("1_xrckx")] [node name="c_Joy" parent="childhood" instance=ExtResource("1_xrckx")]
position = Vector2(0, 600) position = Vector2(0, 600)
text = "I can put ages into things I enjoy " text = "I can put ages into things I enjoy "
metadata/type = "card" bounce_speed = 5.0
[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")] [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")]
position = Vector2(-32, 50) position = Vector2(-32, 50)
text = "my mother would be worried about that" text = "my mother would be worried about that"
metadata/type = "post-it"
[node name="p_thomas" parent="childhood/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")]
position = Vector2(-32, 140) position = Vector2(-32, 140)
text = "Mr Thomas thinks that makes me gifted." text = "Mr Thomas thinks that makes me gifted."
metadata/type = "post-it"
[node name="voice_training" type="Control" parent="."] [node name="voice_training" type="Control" parent="."]
anchors_preset = 0 anchors_preset = 0
@ -78,47 +65,41 @@ offset_bottom = 141.0
[node name="c_comic_heroes" parent="voice_training" instance=ExtResource("1_xrckx")] [node name="c_comic_heroes" parent="voice_training" instance=ExtResource("1_xrckx")]
text = "Comic heroes are my role models " text = "Comic heroes are my role models "
metadata/type = "card" bounce_speed = 5.0
[node name="p_effort" parent="voice_training/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")]
position = Vector2(-32, 50) position = Vector2(-32, 50)
text = "when I put in the effort, I can make the world a better place" text = "when I put in the effort, I can make the world a better place"
metadata/type = "post-it"
[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")] [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")]
position = Vector2(-32, 140) position = Vector2(-32, 140)
text = "and I want to be like agent q!" text = "and I want to be like agent q!"
metadata/type = "post-it"
[node name="c_boy_stuff" parent="voice_training" instance=ExtResource("1_xrckx")] [node name="c_boy_stuff" parent="voice_training" instance=ExtResource("1_xrckx")]
position = Vector2(0, 300) position = Vector2(0, 300)
text = "I like boy stuff " text = "I like boy stuff "
metadata/type = "card" bounce_speed = 5.0
[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")] [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")]
position = Vector2(-32, 50) position = Vector2(-32, 50)
text = "others think I only pretend to." text = "others think I only pretend to."
metadata/type = "post-it"
[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")] [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")]
position = Vector2(-32, 140) position = Vector2(-32, 140)
text = "and girls don't get that." text = "and girls don't get that."
metadata/type = "post-it"
[node name="c_backlash" parent="voice_training" instance=ExtResource("1_xrckx")] [node name="c_backlash" parent="voice_training" instance=ExtResource("1_xrckx")]
position = Vector2(0, 600) position = Vector2(0, 600)
text = "Despite the backlash, I protected Joyo in front of class " text = "Despite the backlash, I protected Joyo in front of class "
metadata/type = "card" bounce_speed = 5.0
[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")] [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")]
position = Vector2(-32, 50) position = Vector2(-32, 50)
text = "I would never cross a friend, even if it was for my own good." text = "I would never cross a friend, even if it was for my own good."
metadata/type = "post-it"
[node name="p_reward" parent="voice_training/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")]
position = Vector2(-32, 140) position = Vector2(-32, 140)
text = "those who put in the effort should be rewarded." text = "those who put in the effort should be rewarded."
metadata/type = "post-it"
[node name="juijutsu" type="Control" parent="."] [node name="juijutsu" type="Control" parent="."]
anchors_preset = 0 anchors_preset = 0
@ -129,46 +110,40 @@ offset_bottom = 141.0
[node name="c_body" parent="juijutsu" instance=ExtResource("1_xrckx")] [node name="c_body" parent="juijutsu" instance=ExtResource("1_xrckx")]
text = "my body makes me uncomfortable " text = "my body makes me uncomfortable "
metadata/type = "card" bounce_speed = 5.0
[node name="p_boobs" parent="juijutsu/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")]
position = Vector2(-32, 50) position = Vector2(-32, 50)
text = "boobs are just not made for fighting." text = "boobs are just not made for fighting."
metadata/type = "post-it"
[node name="p_fat" parent="juijutsu/c_body" instance=ExtResource("2_ucudl")] [node name="p_fat" parent="juijutsu/c_body" instance=ExtResource("2_ucudl")]
position = Vector2(-32, 140) position = Vector2(-32, 140)
text = "I despise all the fat on my hips." text = "I despise all the fat on my hips."
metadata/type = "post-it"
[node name="c_hit" parent="juijutsu" instance=ExtResource("1_xrckx")] [node name="c_hit" parent="juijutsu" instance=ExtResource("1_xrckx")]
position = Vector2(0, 300) position = Vector2(0, 300)
text = "I know how to properly hit people " text = "I know how to properly hit people "
metadata/type = "card" bounce_speed = 5.0
[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")] [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")]
position = Vector2(-32, 50) position = Vector2(-32, 50)
text = "..., that gives me a lot of confidence." text = "..., that gives me a lot of confidence."
metadata/type = "post-it"
[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")] [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")]
position = Vector2(-32, 140) position = Vector2(-32, 140)
text = "and thats a great vent." text = "and thats a great vent."
metadata/type = "post-it"
[node name="c_void" parent="juijutsu" instance=ExtResource("1_xrckx")] [node name="c_void" parent="juijutsu" instance=ExtResource("1_xrckx")]
position = Vector2(0, 600) position = Vector2(0, 600)
metadata/type = "card" bounce_speed = 5.0
[node name="p_wet" parent="juijutsu/c_void" groups=["c_void"] instance=ExtResource("2_ucudl")] [node name="p_wet" parent="juijutsu/c_void" groups=["c_void"] instance=ExtResource("2_ucudl")]
position = Vector2(-32, 50) position = Vector2(-32, 50)
text = "… I was wet, so I must have been into it." text = "… I was wet, so I must have been into it."
metadata/type = "post-it"
[node name="p_stop" parent="juijutsu/c_void" groups=["c_void"] instance=ExtResource("2_ucudl")] [node name="p_stop" parent="juijutsu/c_void" groups=["c_void"] instance=ExtResource("2_ucudl")]
position = Vector2(-32, 140) position = Vector2(-32, 140)
text = "… I didnt say stop." text = "… I didnt say stop."
metadata/type = "post-it"
[node name="test" type="Control" parent="."] [node name="test" type="Control" parent="."]
anchors_preset = 0 anchors_preset = 0
@ -178,42 +153,36 @@ offset_right = 1274.0
offset_bottom = 181.0 offset_bottom = 181.0
[node name="c_random1" parent="test" instance=ExtResource("1_xrckx")] [node name="c_random1" parent="test" instance=ExtResource("1_xrckx")]
metadata/type = "card" bounce_speed = 5.0
[node name="p_random11" parent="test/c_random1" groups=["c_boy_stuff"] instance=ExtResource("2_ucudl")] [node name="p_random11" parent="test/c_random1" groups=["c_boy_stuff"] instance=ExtResource("2_ucudl")]
position = Vector2(-32, 50) position = Vector2(-32, 50)
text = "random 1" text = "random 1"
metadata/type = "post-it"
[node name="p_random12" parent="test/c_random1" instance=ExtResource("2_ucudl")] [node name="p_random12" parent="test/c_random1" instance=ExtResource("2_ucudl")]
position = Vector2(-32, 140) position = Vector2(-32, 140)
text = "random 1" text = "random 1"
metadata/type = "post-it"
[node name="c_pick" parent="test" instance=ExtResource("1_xrckx")] [node name="c_pick" parent="test" instance=ExtResource("1_xrckx")]
position = Vector2(0, 300) position = Vector2(0, 300)
metadata/type = "card" bounce_speed = 5.0
[node name="p_pick" parent="test/c_pick" groups=["c_Joy", "c_backlash", "c_boy_stuff", "c_comic_heroes", "c_homework"] instance=ExtResource("2_ucudl")] [node name="p_pick" parent="test/c_pick" groups=["c_Joy", "c_backlash", "c_boy_stuff", "c_comic_heroes", "c_homework"] instance=ExtResource("2_ucudl")]
position = Vector2(-32, 50) position = Vector2(-32, 50)
text = "pick me 2" text = "pick me 2"
metadata/type = "post-it"
[node name="p_goof" parent="test/c_pick" groups=["c_Joy", "c_backlash", "c_boy_stuff", "c_comic_heroes", "c_homework", "c_teachers"] instance=ExtResource("2_ucudl")] [node name="p_goof" parent="test/c_pick" groups=["c_Joy", "c_backlash", "c_boy_stuff", "c_comic_heroes", "c_homework", "c_teachers"] instance=ExtResource("2_ucudl")]
position = Vector2(-32, 140) position = Vector2(-32, 140)
text = "you done goofed" text = "you done goofed"
metadata/type = "post-it"
[node name="c_random2" parent="test" instance=ExtResource("1_xrckx")] [node name="c_random2" parent="test" instance=ExtResource("1_xrckx")]
position = Vector2(0, 600) position = Vector2(0, 600)
metadata/type = "card" bounce_speed = 5.0
[node name="p_random21" parent="test/c_random2" groups=["c_void"] instance=ExtResource("2_ucudl")] [node name="p_random21" parent="test/c_random2" groups=["c_void"] instance=ExtResource("2_ucudl")]
position = Vector2(-32, 50) position = Vector2(-32, 50)
text = "random 2" text = "random 2"
metadata/type = "post-it"
[node name="p_random22" parent="test/c_random2" groups=["c_void"] instance=ExtResource("2_ucudl")] [node name="p_random22" parent="test/c_random2" groups=["c_void"] instance=ExtResource("2_ucudl")]
position = Vector2(-32, 140) position = Vector2(-32, 140)
text = "random 2" text = "random 2"
metadata/type = "post-it"

View File

@ -0,0 +1,6 @@
class_name CardCollider
extends Area2D
var is_dragged: bool = false
@export var direction: Vector2 = Vector2.ZERO

View File

@ -1,6 +1,11 @@
extends PanelContainer extends PanelContainer
var area_dict = {} var area_dict = {
"dropzone_content": [],
"cards": [],
"post_its_in_list": [],
"post_it_panels": []
}
enum ui_context {DROPZONE, POST_IT_LIST, ASSIGN_POST_IT} enum ui_context {DROPZONE, POST_IT_LIST, ASSIGN_POST_IT}
var has_stage = false: var has_stage = false:
@ -12,15 +17,16 @@ var has_stage = false:
has_stage = false has_stage = false
self.mouse_filter = Control.MOUSE_FILTER_IGNORE self.mouse_filter = Control.MOUSE_FILTER_IGNORE
if is_node_ready(): if is_node_ready():
#fixme: thie should be replaced by a reference that holds all children ... for child in area_dict["dropzone_content"]+area_dict["post_its_in_list"]:
for child in dropzone.get_children(): if focus:
child.on_stage = has_stage child.process_mode = Node.PROCESS_MODE_INHERIT
for child in postit_container.get_children(): else:
child.get_child(1).on_stage = has_stage child.process_mode = Node.PROCESS_MODE_DISABLED
@onready var dropzone = $HBoxContainer/dropzone @onready var dropzone = $HBoxContainer/dropzone
@onready var postit_container = $HBoxContainer/ScrollContainer/VBoxContainer @onready var postit_container = $HBoxContainer/ScrollContainer/VBoxContainer
@onready var board_of_devs = $"board of devs" @onready var board_of_devs = $"board of devs"
@onready var base_postit_panel = $HBoxContainer/ScrollContainer/VBoxContainer/Panel
@onready var active_context = ui_context.DROPZONE # 0 = dropzone, 1 = post it list @onready var active_context = ui_context.DROPZONE # 0 = dropzone, 1 = post it list
var currently_selected_node: Area2D = null var currently_selected_node: Area2D = null
@ -35,10 +41,11 @@ var selected_card_for_assignment
# Called when the node enters the scene tree for the first time. # Called when the node enters the scene tree for the first time.
func _ready(): func _ready():
var test_arr = ["c_Joy","p_effort","c_backlash","c_body","c_hit","p_slut","p_worried_mother","p_cross_friend"] #var test_arr = ["c_Joy","p_effort","c_backlash","c_body","c_hit","p_slut","p_worried_mother","p_cross_friend"]
#var test_arr = ["c_Joy","c_body","c_hit"]
populate_board(test_arr) #populate_board(test_arr)
reorder_areas("dropzone_content") #reorder_areas("dropzone_content")
active_context = ui_context.DROPZONE active_context = ui_context.DROPZONE
has_stage = has_stage has_stage = has_stage
@ -52,18 +59,30 @@ func _process(delta):
is_area_dragged = false is_area_dragged = false
currently_dragged_area = null currently_dragged_area = null
# we should maybe consider moving this to _input() for consistency
if Input.is_action_just_pressed("ui_cancel"):
populate_board(["c_Joy","p_effort","c_backlash","c_body","c_hit","p_slut","p_worried_mother","p_cross_friend"])
# Will be used later to spawn Cards and Post-Its and remember them in the dictionary # Will be used later to spawn Cards and Post-Its and remember them in the dictionary
func populate_board(card_names: Array): func populate_board(card_names: Array):
var all_cards = Array() var all_cards = Array()
var all_postits = Array() var all_postits = Array()
# define entries in dictionary
area_dict["dropzone_content"] = Array()
area_dict["post_its_in_list"] = Array()
# to remember panel positions # to remember panel positions
area_dict["post_it_panels"] = get_child(0).get_child(1).get_child(0).get_children() area_dict["post_it_panels"] = [base_postit_panel]
# check how many post-it panels we need
var amount = -1 # starting with -1 to compensate for the base panel
for card_name in card_names:
if "p_" in card_name:
amount += 1
while amount > 0: # creating panels up to the number of post-its
var new_panel = base_postit_panel.duplicate()
postit_container.add_child(new_panel)
new_panel.set_owner(self)
area_dict["post_it_panels"].push_back(new_panel)
amount -= 1
# get all the cards and post-its from the board of devs # get all the cards and post-its from the board of devs
for child in board_of_devs.get_children(): for child in board_of_devs.get_children():
@ -80,10 +99,12 @@ func populate_board(card_names: Array):
for child in new_card.get_children(): # We need to clear all the post-its from the cards on the dev-board for child in new_card.get_children(): # We need to clear all the post-its from the cards on the dev-board
if "p_" in child.name: if "p_" in child.name:
new_card.remove_child(child) # dev-board has post-its attached to the cards, which need to be removed new_card.remove_child(child) # dev-board has post-its attached to the cards, which need to be removed
new_card.position = Vector2(randi_range(0, dropzone.size.x), randi_range(0, dropzone.size.y))
dropzone.add_child(new_card) dropzone.add_child(new_card)
new_card.set_owner(self) new_card.set_owner(self)
area_dict["dropzone_content"].push_back(new_card) area_dict["dropzone_content"].push_back(new_card)
new_card.global_position = Vector2(300, 200) # using hard-coded position because I'm lazy area_dict["cards"].push_back(new_card)
#new_card.position = Vector2(randf_range(new_card.diameter, dropzone.size.x), randf_range(new_card.diameter, dropzone.size.y)) - Vector2(new_card.diameter/2, new_card.diameter/2)
new_card.is_dragable = true new_card.is_dragable = true
if "p_" in card_name: # spawning a post-it if "p_" in card_name: # spawning a post-it
var new_postit = _find_area_by_string(all_postits, card_name).duplicate() var new_postit = _find_area_by_string(all_postits, card_name).duplicate()
@ -98,6 +119,11 @@ func populate_board(card_names: Array):
currently_selected_node = area_dict["dropzone_content"][0] # set first Card as currently selected node by default currently_selected_node = area_dict["dropzone_content"][0] # set first Card as currently selected node by default
reorder_areas("dropzone_content")
reorder_areas("cards")
reorder_areas("post_its_in_list")
# Handy function to filter an array of areas by the name of a card # Handy function to filter an array of areas by the name of a card
func _find_area_by_string(area_arr: Array, name: String) -> Area2D: func _find_area_by_string(area_arr: Array, name: String) -> Area2D:
for area in area_arr: for area in area_arr:
@ -135,7 +161,9 @@ func handle_mouse_button(to_handle: Area2D, input: InputEvent):
active_context = ui_context.DROPZONE active_context = ui_context.DROPZONE
if input.is_pressed(): if input.is_pressed():
reorder_areas("dropzone_content") reorder_areas("dropzone_content")
reorder_areas("cards")
else: else:
dropzone.move_child(currently_dragged_area, -1)
currently_dragged_area = null currently_dragged_area = null
"post-it": # 2 = PostIt "post-it": # 2 = PostIt
if input.is_pressed(): if input.is_pressed():
@ -162,6 +190,8 @@ func handle_mouse_button(to_handle: Area2D, input: InputEvent):
# Logic for attaching a postit to a card. Also reset postit positions if the card cannot be attached # Logic for attaching a postit to a card. Also reset postit positions if the card cannot be attached
func attach_postit_to_card(postit: Area2D, card: Area2D, update_dict = false): func attach_postit_to_card(postit: Area2D, card: Area2D, update_dict = false):
if card.has_postit_attached(): return # don't attach if card has already a post-it attached
postit.reparent(card) postit.reparent(card)
postit.set_owner(self) postit.set_owner(self)
postit.position = card.get_child(3).position postit.position = card.get_child(3).position
@ -171,6 +201,7 @@ func attach_postit_to_card(postit: Area2D, card: Area2D, update_dict = false):
area_dict["dropzone_content"].push_back(postit) area_dict["dropzone_content"].push_back(postit)
reorder_areas("dropzone_content") reorder_areas("dropzone_content")
reorder_areas("cards")
reorder_areas("post_its_in_list") reorder_areas("post_its_in_list")
@ -198,15 +229,17 @@ func reorder_areas(reorder: String):
var i = 0 var i = 0
if !new_order.is_empty(): if !new_order.is_empty():
for obj_2 in new_order: for obj_2 in new_order:
if obj_2.position.y < obj.position.y: if obj_2.global_position.y < obj.global_position.y:
i += 1 i += 1
new_order.insert(i, obj) new_order.insert(i, obj)
area_dict[reorder] = new_order
# Takes the inputs for control inputs # Takes the inputs for control inputs
func _input(event): func _input(event):
# Return, if the input is a mouse event (mouse events are handled separately) # Return, if the input is a mouse event (mouse events are handled separately)
if event is InputEventMouse or !has_stage: return if event is InputEventMouse or !has_stage or not is_instance_valid(currently_selected_node): return
if event.is_action_pressed("ui_up"): # up to select an element above if event.is_action_pressed("ui_up"): # up to select an element above
match active_context: match active_context:
@ -228,15 +261,15 @@ func _input(event):
elif event.is_action_pressed("ui_left"): # left to switch context to the left elif event.is_action_pressed("ui_left"): # left to switch context to the left
active_context -= 1 active_context -= 1
if active_context < 0: if active_context < -1:
active_context = ui_context.POST_IT_LIST active_context = ui_context.POST_IT_LIST
elif event.is_action_pressed("ui_right"): # right to switch context to the right elif event.is_action_pressed("ui_right"): # right to switch context to the right
active_context += 1 active_context += 1
if active_context > 2: if active_context > 1:
active_context = ui_context.DROPZONE active_context = ui_context.DROPZONE
elif event.is_action_pressed("ui_select"): # select the selected post it elif event.is_action_pressed("ui_accept"): # select the selected post it
if active_context == ui_context.ASSIGN_POST_IT: # to assign it to a card if active_context == ui_context.ASSIGN_POST_IT: # to assign it to a card
attach_postit_to_card(currently_selected_node, attach_postit_to_card(currently_selected_node,
currently_selected_card_for_assigning, true) currently_selected_card_for_assigning, true)
@ -259,8 +292,8 @@ func _input(event):
if active_context == ui_context.ASSIGN_POST_IT: # skip this if we're not in assign post it context if active_context == ui_context.ASSIGN_POST_IT: # skip this if we're not in assign post it context
if selected_card_for_assignment < 0: if selected_card_for_assignment < 0:
selected_card_for_assignment = area_dict["dropzone_content"].size()-1 selected_card_for_assignment = area_dict["cards"].size()-1
elif selected_card_for_assignment > area_dict["dropzone_content"].size()-1: elif selected_card_for_assignment > area_dict["cards"].size()-1:
selected_card_for_assignment = 0 selected_card_for_assignment = 0
# highlight the selected element # highlight the selected element
@ -275,7 +308,7 @@ func _input(event):
currently_selected_node.highlighted = true currently_selected_node.highlighted = true
ui_context.ASSIGN_POST_IT: ui_context.ASSIGN_POST_IT:
currently_selected_card_for_assigning.highlighted = false currently_selected_card_for_assigning.highlighted = false
currently_selected_card_for_assigning = area_dict["dropzone_content"][selected_card_for_assignment] currently_selected_card_for_assigning = area_dict["cards"][selected_card_for_assignment]
currently_selected_card_for_assigning.highlighted = true currently_selected_card_for_assigning.highlighted = true
# update dictiornary orders # update dictiornary orders

View File

@ -10,8 +10,6 @@ var noise: Noise = FastNoiseLite.new()
var wiggle_tween var wiggle_tween
var scale_tween var scale_tween
var on_stage = false
@export var text: String = "" : @export var text: String = "" :
set(value): set(value):
text = value text = value
@ -26,6 +24,7 @@ var on_stage = false
@export var wiggle_strength: float = 0.2 @export var wiggle_strength: float = 0.2
@export var wiggle_speed: float = 5 @export var wiggle_speed: float = 5
@export_range(1, 2) var scale_bump: float = 1.05 @export_range(1, 2) var scale_bump: float = 1.05
@export_range(1.0, 10.0) var bounce_speed: float = 5
@export var highlighted: bool = false: @export var highlighted: bool = false:
set(highlight): set(highlight):
if highlight != highlighted: if highlight != highlighted:
@ -54,7 +53,15 @@ var on_stage = false
@export var voice_line: AudioStream = null @export var voice_line: AudioStream = null
@export var is_dragable: bool = false @export var is_dragable: bool = false
var is_dragged: bool = false @onready var diameter = $CollisionShape2D.shape.height
var is_dragged: bool = false:
set(dragged):
is_dragged = dragged
z_index = int(dragged)
var is_mouse_entered: bool = false
var mouse_offset: Vector2
func _ready(): func _ready():
@ -83,10 +90,18 @@ func _ready():
_handle_wiggle(0) _handle_wiggle(0)
func _process(delta: float) -> void: func _process(delta: float) -> void:
if self.on_stage:
if highlighted: if highlighted:
_handle_wiggle(delta) _handle_wiggle(delta)
if get_overlapping_areas().size() > 0:
for area in get_overlapping_areas():
if area is Card or area is CardCollider:
if area is CardCollider:
position += area.direction * delta
elif not area.highlighted:
var diff:Vector2 = position - area.position
position -= diff.normalized() * ((diff.length()-diameter)/diameter) * bounce_speed * (delta/(1.0/60))
_move_card() _move_card()
func _handle_wiggle(delta): func _handle_wiggle(delta):
@ -107,29 +122,33 @@ func _on_focus_exited():
print(self, "is not focused") print(self, "is not focused")
func _on_mouse_entered(): func _on_mouse_entered():
if self.on_stage: is_mouse_entered = true
if not Input.is_action_pressed("mouse_left"): if not Input.is_action_pressed("mouse_left"):
if has_postit_attached():
if get_child(-1).highlighted:
return
highlighted = true highlighted = true
if "handle_hover" in owner: if "handle_hover" in owner:
owner.handle_hover(self) owner.handle_hover(self)
func _on_mouse_exited(): func _on_mouse_exited():
if self.on_stage:
highlighted = false highlighted = false
is_mouse_entered = false
func _on_input_event(viewport, event, shape_idx): func _on_input_event(viewport, event, shape_idx):
if self.on_stage:
if event is InputEventMouseMotion: if event is InputEventMouseMotion:
_move_card() _move_card()
if event is InputEventMouseButton: if event is InputEventMouseButton:
if event.button_index == MOUSE_BUTTON_LEFT: if event.button_index == MOUSE_BUTTON_LEFT:
if is_dragable and "handle_mouse_button" in owner: if is_dragable and "handle_mouse_button" in owner:
owner.handle_mouse_button(self, event) mouse_offset = (get_viewport().get_mouse_position() - position)
if highlighted: owner.handle_mouse_button(self, event)
func _move_card(): func _move_card():
if is_dragged: if is_dragged:
position += get_viewport().get_mouse_position() - position position += (get_viewport().get_mouse_position() - position) - mouse_offset
func has_postit_attached() -> bool: func has_postit_attached() -> bool:
var all_children = get_children() var all_children = get_children()
@ -137,3 +156,7 @@ func has_postit_attached() -> bool:
if child.get_meta("type") == "post-it": if child.get_meta("type") == "post-it":
return true return true
return false return false
func check_hover():
if is_mouse_entered:
_on_mouse_entered()

View File

@ -147,6 +147,8 @@ func _process(_delta):
[node name="card" type="Area2D"] [node name="card" type="Area2D"]
script = ExtResource("1_emip0") script = ExtResource("1_emip0")
bounce_speed = null
metadata/type = "card"
[node name="CollisionShape2D" type="CollisionShape2D" parent="."] [node name="CollisionShape2D" type="CollisionShape2D" parent="."]
position = Vector2(-0.0713516, 0.997451) position = Vector2(-0.0713516, 0.997451)

View File

@ -1,17 +1,23 @@
[gd_scene load_steps=8 format=3 uid="uid://bnskiyx1sksww"] [gd_scene load_steps=10 format=3 uid="uid://bnskiyx1sksww"]
[ext_resource type="Texture2D" uid="uid://bi3xqdknw5tpe" path="res://logic-scenes/board/board-texture/Cork002_2K_Color.png" id="1_8brxc"] [ext_resource type="Texture2D" uid="uid://bi3xqdknw5tpe" path="res://logic-scenes/board/board-texture/Cork002_2K_Color.png" id="1_8brxc"]
[ext_resource type="Shader" path="res://logic-scenes/board/physics-board.gdshader" id="1_ggnth"] [ext_resource type="Shader" path="res://logic-scenes/board/physics-board.gdshader" id="1_ggnth"]
[ext_resource type="Script" path="res://logic-scenes/board/card-board.gd" id="3_8v4c4"] [ext_resource type="Script" path="res://logic-scenes/board/card-board.gd" id="3_8v4c4"]
[ext_resource type="PackedScene" uid="uid://dy5rd437h5hsw" path="res://logic-scenes/board/card.tscn" id="3_mg053"] [ext_resource type="PackedScene" uid="uid://dy5rd437h5hsw" path="res://logic-scenes/board/card.tscn" id="3_mg053"]
[ext_resource type="PackedScene" uid="uid://bvowj4l8dtceu" path="res://dev-util/board of devs.tscn" id="4_sskx2"] [ext_resource type="PackedScene" uid="uid://bvowj4l8dtceu" path="res://dev-util/board of devs.tscn" id="4_sskx2"]
[ext_resource type="PackedScene" uid="uid://vkcdj8c3ytbq" path="res://logic-scenes/board/post-it.tscn" id="5_048k0"] [ext_resource type="Script" path="res://logic-scenes/board/card collider.gd" id="6_wpxls"]
[sub_resource type="ShaderMaterial" id="ShaderMaterial_ttqei"] [sub_resource type="ShaderMaterial" id="ShaderMaterial_ttqei"]
shader = ExtResource("1_ggnth") shader = ExtResource("1_ggnth")
shader_parameter/magic_scale_factor = 1500.0 shader_parameter/magic_scale_factor = 1500.0
shader_parameter/tex = ExtResource("1_8brxc") shader_parameter/tex = ExtResource("1_8brxc")
[sub_resource type="RectangleShape2D" id="RectangleShape2D_ivo5o"]
size = Vector2(4249, 766.5)
[sub_resource type="RectangleShape2D" id="RectangleShape2D_5ri3m"]
size = Vector2(4262, 766.5)
[node name="board" type="PanelContainer"] [node name="board" type="PanelContainer"]
material = SubResource("ShaderMaterial_ttqei") material = SubResource("ShaderMaterial_ttqei")
clip_contents = true clip_contents = true
@ -35,16 +41,18 @@ size_flags_horizontal = 3
mouse_filter = 1 mouse_filter = 1
[node name="card3" parent="HBoxContainer/dropzone" instance=ExtResource("3_mg053")] [node name="card3" parent="HBoxContainer/dropzone" instance=ExtResource("3_mg053")]
process_mode = 4
visible = false
z_as_relative = false z_as_relative = false
position = Vector2(371, 290) position = Vector2(371, 290)
collision_layer = 2147483649 collision_layer = 2147483649
is_dragable = true is_dragable = true
metadata/type = "card"
[node name="card" parent="HBoxContainer/dropzone" instance=ExtResource("3_mg053")] [node name="card" parent="HBoxContainer/dropzone" instance=ExtResource("3_mg053")]
process_mode = 4
visible = false
position = Vector2(640, 659) position = Vector2(640, 659)
is_dragable = true is_dragable = true
metadata/type = "card"
[node name="ScrollContainer" type="ScrollContainer" parent="HBoxContainer"] [node name="ScrollContainer" type="ScrollContainer" parent="HBoxContainer"]
layout_mode = 2 layout_mode = 2
@ -62,54 +70,70 @@ mouse_filter = 1
[node name="post-it_anchor1" type="Node2D" parent="HBoxContainer/ScrollContainer/VBoxContainer/Panel"] [node name="post-it_anchor1" type="Node2D" parent="HBoxContainer/ScrollContainer/VBoxContainer/Panel"]
position = Vector2(105, 57) position = Vector2(105, 57)
[node name="post-it" parent="HBoxContainer/ScrollContainer/VBoxContainer/Panel" instance=ExtResource("5_048k0")]
z_index = 1
position = Vector2(105, 57)
is_dragable = true
metadata/type = "post-it"
[node name="Panel2" type="Panel" parent="HBoxContainer/ScrollContainer/VBoxContainer"]
self_modulate = Color(1, 1, 1, 0)
custom_minimum_size = Vector2(400, 120)
layout_mode = 2
mouse_filter = 1
[node name="post-it_anchor2" type="Node2D" parent="HBoxContainer/ScrollContainer/VBoxContainer/Panel2"]
position = Vector2(105, 57)
[node name="post-it" parent="HBoxContainer/ScrollContainer/VBoxContainer/Panel2" instance=ExtResource("5_048k0")]
position = Vector2(105, 57)
is_dragable = true
metadata/type = "post-it"
[node name="Panel3" type="Panel" parent="HBoxContainer/ScrollContainer/VBoxContainer"]
self_modulate = Color(1, 1, 1, 0)
custom_minimum_size = Vector2(400, 120)
layout_mode = 2
mouse_filter = 1
[node name="post-it_anchor3" type="Node2D" parent="HBoxContainer/ScrollContainer/VBoxContainer/Panel3"]
position = Vector2(105, 57)
[node name="post-it" parent="HBoxContainer/ScrollContainer/VBoxContainer/Panel3" instance=ExtResource("5_048k0")]
position = Vector2(105, 57)
is_dragable = true
metadata/type = "post-it"
[node name="Panel4" type="Panel" parent="HBoxContainer/ScrollContainer/VBoxContainer"]
self_modulate = Color(1, 1, 1, 0)
custom_minimum_size = Vector2(400, 120)
layout_mode = 2
mouse_filter = 1
[node name="post-it_anchor4" type="Node2D" parent="HBoxContainer/ScrollContainer/VBoxContainer/Panel4"]
position = Vector2(105, 57)
[node name="post-it" parent="HBoxContainer/ScrollContainer/VBoxContainer/Panel4" instance=ExtResource("5_048k0")]
position = Vector2(105, 57)
is_dragable = true
metadata/type = "post-it"
[node name="board of devs" parent="." instance=ExtResource("4_sskx2")] [node name="board of devs" parent="." instance=ExtResource("4_sskx2")]
process_mode = 4
visible = false visible = false
layout_mode = 2 layout_mode = 2
[node name="border_right" type="Area2D" parent="."]
position = Vector2(1872, 461)
script = ExtResource("6_wpxls")
direction = Vector2(-100, 0)
[node name="CollisionShape2D" type="CollisionShape2D" parent="border_right"]
rotation = 1.5708
shape = SubResource("RectangleShape2D_ivo5o")
[node name="up" type="Control" parent="."]
layout_mode = 2
size_flags_horizontal = 4
size_flags_vertical = 0
[node name="border_up" type="Area2D" parent="up"]
script = ExtResource("6_wpxls")
direction = Vector2(0, 100)
[node name="CollisionShape2D" type="CollisionShape2D" parent="up/border_up"]
position = Vector2(-58, -423)
shape = SubResource("RectangleShape2D_5ri3m")
[node name="left" type="Control" parent="."]
layout_mode = 2
size_flags_horizontal = 0
size_flags_vertical = 4
[node name="border_left" type="Area2D" parent="left"]
script = ExtResource("6_wpxls")
direction = Vector2(100, 0)
[node name="CollisionShape2D" type="CollisionShape2D" parent="left/border_left"]
position = Vector2(-476, -22.5)
rotation = 1.5708
shape = SubResource("RectangleShape2D_ivo5o")
[node name="down" type="Control" parent="."]
layout_mode = 2
size_flags_horizontal = 4
size_flags_vertical = 8
[node name="border_down" type="Area2D" parent="down"]
script = ExtResource("6_wpxls")
direction = Vector2(0, -100)
[node name="CollisionShape2D" type="CollisionShape2D" parent="down/border_down"]
position = Vector2(2, 416)
shape = SubResource("RectangleShape2D_5ri3m")
[node name="right" type="Control" parent="."]
layout_mode = 2
size_flags_horizontal = 8
size_flags_vertical = 4
[node name="border_left" type="Area2D" parent="right"]
script = ExtResource("6_wpxls")
direction = Vector2(-100, 0)
[node name="CollisionShape2D" type="CollisionShape2D" parent="right/border_left"]
position = Vector2(12, 13)
rotation = 1.5708
shape = SubResource("RectangleShape2D_ivo5o")

View File

@ -6,8 +6,6 @@ var sibling
var shift_tween var shift_tween
var modulate_tween var modulate_tween
var on_stage = false
@export var text: String = "" : @export var text: String = "" :
set (value): set (value):
if is_inside_tree() or Engine.is_editor_hint(): if is_inside_tree() or Engine.is_editor_hint():
@ -46,7 +44,12 @@ var on_stage = false
@export var is_dragable: bool = false @export var is_dragable: bool = false
@onready var base_rotation = rotation @onready var base_rotation = rotation
@onready var base_scale = scale @onready var base_scale = scale
var is_dragged = false var is_dragged: bool = false:
set(dragged):
is_dragged = dragged
z_index = int(dragged)
var mouse_offset: Vector2
func _ready() -> void: func _ready() -> void:
@ -62,9 +65,9 @@ func replace_with(postit: PostIt):
self.sibling = postit.sibling self.sibling = postit.sibling
func _process(_delta: float) -> void: func _process(_delta: float) -> void:
if on_stage:
_move_post_it() _move_post_it()
func _on_focus_entered(): func _on_focus_entered():
print(self, "is focused") print(self, "is focused")
@ -72,27 +75,29 @@ func _on_focus_exited():
print(self, "is not focused") print(self, "is not focused")
func _on_mouse_entered(): func _on_mouse_entered():
if on_stage and not Input.is_action_pressed("mouse_left"): if not Input.is_action_pressed("mouse_left"):
highlighted = true highlighted = true
if "handle_hover" in owner: if "handle_hover" in owner:
owner.handle_hover(self) owner.handle_hover(self)
func _on_mouse_exited(): func _on_mouse_exited():
highlighted = false highlighted = false
if is_postit_attached() and "check_hover" in get_parent():
get_parent().check_hover()
func _on_input_event(viewport, event, shape_idx): func _on_input_event(viewport, event, shape_idx):
if on_stage:
if event is InputEventMouseMotion: if event is InputEventMouseMotion:
_move_post_it() _move_post_it()
if event is InputEventMouseButton: if event is InputEventMouseButton:
if event.button_index == MOUSE_BUTTON_LEFT: if event.button_index == MOUSE_BUTTON_LEFT:
if is_dragable and "handle_mouse_button" in owner: if is_dragable and "handle_mouse_button" in owner:
mouse_offset = (get_viewport().get_mouse_position() - global_position)
owner.handle_mouse_button(self, event) owner.handle_mouse_button(self, event)
func _move_post_it(): func _move_post_it():
if is_dragged: if is_dragged:
position += get_viewport().get_mouse_position() - position position += (get_viewport().get_mouse_position() - position) - mouse_offset
func is_postit_attached() -> bool: func is_postit_attached() -> bool:
if self.get_parent().get_meta("type") == "card": if self.get_parent().get_meta("type") == "card":

View File

@ -103,6 +103,7 @@ animations = [{
[node name="post-it" type="Area2D"] [node name="post-it" type="Area2D"]
script = ExtResource("1_yvh5n") script = ExtResource("1_yvh5n")
highlight_color = Color(1.2, 1.2, 1.2, 1) highlight_color = Color(1.2, 1.2, 1.2, 1)
metadata/type = "post-it"
[node name="CollisionShape2D" type="CollisionShape2D" parent="."] [node name="CollisionShape2D" type="CollisionShape2D" parent="."]
position = Vector2(99.5, 0) position = Vector2(99.5, 0)

File diff suppressed because one or more lines are too long

View File

@ -3,8 +3,11 @@ extends Node
var screen_reader:bool = false var screen_reader:bool = false
var disable_rendering: bool = false var disable_rendering: bool = false
var simplified_navigation:bool = false var simplified_navigation:bool = false
var show_navigation_buttons: bool = false
var enable_subtitles: bool = false var enable_subtitles: bool = false
var enable_closed_caption: bool = false
var reduce_motion: bool = false var reduce_motion: bool = false
var streaming_content_notes: bool = false
var show_content_notes: bool = false var show_content_notes: bool = false
var provide_summaries: bool = false var provide_summaries: bool = false
var allow_skipping: bool = false var allow_skipping: bool = false