few UX improvements
This commit is contained in:
63
scenes/arrow/arrow.tscn
Normal file
63
scenes/arrow/arrow.tscn
Normal file
@@ -0,0 +1,63 @@
|
||||
[gd_scene format=3 uid="uid://xwccasmeo5cy"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://d3f721y4183yy" path="res://utils/clickable.gd" id="1_8e2im"]
|
||||
[ext_resource type="Texture2D" uid="uid://cgrudt5ev651p" path="res://assets/ui/arrow_001.png" id="1_uynht"]
|
||||
|
||||
[sub_resource type="Animation" id="Animation_ftp6y"]
|
||||
length = 0.001
|
||||
tracks/0/type = "value"
|
||||
tracks/0/imported = false
|
||||
tracks/0/enabled = true
|
||||
tracks/0/path = NodePath(".:scale")
|
||||
tracks/0/interp = 1
|
||||
tracks/0/loop_wrap = true
|
||||
tracks/0/keys = {
|
||||
"times": PackedFloat32Array(0),
|
||||
"transitions": PackedFloat32Array(1),
|
||||
"update": 0,
|
||||
"values": [Vector2(0.5, 0.5)]
|
||||
}
|
||||
|
||||
[sub_resource type="Animation" id="Animation_pd34m"]
|
||||
resource_name = "idle"
|
||||
length = 2.0
|
||||
loop_mode = 1
|
||||
tracks/0/type = "value"
|
||||
tracks/0/imported = false
|
||||
tracks/0/enabled = true
|
||||
tracks/0/path = NodePath(".:scale")
|
||||
tracks/0/interp = 2
|
||||
tracks/0/loop_wrap = true
|
||||
tracks/0/keys = {
|
||||
"times": PackedFloat32Array(0, 1),
|
||||
"transitions": PackedFloat32Array(1, 1),
|
||||
"update": 0,
|
||||
"values": [Vector2(0.5, 0.5), Vector2(0.4, 0.4)]
|
||||
}
|
||||
|
||||
[sub_resource type="AnimationLibrary" id="AnimationLibrary_qjyke"]
|
||||
_data = {
|
||||
&"RESET": SubResource("Animation_ftp6y"),
|
||||
&"idle": SubResource("Animation_pd34m")
|
||||
}
|
||||
|
||||
[sub_resource type="CircleShape2D" id="CircleShape2D_hp5o0"]
|
||||
radius = 115.15642
|
||||
|
||||
[node name="Area2D" type="Area2D" unique_id=1884209541]
|
||||
script = ExtResource("1_8e2im")
|
||||
|
||||
[node name="Arrow001" type="Sprite2D" parent="." unique_id=774581185]
|
||||
scale = Vector2(0.5, 0.5)
|
||||
texture = ExtResource("1_uynht")
|
||||
|
||||
[node name="AnimationPlayer" type="AnimationPlayer" parent="Arrow001" unique_id=684818971]
|
||||
libraries/ = SubResource("AnimationLibrary_qjyke")
|
||||
autoplay = &"idle"
|
||||
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="." unique_id=9151517]
|
||||
shape = SubResource("CircleShape2D_hp5o0")
|
||||
|
||||
[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"]
|
||||
@@ -6,44 +6,31 @@ extends Camera2D
|
||||
var should_move_right = false
|
||||
var should_move_left = false
|
||||
|
||||
@onready var arrow_001: Sprite2D = $"../Arrow001"
|
||||
@onready var arrow_002: Sprite2D = $"../Arrow002"
|
||||
signal move_to_reception_finished
|
||||
signal move_to_dining_room_finished
|
||||
|
||||
|
||||
# Called when the node enters the scene tree for the first time.
|
||||
func _ready() -> void:
|
||||
pass # Replace with function body.
|
||||
|
||||
|
||||
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
||||
func _process(delta: float) -> void:
|
||||
arrow_001.visible = position.x <= 440.0
|
||||
arrow_002.visible = position.x >= 2076.0
|
||||
func move_to_reception() -> void:
|
||||
var camera_tween = get_tree().create_tween()
|
||||
camera_tween.set_ease(Tween.EASE_IN_OUT)
|
||||
camera_tween.set_trans(Tween.TRANS_CUBIC)
|
||||
camera_tween.tween_property(self, "position", Vector2.ZERO, 0.5)
|
||||
camera_tween.tween_callback(on_move_to_reception_finished)
|
||||
|
||||
var limit_left_at_center = limit_left + get_viewport_rect().size.x/2
|
||||
var limit_right_at_center = limit_right - get_viewport_rect().size.x/2
|
||||
if position.x < limit_left_at_center:
|
||||
position.x = limit_left_at_center
|
||||
if position.x > limit_right_at_center:
|
||||
position.x = limit_right_at_center
|
||||
|
||||
if should_move_right and position.x < limit_right_at_center:
|
||||
position.x += pan_speed
|
||||
if should_move_left and position.x > limit_left_at_center:
|
||||
position.x -= pan_speed
|
||||
func on_move_to_reception_finished() -> void:
|
||||
move_to_reception_finished.emit()
|
||||
|
||||
func move_to_dining_room() -> void:
|
||||
var camera_tween = get_tree().create_tween()
|
||||
camera_tween.set_ease(Tween.EASE_IN_OUT)
|
||||
camera_tween.set_trans(Tween.TRANS_CUBIC)
|
||||
camera_tween.tween_property(self, "position", Vector2(2720.0, 0), 0.5)
|
||||
camera_tween.tween_callback(on_move_to_dining_room_finished)
|
||||
|
||||
func on_move_to_dining_room_finished() -> void:
|
||||
move_to_dining_room_finished.emit()
|
||||
|
||||
func _on_pan_right_mouse_entered() -> void:
|
||||
should_move_right = true
|
||||
func _on_arrow_right_on_clicked() -> void:
|
||||
move_to_dining_room()
|
||||
|
||||
|
||||
func _on_pan_right_mouse_exited() -> void:
|
||||
should_move_right = false
|
||||
|
||||
|
||||
func _on_pan_left_mouse_entered() -> void:
|
||||
should_move_left = true
|
||||
|
||||
|
||||
func _on_pan_left_mouse_exited() -> void:
|
||||
should_move_left = false
|
||||
func _on_arrow_left_on_clicked() -> void:
|
||||
move_to_reception()
|
||||
|
||||
@@ -15,7 +15,7 @@ var pref_score_name: Dictionary[CharacterResource.Preference, String] = {
|
||||
}
|
||||
|
||||
@onready var chara: Sprite2D = $"../GuestList/Chara"
|
||||
@onready var mask: Sprite2D = $Mask
|
||||
@onready var mask: Sprite2D = $"../MaskList/Mask"
|
||||
|
||||
@onready var label: Label = $Label
|
||||
|
||||
|
||||
@@ -51,7 +51,7 @@
|
||||
[ext_resource type="Texture2D" uid="uid://dj267xgqniy2i" path="res://assets/decor/table_item_a_2.png" id="43_jucdw"]
|
||||
[ext_resource type="Texture2D" uid="uid://b4u3o7fyryxxq" path="res://assets/decor/table_item_a.png" id="44_6miv3"]
|
||||
[ext_resource type="Texture2D" uid="uid://c3jx3y0mbueoo" path="res://assets/ui/arrow_004.png" id="47_6miv3"]
|
||||
[ext_resource type="Texture2D" uid="uid://cgrudt5ev651p" path="res://assets/ui/arrow_001.png" id="52_yisfj"]
|
||||
[ext_resource type="PackedScene" uid="uid://xwccasmeo5cy" path="res://scenes/arrow/arrow.tscn" id="52_ftp6y"]
|
||||
|
||||
[sub_resource type="AudioStreamRandomizer" id="AudioStreamRandomizer_gkmcc"]
|
||||
random_pitch = 1.122462
|
||||
@@ -97,9 +97,6 @@ Vector2i(-1, -1): {
|
||||
}
|
||||
}
|
||||
|
||||
[sub_resource type="RectangleShape2D" id="RectangleShape2D_ya4ey"]
|
||||
size = Vector2(512, 1080)
|
||||
|
||||
[sub_resource type="Animation" id="Animation_7smn1"]
|
||||
length = 0.001
|
||||
tracks/0/type = "value"
|
||||
@@ -393,44 +390,6 @@ _data = {
|
||||
&"idle": SubResource("Animation_62f45")
|
||||
}
|
||||
|
||||
[sub_resource type="Animation" id="Animation_ftp6y"]
|
||||
length = 0.001
|
||||
tracks/0/type = "value"
|
||||
tracks/0/imported = false
|
||||
tracks/0/enabled = true
|
||||
tracks/0/path = NodePath(".:scale")
|
||||
tracks/0/interp = 1
|
||||
tracks/0/loop_wrap = true
|
||||
tracks/0/keys = {
|
||||
"times": PackedFloat32Array(0),
|
||||
"transitions": PackedFloat32Array(1),
|
||||
"update": 0,
|
||||
"values": [Vector2(0.5, 0.5)]
|
||||
}
|
||||
|
||||
[sub_resource type="Animation" id="Animation_pd34m"]
|
||||
resource_name = "idle"
|
||||
length = 2.0
|
||||
loop_mode = 1
|
||||
tracks/0/type = "value"
|
||||
tracks/0/imported = false
|
||||
tracks/0/enabled = true
|
||||
tracks/0/path = NodePath(".:scale")
|
||||
tracks/0/interp = 2
|
||||
tracks/0/loop_wrap = true
|
||||
tracks/0/keys = {
|
||||
"times": PackedFloat32Array(0, 1),
|
||||
"transitions": PackedFloat32Array(1, 1),
|
||||
"update": 0,
|
||||
"values": [Vector2(0.5, 0.5), Vector2(0.4, 0.4)]
|
||||
}
|
||||
|
||||
[sub_resource type="AnimationLibrary" id="AnimationLibrary_qjyke"]
|
||||
_data = {
|
||||
&"RESET": SubResource("Animation_ftp6y"),
|
||||
&"idle": SubResource("Animation_pd34m")
|
||||
}
|
||||
|
||||
[node name="Main" type="Node2D" unique_id=875553242]
|
||||
script = ExtResource("1_7smn1")
|
||||
|
||||
@@ -467,6 +426,7 @@ lvl2_guest_2 = ExtResource("37_yisfj")
|
||||
lvl3_guest_1 = ExtResource("33_f4j1x")
|
||||
lvl3_guest_2 = ExtResource("29_62f45")
|
||||
lvl3_guest_3 = ExtResource("27_6w6mm")
|
||||
dual_mask_probability = 0.1
|
||||
|
||||
[node name="Camera2D" type="Camera2D" parent="." unique_id=1166192115]
|
||||
limit_left = -960
|
||||
@@ -478,18 +438,6 @@ position_smoothing_speed = 10.0
|
||||
script = ExtResource("14_0bhws")
|
||||
pan_speed = 16.04
|
||||
|
||||
[node name="PanRight" type="Area2D" parent="Camera2D" unique_id=1684320772]
|
||||
position = Vector2(960, 0)
|
||||
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="Camera2D/PanRight" unique_id=1733069282]
|
||||
shape = SubResource("RectangleShape2D_ya4ey")
|
||||
|
||||
[node name="PanLeft" type="Area2D" parent="Camera2D" unique_id=1942262155]
|
||||
position = Vector2(-960, 0)
|
||||
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="Camera2D/PanLeft" unique_id=77276628]
|
||||
shape = SubResource("RectangleShape2D_ya4ey")
|
||||
|
||||
[node name="AnimationPlayer" type="AnimationPlayer" parent="." unique_id=1813843404]
|
||||
libraries/ = SubResource("AnimationLibrary_hxu8e")
|
||||
|
||||
@@ -497,7 +445,7 @@ libraries/ = SubResource("AnimationLibrary_hxu8e")
|
||||
position = Vector2(2711, 22)
|
||||
|
||||
[node name="Table2" parent="." unique_id=141765359 instance=ExtResource("35_r1bmu")]
|
||||
position = Vector2(2029, 236)
|
||||
position = Vector2(2017, 236)
|
||||
|
||||
[node name="Table3" parent="." unique_id=569701756 instance=ExtResource("35_r1bmu")]
|
||||
position = Vector2(3430, 217)
|
||||
@@ -518,6 +466,7 @@ scale = Vector2(0.3, 0.3)
|
||||
texture = ExtResource("44_6miv3")
|
||||
|
||||
[node name="MaskList" parent="." unique_id=437192154 instance=ExtResource("25_6llfj")]
|
||||
visible = false
|
||||
position = Vector2(409, 523)
|
||||
rotation = 0.1675516
|
||||
scale = Vector2(0.99999994, 0.99999994)
|
||||
@@ -539,6 +488,7 @@ scale = Vector2(0.5, 0.5)
|
||||
texture = ExtResource("47_6miv3")
|
||||
|
||||
[node name="GuestList" parent="." unique_id=2089675317 instance=ExtResource("25_6llfj")]
|
||||
visible = false
|
||||
position = Vector2(-409, 523)
|
||||
rotation = -0.16732943
|
||||
|
||||
@@ -578,32 +528,16 @@ texture = ExtResource("39_62f45")
|
||||
libraries/ = SubResource("AnimationLibrary_6g32y")
|
||||
autoplay = &"idle"
|
||||
|
||||
[node name="Arrow001" type="Sprite2D" parent="." unique_id=2051768141]
|
||||
[node name="ArrowRight" parent="." unique_id=774581185 instance=ExtResource("52_ftp6y")]
|
||||
position = Vector2(828, 7)
|
||||
scale = Vector2(0.5, 0.5)
|
||||
texture = ExtResource("52_yisfj")
|
||||
|
||||
[node name="AnimationPlayer" type="AnimationPlayer" parent="Arrow001" unique_id=23670381]
|
||||
libraries/ = SubResource("AnimationLibrary_qjyke")
|
||||
autoplay = &"idle"
|
||||
|
||||
[node name="Arrow002" type="Sprite2D" parent="." unique_id=557480206]
|
||||
position = Vector2(1631.9999, 4.9999995)
|
||||
[node name="ArrowLeft" parent="." unique_id=1884209541 instance=ExtResource("52_ftp6y")]
|
||||
position = Vector2(1810, -241)
|
||||
rotation = 3.1415927
|
||||
scale = Vector2(0.5, 0.5)
|
||||
texture = ExtResource("52_yisfj")
|
||||
|
||||
[node name="AnimationPlayer" type="AnimationPlayer" parent="Arrow002" unique_id=1862466503]
|
||||
libraries/ = SubResource("AnimationLibrary_qjyke")
|
||||
autoplay = &"idle"
|
||||
|
||||
[connection signal="defeat_noise" from="GameManager" to="." method="_on_game_manager_defeat_noise"]
|
||||
[connection signal="ring_bell_noise" from="GameManager" to="." method="_on_game_manager_ring_bell_noise"]
|
||||
[connection signal="victory_noise" from="GameManager" to="." method="_on_game_manager_victory_noise"]
|
||||
[connection signal="mouse_entered" from="Camera2D/PanRight" to="Camera2D" method="_on_pan_right_mouse_entered"]
|
||||
[connection signal="mouse_exited" from="Camera2D/PanRight" to="Camera2D" method="_on_pan_right_mouse_exited"]
|
||||
[connection signal="mouse_entered" from="Camera2D/PanLeft" to="Camera2D" method="_on_pan_left_mouse_entered"]
|
||||
[connection signal="mouse_exited" from="Camera2D/PanLeft" to="Camera2D" method="_on_pan_left_mouse_exited"]
|
||||
[connection signal="seat_clicked" from="Table" to="GameManager" method="on_seat_clicked"]
|
||||
[connection signal="seat_clicked" from="Table2" to="GameManager" method="on_seat_clicked"]
|
||||
[connection signal="seat_clicked" from="Table3" to="GameManager" method="on_seat_clicked"]
|
||||
@@ -616,3 +550,5 @@ autoplay = &"idle"
|
||||
[connection signal="input_event" from="ReadyBell" to="GameManager" method="_on_ready_bell_input_event"]
|
||||
[connection signal="mouse_entered" from="ReadyBell" to="ReadyBell" method="_on_mouse_entered"]
|
||||
[connection signal="mouse_exited" from="ReadyBell" to="ReadyBell" method="_on_mouse_exited"]
|
||||
[connection signal="on_clicked" from="ArrowRight" to="Camera2D" method="_on_arrow_right_on_clicked"]
|
||||
[connection signal="on_clicked" from="ArrowLeft" to="Camera2D" method="_on_arrow_left_on_clicked"]
|
||||
|
||||
@@ -138,12 +138,13 @@ func ending_tween_cb():
|
||||
else:
|
||||
victory_noise.emit()
|
||||
|
||||
await get_tree().create_timer(5).timeout
|
||||
await get_tree().create_timer(4).timeout
|
||||
|
||||
var camera_tween = get_tree().create_tween()
|
||||
camera_tween.set_ease(Tween.EASE_IN_OUT)
|
||||
camera_tween.set_trans(Tween.TRANS_CUBIC)
|
||||
camera_tween.tween_property(camera_2d, "position", Vector2.ZERO, 1.0)
|
||||
camera_tween.tween_property(camera_2d, "position", Vector2.ZERO, 0.5)
|
||||
await get_tree().create_timer(0.5).timeout
|
||||
|
||||
# Progress levels
|
||||
current_game_state = GameState.READY
|
||||
@@ -166,7 +167,6 @@ func _ready() -> void:
|
||||
character.visible = false
|
||||
|
||||
|
||||
|
||||
func _on_ready_bell_input_event(viewport: Node, event: InputEvent, shape_idx: int) -> void:
|
||||
if event is InputEventMouseButton and event.is_pressed():
|
||||
ring_bell_noise.emit()
|
||||
@@ -180,10 +180,12 @@ func on_ready_bell_pressed() -> void:
|
||||
for table in tables:
|
||||
table.initialize()
|
||||
|
||||
guest_list.visible = true
|
||||
if current_level == Levels.LVL1:
|
||||
current_chara_roster = [lvl1_guest_1, lvl1_guest_2]
|
||||
elif current_level == Levels.LVL2:
|
||||
current_chara_roster = [lvl2_guest_1, lvl2_guest_2]
|
||||
mask_list.visible = true
|
||||
elif current_level == Levels.LVL3:
|
||||
current_chara_roster = [lvl3_guest_1, lvl3_guest_2, lvl3_guest_3]
|
||||
else:
|
||||
|
||||
@@ -32,6 +32,7 @@ func initialize() -> void:
|
||||
|
||||
func compute_score() -> float:
|
||||
if seat_1.guest == null and seat_2.guest == null and seat_2.guest == null:
|
||||
print("No guests at table %s" % name)
|
||||
return 0.0
|
||||
|
||||
var score_guest1 = seat_1.guest.compute_score([seat_2.guest, seat_3.guest]) if seat_1.guest != null else 0.0
|
||||
@@ -40,6 +41,7 @@ func compute_score() -> float:
|
||||
|
||||
var table_score = score_guest1 + score_guest2 + score_guest3
|
||||
|
||||
print(table_score)
|
||||
table.visible = false
|
||||
table_defeat.visible = table_score < 0
|
||||
table_victory.visible = table_score >= 0
|
||||
|
||||
Reference in New Issue
Block a user