further rework of card handling

This commit is contained in:
betalars 2025-02-24 16:14:08 +01:00
parent 60d7d7e7ac
commit e8e368c362
9 changed files with 197 additions and 109 deletions

View File

@ -44,7 +44,6 @@ var dropzone_size: Vector2
@export var dropzone_padding = 100
@onready var sticky_note_container = $HBoxContainer/ScrollContainer/VBoxContainer
@onready var board_of_devs = $"board of devs"
var base_sticky_note_panel: Panel
@onready var current_context:int = NAVIGATE:
set(context):
if current_context == ASSIGN and !context == ASSIGN:
@ -75,7 +74,7 @@ var mementos_collected: int = 0:
@onready var currently_active_node: Area2D = null:
set(new_node):
# this makes sure no accidental context switches can happen while a card is being dragged.
if not current_context == DRAG:
if not (current_context == DRAG):
if not currently_active_node == null:
currently_active_node.highlighted = false
currently_active_node = new_node
@ -87,7 +86,7 @@ var mementos_collected: int = 0:
if new_id > dropzone.get_child_count() - 1: current_dropzone_id = 0
elif new_id < 0: current_dropzone_id = dropzone.get_child_count() - 1
else: current_dropzone_id = new_id
if current_context == ASSIGN:
if current_context == ASSIGN and not focus_stickies:
while not dropzone.get_child(current_dropzone_id) is Card: current_dropzone_id = (current_dropzone_id + 1) % dropzone.get_child_count()
dropzone.get_child(current_dropzone_id).preview_sticky_note(currently_active_node)
@ -104,7 +103,12 @@ var mementos_collected: int = 0:
_return_sticky_notes_to_panels()
currently_active_node.preview_sticky_note(sticky_note_container.get_child(current_sticky_note_id).attached_sticky_note)
else:
currently_active_node = sticky_note_container.get_child(current_sticky_note_id).get_child(1)
if sticky_note_container.get_child(current_sticky_note_id).get_child_count() == 1:
currently_active_node = sticky_note_container.get_child(current_sticky_note_id).get_child(0)
else:
for i in range(sticky_note_container.get_child_count() - 1):
if sticky_note_container.get_child(i).get_child_count() == 1:
currently_active_node = sticky_note_container.get_child(i).get_child(0)
var cache: Array = []
@ -112,17 +116,23 @@ signal board_completed
# Called when the node enters the scene tree for the first time.
func _ready():
base_sticky_note_panel = $HBoxContainer/ScrollContainer/VBoxContainer/Panel
sticky_note_container.remove_child(base_sticky_note_panel)
var size_reference = StickyNotePanel.new()
dropzone_size = get_viewport_rect().size - Vector2(dropzone_padding + base_sticky_note_panel.custom_minimum_size.x, dropzone_padding)
dropzone_size = get_viewport_rect().size - Vector2(dropzone_padding + size_reference.minimum_size.x, dropzone_padding)
if get_parent() == get_tree().root:
populate_board(["c_void", 'c_joy', "p_wet", "p_thomas"])
populate_board(["c_void", 'c_joy', "p_wet", "p_effort"])
populate_board(["c_fighting", 'c_hit', "p_girly", "p_vent"])
mementos_collected = 2
has_stage = has_stage
get_viewport().gui_focus_changed.connect(reclaim_lost_focus)
func reclaim_lost_focus():
if has_stage:
grab_focus()
#func _process(delta):
# # drops dragged area when Mouse is no longer pressed.
@ -155,10 +165,12 @@ func add_card(card: Card):
card.is_dragable = true
func add_sticky_note(sticky: StickyNote):
var new_panel = base_sticky_note_panel.duplicate()
sticky_note_container.add_child(new_panel)
var new_panel = StickyNotePanel.new()
sticky_note_container.add_child(new_panel, false, Node.INTERNAL_MODE_DISABLED)
#WARNING this for some reason would break the tweens
new_panel.set_owner(self)
new_panel.attatch_sticky_note(sticky, false)
sticky.current_handle = self
new_panel.attatch_sticky_note(sticky, self, false)
# Checks if a Node is currently inside the dropzone
func is_in_dropzone(to_check: Node) -> bool:
@ -179,7 +191,7 @@ func handle_mouse_button(input: InputEventMouseButton, to_handle = currently_act
if not to_handle.on_board:
to_handle.reparent(dropzone)
to_handle.on_board = true
to_handle.owner = self
to_handle.attached_to = self
current_context = DRAG
# when Drag stops ...
@ -195,6 +207,7 @@ func handle_mouse_button(input: InputEventMouseButton, to_handle = currently_act
to_handle = area.exchange_sticky_note_with(to_handle)
to_handle.reparent(dropzone)
to_handle.on_board = true
# FIXME: this caused an error when all stickies were attatched ...
sticky_note_container.get_child(current_sticky_note_id).attached_sticky_note = to_handle
to_handle.attached_to = sticky_note_container.get_child(current_sticky_note_id)
to_handle.reset_drag()
@ -202,17 +215,29 @@ func handle_mouse_button(input: InputEventMouseButton, to_handle = currently_act
return
else:
area.attach_sticky_note(to_handle)
if not sticky_note_container.get_child_count() == 0:
sticky_note_container.get_child(current_sticky_note_id).clear_if_empty()
sticky_note_container.get_child(current_sticky_note_id).clear_if_empty()
current_context = NAVIGATE
if is_board_complete(): emit_signal("board_completed")
return
else:
var i: int = 0
for panel: StickyNotePanel in sticky_note_container.get_children():
i += 1
if panel.is_gapped or i == sticky_note_container.get_child_count():
panel.collapse_gap()
var new_panel = StickyNotePanel.new()
sticky_note_container.add_child(new_panel)
sticky_note_container.move_child(new_panel, i)
new_panel.attatch_sticky_note(to_handle, self)
new_panel.owner = self
panel.clear_if_empty()
_return_sticky_notes_to_panels()
current_context = NAVIGATE
return
## Dropping Cards and Sticky Notes not causing a return condition above.
insert_area(dropzone, to_handle)
if not (to_handle is StickyNote and to_handle.is_sticky_note_attached()):
insert_area(dropzone, to_handle)
current_context = NAVIGATE
focus_stickies = false
current_dropzone_id = dropzone.get_children().find(to_handle)
@ -225,7 +250,7 @@ func handle_mouse_button(input: InputEventMouseButton, to_handle = currently_act
func _return_sticky_notes_to_panels():
for panel in sticky_note_container.get_children():
for panel:StickyNotePanel in sticky_note_container.get_children():
panel.reclaim_sticky_note()
func is_board_complete() -> bool:
@ -289,8 +314,8 @@ func _input(event):
handle_mouse_button(event)
else:
return
if current_context != DRAG:
if current_context != DRAG:
if event.is_action_pressed("ui_up"):
if focus_stickies:
current_sticky_note_id -= 1
@ -328,7 +353,8 @@ func _input(event):
else:
card.attach_sticky_note(sticky_note_container.get_child(current_sticky_note_id).attached_sticky_note)
current_context = NAVIGATE
focus_stickies = false
current_sticky_note_id += 1
current_dropzone_id = find_first_free_card()
if is_board_complete(): emit_signal("board_completed")
else:
if !focus_stickies and card.has_sticky_note_attached():
@ -380,7 +406,7 @@ func get_save_dict() -> Dictionary:
cards[child.name] = child.transform.origin
for child in sticky_note_container.get_children():
if child is PostItPanel:
if child is StickyNotePanel:
stickies[child.attached_sticky_note.name] = -1
return {
"cards": cards,

View File

@ -3,6 +3,7 @@
extends Area2D
class_name Card
var compatible_sticky_notes: Array[StickyNote] = []
@export var evil_sticky_notes: Array[StickyNote] = []
var own_sticky_notes: Array[StickyNote] = []
var current_sticky_note: StickyNote = null
var wiggle_pos: float = 0
@ -64,7 +65,7 @@ var transfor_arr: Array[Transform2D] = [
@export var voice_line: AudioStream = null
@export var is_dragable: bool = false
@onready var diameter = $CollisionShape2D.shape.height
@onready var sticky_note_anchor: Node2D = $"sticky note anchor"
@onready var sticky_note_anchor: Node2D = %StickyNoteAncor
var is_dragged: bool = false:
set(dragged):
@ -94,7 +95,7 @@ func _ready():
own_sticky_notes[0].sibling = own_sticky_notes[1]
own_sticky_notes[1].sibling = own_sticky_notes[0]
$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.theme = State.current_main_theme
@ -167,7 +168,8 @@ func _on_input_event(viewport, event, shape_idx):
_move_card()
if event is InputEventMouseButton:
if event.button_index == MOUSE_BUTTON_LEFT:
# Mouse Button Left is being handled by card_board to prevent events being missed when mouse moves outside card
if event.button_index == MOUSE_BUTTON_LEFT and event.pressed:
if "handle_mouse_button" in owner:
mouse_offset = (get_viewport().get_mouse_position() - position)
if highlighted:
@ -178,25 +180,29 @@ func _move_card():
position += (get_viewport().get_mouse_position() - position) - mouse_offset
func has_sticky_note_attached() -> bool:
return get_child(-1) is StickyNote
return sticky_note_anchor.get_child_count() > 0
func get_attached_sticky_note() -> StickyNote:
return null if not has_sticky_note_attached() else get_child(-1)
return null if not has_sticky_note_attached() else sticky_note_anchor.get_child(0)
func preview_sticky_note(sticky_note: StickyNote):
sticky_note.reparent(self.get_parent())
sticky_note.owner = owner
sticky_note.attached_to = self
sticky_note.tween_transform_to(Transform2D(0, sticky_note_anchor.global_position + 0 * Vector2(sticky_note.diameter, sticky_note.diameter)))
func attach_sticky_note(sticky_note: StickyNote) -> bool:
if has_sticky_note_attached():
return false
sticky_note.reparent(self)
sticky_note.owner = self.owner
sticky_note.position = sticky_note_anchor.position
sticky_note.reparent(sticky_note_anchor)
sticky_note.position = Vector2.ZERO
sticky_note.on_board = false
current_sticky_note = sticky_note
sticky_note.attached_to = self
if name == "c_hit" and sticky_note.name == "p_effort":
Steam.setAchievement("FIGHT_FOR_GOOD")
Steam.storeStats()
return true
func remove_sticky_note() -> StickyNote:
@ -205,6 +211,7 @@ func remove_sticky_note() -> StickyNote:
current_sticky_note = null
former_child.reparent(get_parent())
former_child.owner = self.owner
former_child.current_handle = false
former_child.on_board = true
former_child.attached_to = null
return former_child

View File

@ -61,6 +61,7 @@ rotation = 1.5708
shape = SubResource("CapsuleShape2D_foovg")
[node name="BackgroundSprite" type="AnimatedSprite2D" parent="."]
unique_name_in_owner = true
clip_children = 2
scale = Vector2(0.6, 0.6)
sprite_frames = SubResource("SpriteFrames_ckivt")
@ -83,5 +84,6 @@ theme = ExtResource("3_1x4uh")
theme_type_variation = &"card_text"
autowrap_mode = 3
[node name="sticky note anchor" type="Node2D" parent="."]
[node name="StickyNoteAncor" type="Node2D" parent="."]
unique_name_in_owner = true
position = Vector2(-66, 83)

View File

@ -1,38 +1,72 @@
class_name PostItPanel
@tool
class_name StickyNotePanel
extends Panel
@export var minimum_size:Vector2 = Vector2(400, 100)
var minimum_size:Vector2 = Vector2(400, 100):
set(size):
minimum_size = size
custom_minimum_size = size
var attached_sticky_note: StickyNote
@onready var ancor = $"sticky-note_anchor"
var ancor_position: Vector2
func _init(cstm_minimum_size: Vector2 = minimum_size, note_position: Vector2 = Vector2(105, 57)) -> void:
minimum_size = cstm_minimum_size
ancor_position = note_position
mouse_filter = MOUSE_FILTER_PASS
self_modulate = Color(1, 1, 1, 0)
func _ready():
ancor.position = Vector2(ancor.position.x, 0)
custom_minimum_size = Vector2(custom_minimum_size.x, 0)
func attatch_sticky_note(attatchment: StickyNote, tween:bool = true):
var is_attatching: bool = false
func attatch_sticky_note(attatchment: StickyNote, custom_owner: Node, tween:bool = true):
is_attatching = true
attatchment.on_board = false
attached_sticky_note = attatchment
attatchment.attached_to = self
if tween:
await get_tree().process_frame
var height_tween: Tween = create_tween()
height_tween.tween_property(self, "custom_minimum_size", minimum_size, 0.3)
height_tween.tween_property(ancor, "position", Vector2(ancor.position.x, minimum_size.y/2), 0.3)
attatchment.tween_transform_to(ancor.global_position)
height_tween.tween_property(self, "custom_minimum_size", minimum_size, 0.1)
attatchment.tween_transform_to(Transform2D(0, get_screen_position() + ancor_position - Vector2(0, minimum_size.y)))
await attatchment.transform_tween_finished
else:
custom_minimum_size = minimum_size
ancor.position = Vector2(ancor.position.x, minimum_size.y/2)
attatchment.reparent(self)
attached_sticky_note = attatchment
attatchment.owner = self.owner
attatchment.attached_to = self
attatchment.transform = ancor.transform
is_attatching = false
attatchment.owner = custom_owner
attatchment.position = ancor_position
var is_gapped: bool = false
func create_gap():
var self_id = get_parent().get_children().find(self)
var next_id = min(self_id + 1, get_parent().get_child_count() - 1)
var previous_id = max(self_id - 1, 0)
func reclaim_sticky_note():
if is_empty() and attached_sticky_note.on_board == true:
if not (is_gapped or get_parent().get_child(next_id).attached_sticky_note.is_dragged or get_parent().get_child(previous_id).attached_sticky_note.is_dragged) and owner.current_context == CardBoard.DRAG:
is_gapped = true
var height_tween: Tween = create_tween()
height_tween.tween_property(self, "custom_minimum_size", minimum_size*Vector2(1.0, 1.8), 0.1)
get_parent().get_child(next_id).collapse_gap()
if not get_parent().get_children().find(self) == 0: get_parent().get_child(previous_id).collapse_gap()
func collapse_gap():
if is_gapped:
is_gapped = false
var height_tween: Tween = create_tween()
height_tween.tween_property(self, "custom_minimum_size", minimum_size, 0.1)
func reclaim_sticky_note() -> bool:
if is_empty() and attached_sticky_note.attached_to != Card:
attached_sticky_note.on_board = false
attached_sticky_note.tween_transform_to(ancor.global_transform)
attached_sticky_note.tween_transform_to(Transform2D(0, get_screen_position() + ancor_position))
await attached_sticky_note.transform_tween_finished
attached_sticky_note.reparent(self)
attached_sticky_note.attached_to = self
attached_sticky_note.owner = self.owner
return true
return false
func clear_if_empty():
if !is_empty(): return
@ -48,4 +82,4 @@ func replace_sticky_note_with(new_sticky_note: StickyNote):
attached_sticky_note = new_sticky_note
func is_empty() -> bool:
return get_child_count() == 1
return get_child_count() == 0 and not is_attatching

View File

@ -4,7 +4,7 @@
[node name="Panel" type="Panel"]
self_modulate = Color(1, 1, 1, 0)
custom_minimum_size = Vector2(400, 100)
custom_minimum_size = Vector2(400, 0)
offset_right = 400.0
offset_bottom = 120.0
mouse_filter = 1

View File

@ -4,7 +4,6 @@
[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="PackedScene" uid="uid://bvowj4l8dtceu" path="res://dev-util/board of devs.tscn" id="4_sskx2"]
[ext_resource type="PackedScene" uid="uid://chwf61qpn2sqw" path="res://logic-scenes/board/empty_sticky_note_panel.tscn" id="5_dr0qs"]
[ext_resource type="Script" path="res://logic-scenes/board/card collider.gd" id="6_wpxls"]
[sub_resource type="ShaderMaterial" id="ShaderMaterial_ttqei"]
@ -12,6 +11,8 @@ shader = ExtResource("1_ggnth")
shader_parameter/magic_scale_factor = 1500.0
shader_parameter/tex = ExtResource("1_8brxc")
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_m1g7s"]
[sub_resource type="RectangleShape2D" id="RectangleShape2D_5ri3m"]
size = Vector2(4262, 766.5)
@ -29,6 +30,7 @@ grow_vertical = 2
size_flags_horizontal = 6
size_flags_vertical = 6
mouse_filter = 2
theme_override_styles/panel = SubResource("StyleBoxFlat_m1g7s")
script = ExtResource("3_8v4c4")
[node name="HBoxContainer" type="HBoxContainer" parent="."]
@ -47,9 +49,6 @@ horizontal_scroll_mode = 0
[node name="VBoxContainer" type="VBoxContainer" parent="HBoxContainer/ScrollContainer"]
layout_mode = 2
[node name="Panel" parent="HBoxContainer/ScrollContainer/VBoxContainer" instance=ExtResource("5_dr0qs")]
layout_mode = 2
[node name="board of devs" parent="." instance=ExtResource("4_sskx2")]
process_mode = 4
visible = false

View File

@ -8,7 +8,11 @@ var modulate_tween: Tween
var card_stick_tween: Tween
var hovering_cards: Array[Card]
var hover_pos_shift: float
var attached_to: Node = null:
set(new_attatchement):
attached_to = new_attatchement
# cannot be explicitly typed, as this can be bnoth handled by picker and physics-board
var current_handle
signal transform_tween_finished
@ -26,14 +30,15 @@ signal transform_tween_finished
set(highlight):
if highlight != highlighted:
highlighted = highlight
print("hightlight_set")
if is_inside_tree() and is_node_ready():
if modulate_tween: modulate_tween.kill()
if shift_tween: shift_tween.kill()
if highlighted:
modulate_tween = get_tree().create_tween()
var modulate_tween = get_tree().create_tween()
modulate_tween.tween_property(self, "modulate", highlight_color, 0.1)
shift_tween = get_tree().create_tween()
var shift_tween = get_tree().create_tween()
shift_tween.tween_property($Content, "position", shift_by, 0.2)
else:
modulate_tween = get_tree().create_tween()
@ -62,7 +67,7 @@ var mouse_diff: Vector2
@onready var diameter = $CollisionShape2D.shape.height
@export_range(1.0, 10.0) var bounce_speed: float = 8
var on_board: bool = false
var attached_to: Node = null
func _ready() -> void:
@ -103,26 +108,27 @@ func _process(delta: float) -> void:
func _on_mouse_entered():
if not Input.is_action_pressed("mouse_left"):
highlighted = true
if "handle_hover" in owner:
owner.handle_hover(self)
if "handle_hover" in current_handle:
current_handle.handle_hover(self)
func _on_mouse_exited():
if is_sticky_note_attached() and "check_hover" in get_parent():
get_parent().check_hover()
if not is_dragged:
highlighted = false
if is_sticky_note_attached() and "check_hover" in attached_to:
attached_to.check_hover()
func _on_area_enter(card: Area2D):
print(card)
if card is Card:
if hovering_cards == []:
hovering_cards = [card]
card_stick_tween = get_tree().create_tween()
card_stick_tween.set_ease(Tween.EASE_IN_OUT)
card_stick_tween.tween_property(self, "hover_pos_shift", 0.3, 0.3)
card_stick_tween.tween_property(self, "hover_pos_shift", 0.3, 0.1)
else:
hovering_cards.append(card)
elif card is StickyNote and is_sticky_note_in_panel() and not is_dragged:
attached_to.create_gap()
func _on_area_exit(card: Area2D):
if hovering_cards.has(card):
@ -131,17 +137,20 @@ func _on_area_exit(card: Area2D):
if hovering_cards == []:
hover_pos_shift = 0
$Content.position = Vector2.ZERO
elif card is StickyNote and is_sticky_note_in_panel():
attached_to.collapse_gap()
func _on_input_event(viewport, event, shape_idx):
if event is InputEventMouseButton:
if event.button_index == MOUSE_BUTTON_LEFT or event.button_index == MOUSE_BUTTON_RIGHT:
if "handle_mouse_button" in owner:
if (event.button_index == MOUSE_BUTTON_LEFT and event.pressed) or event.button_index == MOUSE_BUTTON_RIGHT:
if "handle_hover" in current_handle:
mouse_diff = get_viewport().get_mouse_position()
initial_drag_position = global_position
owner.handle_mouse_button(event, self)
current_handle.handle_mouse_button(event, self)
func _move_sticky_note():
if is_dragged:
var old_position = position
position = initial_drag_position + get_viewport().get_mouse_position() - mouse_diff
if hovering_cards != []:
@ -154,8 +163,10 @@ func _move_sticky_note():
$Content.position = (closest.sticky_note_anchor.global_position - global_position) * hover_pos_shift
func is_sticky_note_attached() -> bool:
# there is probably a nicer way to do this
return self.get_parent() is Card
return attached_to is Card
func is_sticky_note_in_panel() -> bool:
return attached_to is StickyNotePanel
func tween_transform_to(target: Transform2D):
var transform_tween: Tween = create_tween()

View File

@ -10,6 +10,33 @@
radius = 110.0
height = 336.0
[sub_resource type="GDScript" id="GDScript_8bs16"]
script/source = "extends Node2D
@onready var particles = $BackgroundSprite/GPUParticles2D
@onready var initial_position = position
var noise_position = randf()
var noise: Noise = FastNoiseLite.new()
func _process(delta):
if not State.reduce_motion:
noise_position += delta * 10
var random_position = Vector2(noise.get_noise_1d(noise_position*2), noise.get_noise_1d(-noise_position))
random_position = random_position.normalized() * pow(random_position.length()*2, 3) * 5
position = initial_position - random_position
rotation = noise.get_noise_1d(noise_position*10) * random_position.length() * 0.01
particles.position = random_position
else: position = initial_position
"
[sub_resource type="AtlasTexture" id="AtlasTexture_ykk13"]
atlas = ExtResource("2_buevv")
region = Rect2(0, 0, 600, 440)
@ -53,33 +80,6 @@ animations = [{
"speed": 5.0
}]
[sub_resource type="GDScript" id="GDScript_8bs16"]
script/source = "extends AnimatedSprite2D
@onready var particles = $GPUParticles2D
@onready var initial_position = position
var noise_position = randf()
var noise: Noise = FastNoiseLite.new()
func _process(delta):
if not State.reduce_motion:
noise_position += delta * 10
var random_position = Vector2(noise.get_noise_1d(noise_position*2), noise.get_noise_1d(-noise_position))
random_position = random_position.normalized() * pow(random_position.length()*2, 3) * 5
position = initial_position - random_position
rotation = noise.get_noise_1d(noise_position*10) * random_position.length() * 0.01
particles.position = random_position
else: position = initial_position
"
[sub_resource type="Gradient" id="Gradient_v70nd"]
interpolation_mode = 2
offsets = PackedFloat32Array(0, 0.0529197, 0.191606, 1)
@ -123,14 +123,14 @@ turbulence_noise_strength = 0.1
script/source = "extends GPUParticles2D
func _process(_delta):
self.visible = !State.reduce_motion
self.visible = !State.reduce_motion
"
[sub_resource type="GDScript" id="GDScript_tgc0b"]
script/source = "extends Sprite2D
func _process(_delta):
self.visible = State.reduce_motion
self.visible = State.reduce_motion
"
[node name="card" type="Area2D"]
@ -142,14 +142,17 @@ position = Vector2(-0.0713516, 0.997451)
rotation = 1.5708
shape = SubResource("CapsuleShape2D_foovg")
[node name="BackgroundSprite" type="AnimatedSprite2D" parent="."]
clip_children = 2
[node name="Visual" type="Node2D" parent="."]
scale = Vector2(0.6, 0.6)
sprite_frames = SubResource("SpriteFrames_ckivt")
frame = 1
script = SubResource("GDScript_8bs16")
[node name="GPUParticles2D" type="GPUParticles2D" parent="BackgroundSprite"]
[node name="BackgroundSprite" type="AnimatedSprite2D" parent="Visual"]
unique_name_in_owner = true
clip_children = 2
sprite_frames = SubResource("SpriteFrames_ckivt")
frame = 1
[node name="GPUParticles2D" type="GPUParticles2D" parent="Visual/BackgroundSprite"]
amount = 500
process_material = SubResource("ParticleProcessMaterial_by44l")
texture = ExtResource("3_8wu8j")
@ -160,12 +163,17 @@ randomness = 0.14
local_coords = true
script = SubResource("GDScript_vjwk7")
[node name="Sprite2D" type="Sprite2D" parent="BackgroundSprite"]
[node name="Sprite2D" type="Sprite2D" parent="Visual/BackgroundSprite"]
visible = false
scale = Vector2(0.4, 0.4)
texture = ExtResource("4_jam8u")
script = SubResource("GDScript_tgc0b")
[node name="StickyNoteAncor" type="Node2D" parent="Visual/BackgroundSprite"]
unique_name_in_owner = true
position = Vector2(-109.413, 100.642)
scale = Vector2(1.66667, 1.66667)
[node name="Label" type="Label" parent="."]
anchors_preset = 8
anchor_left = 0.5
@ -181,6 +189,3 @@ grow_vertical = 2
theme = ExtResource("3_mi4ah")
theme_type_variation = &"card_text"
autowrap_mode = 3
[node name="sticky note anchor" type="Node2D" parent="."]
position = Vector2(-65.6478, 60.3852)

View File

@ -82,9 +82,10 @@ func fill_card_slots(id: int):
for i in range(new_cards.size()):
$cards.get_child(i).remove_child($cards.get_child(i).get_child(1))
var new_card = new_cards[i]
var new_card:Card = new_cards[i]
new_card.reparent($cards.get_child(i), false)
new_card.owner = self
new_card.connect("mouse_entered", Callable(self, "get_highlight"))
options.append(new_card)
anim_players.append($cards.get_child(i).get_child(0))
@ -95,6 +96,9 @@ func fill_post_slots():
for card in output:
sticky_notes.append_array(card.own_sticky_notes)
for note:StickyNote in sticky_notes:
note.current_handle = self
sticky_notes.shuffle()
options = []
for ancor in $sticky_notes.get_children():
@ -212,7 +216,7 @@ func handle_hover(new_highlight):
if not _input_locked:
curr_selection_id = options.find(new_highlight)
func handle_mouse_button(new_selection: Node, button_event: InputEventMouseButton):
func handle_mouse_button(button_event: InputEventMouseButton, new_selection: Node):
if not _input_locked:
if button_event.button_index == MOUSE_BUTTON_LEFT and button_event.pressed:
pick(options.find(new_selection))