diff options
author | metamuffin <metamuffin@disroot.org> | 2024-06-26 21:27:40 +0200 |
---|---|---|
committer | metamuffin <metamuffin@disroot.org> | 2024-06-26 21:27:40 +0200 |
commit | e38a2ee78910edcec4425c07903e36fb5749ae3b (patch) | |
tree | 963b24ec9d73d98b46c1fff1bb6d10d043dc6285 | |
parent | 18e9409739ceefef970dd509709a1f7b0c1c15e4 (diff) | |
parent | cbe0201f67eaa751434786e23da3311761f5e776 (diff) | |
download | hurrycurry-e38a2ee78910edcec4425c07903e36fb5749ae3b.tar hurrycurry-e38a2ee78910edcec4425c07903e36fb5749ae3b.tar.bz2 hurrycurry-e38a2ee78910edcec4425c07903e36fb5749ae3b.tar.zst |
Merge branch 'master' of https://codeberg.org/metamuffin/undercooked
-rw-r--r-- | client/global.gd | 2 | ||||
-rw-r--r-- | client/menu/character_menu.gd | 6 | ||||
-rw-r--r-- | client/menu/ingame_menu.gd | 1 | ||||
-rw-r--r-- | client/menu/ingame_menu.tscn | 6 | ||||
-rw-r--r-- | client/menu/menu_manager.gd | 8 | ||||
-rw-r--r-- | client/menu/menu_manager.tscn | 9 | ||||
-rw-r--r-- | client/menu/scene_transition.gd | 11 | ||||
-rw-r--r-- | client/player/controllable_player.gd | 4 | ||||
-rw-r--r-- | client/project.godot | 6 | ||||
-rw-r--r-- | server/src/customer/movement.rs | 4 | ||||
-rw-r--r-- | test-client/movement.ts | 4 |
11 files changed, 45 insertions, 16 deletions
diff --git a/client/global.gd b/client/global.gd index 6e12d0cf..ee1e3e96 100644 --- a/client/global.gd +++ b/client/global.gd @@ -40,6 +40,8 @@ var settings: Dictionary var server_url = "" var error_message = "" +var fade_next := false # Set true when transitioning from another scene (fade in requried) + func _ready(): profile = load_dict("user://profile", DEFAULT_PROFILE) settings = load_dict("user://settings", default_settings) diff --git a/client/menu/character_menu.gd b/client/menu/character_menu.gd index 3e535e71..80fcdcb6 100644 --- a/client/menu/character_menu.gd +++ b/client/menu/character_menu.gd @@ -17,13 +17,19 @@ extends Control @onready var character: Character = $Character @onready var num_hairstyles := character.hairstyles.keys().size() +@onready var back_button := $VBoxContainer/bottom_panel/back func _ready(): $VBoxContainer/top_panel/a/username.text = Global.profile["username"] character.select_hairstyle(Global.profile["character"]) Global.focus_first_button(self) +func _input(event): + if Input.is_action_just_pressed("ui_cancel"): + _on_back_pressed() + func _on_back_pressed(): + Global.fade_next = true $SceneTransition.transition_to("res://menu/menu_manager.tscn") func _on_username_text_changed(new_text): diff --git a/client/menu/ingame_menu.gd b/client/menu/ingame_menu.gd index 4752c382..73f4dbb3 100644 --- a/client/menu/ingame_menu.gd +++ b/client/menu/ingame_menu.gd @@ -14,6 +14,7 @@ func deact(): hide() func _on_main_menu_pressed(): + Global.fade_next = true get_parent().transition_to("res://menu/menu_manager.tscn") func _on_quit_pressed(): diff --git a/client/menu/ingame_menu.tscn b/client/menu/ingame_menu.tscn index 79b4efb1..725735ea 100644 --- a/client/menu/ingame_menu.tscn +++ b/client/menu/ingame_menu.tscn @@ -72,7 +72,7 @@ anchors_preset = 9 anchor_bottom = 1.0 offset_left = -400.0 offset_right = -90.0 -offset_bottom = 2592.0 +offset_bottom = 3888.0 grow_vertical = 2 [node name="Margin" type="MarginContainer" parent="Side"] @@ -105,12 +105,12 @@ alignment = 0 [node name="MainMenu" type="Button" parent="Side/Margin/Options"] layout_mode = 2 -text = "Main Menu" +text = "Main menu" alignment = 0 [node name="Quit" type="Button" parent="Side/Margin/Options"] layout_mode = 2 -text = "Quit" +text = "Quit game" alignment = 0 [connection signal="pressed" from="Side/Margin/Options/Reconnect" to="." method="_on_reconnect_pressed"] diff --git a/client/menu/menu_manager.gd b/client/menu/menu_manager.gd index 69866377..079f6e44 100644 --- a/client/menu/menu_manager.gd +++ b/client/menu/menu_manager.gd @@ -12,6 +12,14 @@ var menu_stack = ["main"] func _ready(): Global.focus_first_button(menus[menu_stack.back()]) + + if Global.fade_next: + Global.fade_next = false + transition.fade_in() + +func _input(event): + if Input.is_action_just_pressed("ui_cancel") && menu_stack.size() > 1: + go_back() func goto(menu_name: String): show_menu(menu_name) diff --git a/client/menu/menu_manager.tscn b/client/menu/menu_manager.tscn index 6b2d7b33..18e13282 100644 --- a/client/menu/menu_manager.tscn +++ b/client/menu/menu_manager.tscn @@ -30,9 +30,6 @@ visible = false layout_mode = 1 [node name="SceneTransition" parent="." instance=ExtResource("6_p4u45")] -layout_mode = 0 -anchors_preset = 0 -anchor_right = 0.0 -anchor_bottom = 0.0 -grow_horizontal = 1 -grow_vertical = 1 +visible = false +layout_mode = 1 +auto_fade_in = false diff --git a/client/menu/scene_transition.gd b/client/menu/scene_transition.gd index 87a1ec1b..30c7e1df 100644 --- a/client/menu/scene_transition.gd +++ b/client/menu/scene_transition.gd @@ -19,8 +19,16 @@ extends ColorRect @onready var anim = $animation @export var ingame = false +@export var auto_fade_in := true + func _ready(): - self.visible = true + if auto_fade_in: + fade_in() + else: + visible = false + +func fade_in(): + visible = true anim.play("fade_in") func transition_to(path: String): @@ -35,6 +43,7 @@ func quit(): get_tree().quit() func out(): + visible = true if menu.visible: menu.anim.play_backwards("activate") await menu.anim.animation_finished diff --git a/client/player/controllable_player.gd b/client/player/controllable_player.gd index a2321fef..a677fdb3 100644 --- a/client/player/controllable_player.gd +++ b/client/player/controllable_player.gd @@ -18,8 +18,8 @@ class_name ControllablePlayer extends Player const PLAYER_FRICTION = 10 -const PLAYER_SPEED = 40 -const BOOST_FACTOR = 3 +const PLAYER_SPEED = 55 +const BOOST_FACTOR = 2.5 const BOOST_DURATION = 0.3 const BOOST_RESTORE = 0.5 diff --git a/client/project.godot b/client/project.godot index f8a060d1..e4198843 100644 --- a/client/project.godot +++ b/client/project.godot @@ -31,6 +31,12 @@ ui_accept={ , Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":-1,"button_index":0,"pressure":0.0,"pressed":true,"script":null) ] } +ui_cancel={ +"deadzone": 0.5, +"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":4194305,"physical_keycode":0,"key_label":0,"unicode":0,"echo":false,"script":null) +, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":-1,"button_index":1,"pressure":0.0,"pressed":true,"script":null) +] +} forward={ "deadzone": 0.1, "events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":87,"key_label":0,"unicode":119,"echo":false,"script":null) diff --git a/server/src/customer/movement.rs b/server/src/customer/movement.rs index a189ddce..c6350ebd 100644 --- a/server/src/customer/movement.rs +++ b/server/src/customer/movement.rs @@ -21,8 +21,8 @@ use std::collections::HashSet; const PLAYER_SIZE: f32 = 0.4; const PLAYER_FRICTION: f32 = 10.0; -const PLAYER_SPEED: f32 = 40.0; -const BOOST_FACTOR: f32 = 3.0; +const PLAYER_SPEED: f32 = 55.0; +const BOOST_FACTOR: f32 = 2.5; const BOOST_DURATION: f32 = 0.3; const BOOST_RESTORE: f32 = 0.5; diff --git a/test-client/movement.ts b/test-client/movement.ts index 933b6af5..fcb2e0ba 100644 --- a/test-client/movement.ts +++ b/test-client/movement.ts @@ -21,8 +21,8 @@ import { V2, normalize, length, sub_v2, lerp_exp_v2_mut } from "./util.ts"; export const PLAYER_SIZE = 0.4 export const PLAYER_FRICTION = 10 -export const PLAYER_SPEED = 40 -export const BOOST_FACTOR = 3 +export const PLAYER_SPEED = 55 +export const BOOST_FACTOR = 2.5 export const BOOST_DURATION = 0.3 export const BOOST_RESTORE = 0.5 |