added dragging cards and post its with mouse input
This commit is contained in:
parent
21193534b2
commit
8322f6e334
|
|
@ -48,6 +48,7 @@ var scale_tween
|
||||||
wiggle_intensity = 0
|
wiggle_intensity = 0
|
||||||
|
|
||||||
@export var voice_line: AudioStream = null
|
@export var voice_line: AudioStream = null
|
||||||
|
@export var is_dragable: bool = false
|
||||||
|
|
||||||
func _ready():
|
func _ready():
|
||||||
_handle_wiggle(0)
|
_handle_wiggle(0)
|
||||||
|
|
@ -88,3 +89,14 @@ func _on_focus_entered():
|
||||||
|
|
||||||
func _on_focus_exited():
|
func _on_focus_exited():
|
||||||
print(self, "is not focused")
|
print(self, "is not focused")
|
||||||
|
|
||||||
|
func _on_mouse_entered():
|
||||||
|
highlighted = true
|
||||||
|
|
||||||
|
func _on_mouse_exited():
|
||||||
|
highlighted = false
|
||||||
|
|
||||||
|
func _on_input_event(viewport, event, shape_idx):
|
||||||
|
if event is InputEventMouseMotion and Input.is_action_pressed("mouse_left") and is_dragable:
|
||||||
|
position += event.relative
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -198,6 +198,6 @@ offset_top = 148.0
|
||||||
offset_right = 140.0
|
offset_right = 140.0
|
||||||
offset_bottom = 188.0
|
offset_bottom = 188.0
|
||||||
|
|
||||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
|
[connection signal="input_event" from="." to="." method="_on_input_event"]
|
||||||
rotation = 1.5708
|
[connection signal="mouse_entered" from="." to="." method="_on_mouse_entered"]
|
||||||
shape = SubResource("CapsuleShape2D_foovg")
|
[connection signal="mouse_exited" from="." to="." method="_on_mouse_exited"]
|
||||||
|
|
|
||||||
|
|
@ -1,10 +1,11 @@
|
||||||
[gd_scene load_steps=9 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/bouncy-card.gd" id="6_gcxd7"]
|
[ext_resource type="Script" path="res://logic-scenes/board/bouncy-card.gd" id="6_gcxd7"]
|
||||||
|
|
||||||
[sub_resource type="ShaderMaterial" id="ShaderMaterial_ttqei"]
|
[sub_resource type="ShaderMaterial" id="ShaderMaterial_ttqei"]
|
||||||
|
|
@ -15,7 +16,7 @@ shader_parameter/tex = ExtResource("1_8brxc")
|
||||||
[sub_resource type="CircleShape2D" id="CircleShape2D_x8rl2"]
|
[sub_resource type="CircleShape2D" id="CircleShape2D_x8rl2"]
|
||||||
radius = 154.052
|
radius = 154.052
|
||||||
|
|
||||||
[node name="Panel" type="PanelContainer"]
|
[node name="board" type="PanelContainer"]
|
||||||
material = SubResource("ShaderMaterial_ttqei")
|
material = SubResource("ShaderMaterial_ttqei")
|
||||||
clip_contents = true
|
clip_contents = true
|
||||||
anchors_preset = 15
|
anchors_preset = 15
|
||||||
|
|
@ -25,46 +26,79 @@ grow_horizontal = 2
|
||||||
grow_vertical = 2
|
grow_vertical = 2
|
||||||
size_flags_horizontal = 6
|
size_flags_horizontal = 6
|
||||||
size_flags_vertical = 6
|
size_flags_vertical = 6
|
||||||
|
mouse_filter = 1
|
||||||
script = ExtResource("3_8v4c4")
|
script = ExtResource("3_8v4c4")
|
||||||
|
|
||||||
[node name="HBoxContainer" type="HBoxContainer" parent="."]
|
[node name="HBoxContainer" type="HBoxContainer" parent="."]
|
||||||
layout_mode = 2
|
layout_mode = 2
|
||||||
|
|
||||||
[node name="Panel" type="Panel" parent="HBoxContainer"]
|
[node name="dropzone" type="Panel" parent="HBoxContainer"]
|
||||||
layout_mode = 2
|
layout_mode = 2
|
||||||
size_flags_horizontal = 3
|
size_flags_horizontal = 3
|
||||||
|
mouse_filter = 1
|
||||||
|
|
||||||
[node name="Control" type="Control" parent="HBoxContainer/Panel"]
|
[node name="card3" parent="HBoxContainer/dropzone" instance=ExtResource("3_mg053")]
|
||||||
anchors_preset = 0
|
z_as_relative = false
|
||||||
offset_left = 305.0
|
position = Vector2(371, 290)
|
||||||
offset_top = 463.0
|
rotation = 0.00712087
|
||||||
offset_right = 305.0
|
collision_layer = 2147483649
|
||||||
offset_bottom = 463.0
|
|
||||||
|
|
||||||
[node name="card3" parent="HBoxContainer/Panel/Control" instance=ExtResource("3_mg053")]
|
[node name="card" parent="HBoxContainer/dropzone" instance=ExtResource("3_mg053")]
|
||||||
offset_left = 0.0
|
position = Vector2(640, 659)
|
||||||
offset_top = 0.0
|
rotation = 0.0714344
|
||||||
offset_right = 0.0
|
scale = Vector2(1, 1)
|
||||||
offset_bottom = 0.0
|
is_dragable = true
|
||||||
|
|
||||||
[node name="VBoxContainer3" type="VBoxContainer" parent="HBoxContainer"]
|
[node name="ScrollContainer" type="ScrollContainer" parent="HBoxContainer"]
|
||||||
layout_mode = 2
|
layout_mode = 2
|
||||||
size_flags_horizontal = 8
|
|
||||||
|
|
||||||
[node name="CenterContainer" type="ScrollContainer" parent="HBoxContainer/VBoxContainer3"]
|
|
||||||
layout_mode = 2
|
|
||||||
size_flags_vertical = 3
|
|
||||||
horizontal_scroll_mode = 0
|
horizontal_scroll_mode = 0
|
||||||
|
|
||||||
[node name="post-ancor" type="Panel" parent="HBoxContainer/VBoxContainer3/CenterContainer"]
|
[node name="VBoxContainer" type="VBoxContainer" parent="HBoxContainer/ScrollContainer"]
|
||||||
custom_minimum_size = Vector2(320, 110)
|
|
||||||
layout_mode = 2
|
layout_mode = 2
|
||||||
|
|
||||||
|
[node name="Panel" type="Panel" parent="HBoxContainer/ScrollContainer/VBoxContainer"]
|
||||||
|
custom_minimum_size = Vector2(400, 120)
|
||||||
|
layout_mode = 2
|
||||||
|
mouse_filter = 1
|
||||||
|
|
||||||
|
[node name="post-it" parent="HBoxContainer/ScrollContainer/VBoxContainer/Panel" instance=ExtResource("5_048k0")]
|
||||||
|
z_index = 1
|
||||||
|
position = Vector2(105, 57)
|
||||||
|
is_dragable = true
|
||||||
|
|
||||||
|
[node name="Panel2" type="Panel" parent="HBoxContainer/ScrollContainer/VBoxContainer"]
|
||||||
|
custom_minimum_size = Vector2(400, 120)
|
||||||
|
layout_mode = 2
|
||||||
|
mouse_filter = 1
|
||||||
|
|
||||||
|
[node name="post-it" parent="HBoxContainer/ScrollContainer/VBoxContainer/Panel2" instance=ExtResource("5_048k0")]
|
||||||
|
position = Vector2(105, 57)
|
||||||
|
is_dragable = true
|
||||||
|
|
||||||
|
[node name="Panel3" type="Panel" parent="HBoxContainer/ScrollContainer/VBoxContainer"]
|
||||||
|
custom_minimum_size = Vector2(400, 120)
|
||||||
|
layout_mode = 2
|
||||||
|
mouse_filter = 1
|
||||||
|
|
||||||
|
[node name="post-it" parent="HBoxContainer/ScrollContainer/VBoxContainer/Panel3" instance=ExtResource("5_048k0")]
|
||||||
|
position = Vector2(105, 57)
|
||||||
|
is_dragable = true
|
||||||
|
|
||||||
|
[node name="Panel4" type="Panel" parent="HBoxContainer/ScrollContainer/VBoxContainer"]
|
||||||
|
custom_minimum_size = Vector2(400, 120)
|
||||||
|
layout_mode = 2
|
||||||
|
mouse_filter = 1
|
||||||
|
|
||||||
|
[node name="post-it" parent="HBoxContainer/ScrollContainer/VBoxContainer/Panel4" instance=ExtResource("5_048k0")]
|
||||||
|
position = Vector2(105, 57)
|
||||||
|
is_dragable = true
|
||||||
|
|
||||||
[node name="board of devs" parent="." instance=ExtResource("4_sskx2")]
|
[node name="board of devs" parent="." instance=ExtResource("4_sskx2")]
|
||||||
visible = false
|
visible = false
|
||||||
layout_mode = 2
|
layout_mode = 2
|
||||||
|
|
||||||
[node name="Node2D" type="Node2D" parent="."]
|
[node name="Node2D" type="Node2D" parent="."]
|
||||||
|
visible = false
|
||||||
|
|
||||||
[node name="RigidBody2D" type="Area2D" parent="Node2D"]
|
[node name="RigidBody2D" type="Area2D" parent="Node2D"]
|
||||||
position = Vector2(686, 379)
|
position = Vector2(686, 379)
|
||||||
|
|
@ -77,10 +111,8 @@ shape = SubResource("CircleShape2D_x8rl2")
|
||||||
position = Vector2(-151, -107)
|
position = Vector2(-151, -107)
|
||||||
|
|
||||||
[node name="card2" parent="Node2D/RigidBody2D/ancor" instance=ExtResource("3_mg053")]
|
[node name="card2" parent="Node2D/RigidBody2D/ancor" instance=ExtResource("3_mg053")]
|
||||||
offset_left = 0.0
|
rotation = -0.0180459
|
||||||
offset_top = 0.0
|
collision_layer = 2
|
||||||
offset_right = 0.0
|
|
||||||
offset_bottom = 0.0
|
|
||||||
|
|
||||||
[node name="RigidBody2D2" type="Area2D" parent="Node2D"]
|
[node name="RigidBody2D2" type="Area2D" parent="Node2D"]
|
||||||
position = Vector2(742, 323)
|
position = Vector2(742, 323)
|
||||||
|
|
@ -93,10 +125,8 @@ shape = SubResource("CircleShape2D_x8rl2")
|
||||||
position = Vector2(-151, -107)
|
position = Vector2(-151, -107)
|
||||||
|
|
||||||
[node name="card2" parent="Node2D/RigidBody2D2/ancor" instance=ExtResource("3_mg053")]
|
[node name="card2" parent="Node2D/RigidBody2D2/ancor" instance=ExtResource("3_mg053")]
|
||||||
offset_left = 0.0
|
rotation = 0.0612526
|
||||||
offset_top = 0.0
|
collision_layer = 2
|
||||||
offset_right = 0.0
|
|
||||||
offset_bottom = 0.0
|
|
||||||
|
|
||||||
[node name="RigidBody2D3" type="Area2D" parent="Node2D"]
|
[node name="RigidBody2D3" type="Area2D" parent="Node2D"]
|
||||||
position = Vector2(694, 353)
|
position = Vector2(694, 353)
|
||||||
|
|
@ -109,7 +139,5 @@ shape = SubResource("CircleShape2D_x8rl2")
|
||||||
position = Vector2(-151, -107)
|
position = Vector2(-151, -107)
|
||||||
|
|
||||||
[node name="card2" parent="Node2D/RigidBody2D3/ancor" instance=ExtResource("3_mg053")]
|
[node name="card2" parent="Node2D/RigidBody2D3/ancor" instance=ExtResource("3_mg053")]
|
||||||
offset_left = 0.0
|
rotation = 0.0528008
|
||||||
offset_top = 0.0
|
collision_layer = 2
|
||||||
offset_right = 0.0
|
|
||||||
offset_bottom = 0.0
|
|
||||||
|
|
|
||||||
|
|
@ -45,6 +45,7 @@ var modulate_tween
|
||||||
wiggle_intensity = 0
|
wiggle_intensity = 0
|
||||||
|
|
||||||
@export var voice_line: AudioStream = null
|
@export var voice_line: AudioStream = null
|
||||||
|
@export var is_dragable: bool = false
|
||||||
|
|
||||||
func _ready() -> void:
|
func _ready() -> void:
|
||||||
$Content/Label.text = self.text
|
$Content/Label.text = self.text
|
||||||
|
|
@ -64,3 +65,14 @@ func _on_focus_entered():
|
||||||
|
|
||||||
func _on_focus_exited():
|
func _on_focus_exited():
|
||||||
print(self, "is not focused")
|
print(self, "is not focused")
|
||||||
|
|
||||||
|
func _on_mouse_entered():
|
||||||
|
#owner.grab_highlight(self)
|
||||||
|
highlighted = true
|
||||||
|
|
||||||
|
func _on_mouse_exited():
|
||||||
|
highlighted = false
|
||||||
|
|
||||||
|
func _on_input_event(viewport, event, shape_idx):
|
||||||
|
if event is InputEventMouseMotion and Input.is_action_pressed("mouse_left") and is_dragable:
|
||||||
|
position += event.relative
|
||||||
|
|
|
||||||
|
|
@ -102,8 +102,8 @@ animations = [{
|
||||||
|
|
||||||
[node name="post-it" type="Area2D"]
|
[node name="post-it" type="Area2D"]
|
||||||
script = ExtResource("1_yvh5n")
|
script = ExtResource("1_yvh5n")
|
||||||
text = "Test"
|
|
||||||
highlight_color = Color(1.2, 1.2, 1.2, 1)
|
highlight_color = Color(1.2, 1.2, 1.2, 1)
|
||||||
|
is_dragable = null
|
||||||
|
|
||||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
|
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
|
||||||
position = Vector2(99.5, 0)
|
position = Vector2(99.5, 0)
|
||||||
|
|
@ -116,7 +116,7 @@ shape = SubResource("CapsuleShape2D_ml4q7")
|
||||||
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_2amsi")
|
sprite_frames = SubResource("SpriteFrames_2amsi")
|
||||||
frame = 1
|
frame = 5
|
||||||
|
|
||||||
[node name="Label" type="Label" parent="Content"]
|
[node name="Label" type="Label" parent="Content"]
|
||||||
anchors_preset = 8
|
anchors_preset = 8
|
||||||
|
|
@ -132,6 +132,9 @@ grow_horizontal = 2
|
||||||
grow_vertical = 2
|
grow_vertical = 2
|
||||||
theme = ExtResource("3_hu2as")
|
theme = ExtResource("3_hu2as")
|
||||||
theme_type_variation = &"card_text"
|
theme_type_variation = &"card_text"
|
||||||
text = "Test"
|
|
||||||
vertical_alignment = 1
|
vertical_alignment = 1
|
||||||
autowrap_mode = 3
|
autowrap_mode = 3
|
||||||
|
|
||||||
|
[connection signal="input_event" from="." to="." method="_on_input_event"]
|
||||||
|
[connection signal="mouse_entered" from="." to="." method="_on_mouse_entered"]
|
||||||
|
[connection signal="mouse_exited" from="." to="." method="_on_mouse_exited"]
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue