From 3c0be2d80065bbfa4291425f7500551993773125 Mon Sep 17 00:00:00 2001 From: patrick_pluto Date: Sun, 1 Sep 2024 21:35:29 +0200 Subject: [PATCH] Branch Sync. --- maps/test.tscn | 5 ----- menus/ability_select.tscn | 40 +++++++++++++++++++++++++++++++++++++++ menus/main_menu.tscn | 2 +- objects/player.tscn | 2 +- scripts/ability_select.gd | 11 +++++++++++ scripts/matchmaking.gd | 3 +-- scripts/movement.gd | 16 ++++++++++------ 7 files changed, 64 insertions(+), 15 deletions(-) create mode 100644 menus/ability_select.tscn create mode 100644 scripts/ability_select.gd diff --git a/maps/test.tscn b/maps/test.tscn index be9ed0c..3ba0ca1 100644 --- a/maps/test.tscn +++ b/maps/test.tscn @@ -50,8 +50,3 @@ transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 20, 2, 0) [node name="3" type="Node3D" parent="player_spawns"] transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -20, 2, 0) - -[node name="beast_spawns" type="Node3D" parent="."] - -[node name="0" type="Node3D" parent="beast_spawns"] -transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 5, 0) diff --git a/menus/ability_select.tscn b/menus/ability_select.tscn new file mode 100644 index 0000000..1add32e --- /dev/null +++ b/menus/ability_select.tscn @@ -0,0 +1,40 @@ +[gd_scene load_steps=2 format=3 uid="uid://chat8qnah7px5"] + +[ext_resource type="Script" path="res://scripts/ability_select.gd" id="1_27s6x"] + +[node name="ability" type="Control"] +layout_mode = 3 +anchors_preset = 15 +anchor_right = 1.0 +anchor_bottom = 1.0 +grow_horizontal = 2 +grow_vertical = 2 + +[node name="VBoxContainer" type="VBoxContainer" parent="."] +layout_mode = 1 +anchors_preset = 8 +anchor_left = 0.5 +anchor_top = 0.5 +anchor_right = 0.5 +anchor_bottom = 0.5 +offset_left = -20.0 +offset_top = -20.0 +offset_right = 20.0 +offset_bottom = 20.0 +grow_horizontal = 2 +grow_vertical = 2 +script = ExtResource("1_27s6x") + +[node name="opt0" type="Button" parent="VBoxContainer"] +layout_mode = 2 +theme_override_font_sizes/font_size = 32 +text = "Runner" + +[node name="opt1" type="Button" parent="VBoxContainer"] +layout_mode = 2 +theme_override_font_sizes/font_size = 32 +text = "Jumper +" + +[connection signal="pressed" from="VBoxContainer/opt0" to="VBoxContainer" method="_on_opt_0_pressed"] +[connection signal="pressed" from="VBoxContainer/opt1" to="VBoxContainer" method="_on_opt_1_pressed"] diff --git a/menus/main_menu.tscn b/menus/main_menu.tscn index 082350c..b51e81e 100644 --- a/menus/main_menu.tscn +++ b/menus/main_menu.tscn @@ -61,7 +61,7 @@ grow_vertical = 0 [node name="Label" type="Label" parent="ver_string"] layout_mode = 2 theme_override_font_sizes/font_size = 32 -text = "M9 Development" +text = "M10 Development" horizontal_alignment = 2 [node name="Control" type="Control" parent="."] diff --git a/objects/player.tscn b/objects/player.tscn index 7b5efdb..7f1a840 100644 --- a/objects/player.tscn +++ b/objects/player.tscn @@ -50,7 +50,7 @@ visible = false radius = 0.375 [node name="time_in_bag" type="Timer" parent="."] -wait_time = 30.0 +wait_time = 60.0 one_shot = true [node name="show_fps" type="Timer" parent="."] diff --git a/scripts/ability_select.gd b/scripts/ability_select.gd new file mode 100644 index 0000000..574b496 --- /dev/null +++ b/scripts/ability_select.gd @@ -0,0 +1,11 @@ +extends VBoxContainer + +func _on_opt_0_pressed(): + get_parent().get_parent().speed += 1 + get_parent().get_parent().mouse_locked = true + get_parent().queue_free() + +func _on_opt_1_pressed(): + get_parent().get_parent().jump_debuff -= 2 + get_parent().get_parent().mouse_locked = true + get_parent().queue_free() diff --git a/scripts/matchmaking.gd b/scripts/matchmaking.gd index 6e9b6b1..18caeae 100644 --- a/scripts/matchmaking.gd +++ b/scripts/matchmaking.gd @@ -17,13 +17,12 @@ extends Node const PORT = 35000 -const MAX_CONNECTIONS = 256 +const MAX_CONNECTIONS = 1024 var game_rooms = {} var player_associations = {} var name_associations = {} - func _ready(): multiplayer.peer_disconnected.connect(_on_player_disconnected) multiplayer.peer_connected.connect(_on_player_connected) diff --git a/scripts/movement.gd b/scripts/movement.gd index 1ad0e3f..9f7372e 100644 --- a/scripts/movement.gd +++ b/scripts/movement.gd @@ -32,6 +32,8 @@ var beast = false var mouse_locked = true var is_frozen = false var hp = 100 +var jump_debuff = 5 +var jump_debuff_used = 5 var menu = preload("res://menus/game_menu.tscn") @@ -56,7 +58,8 @@ func _physics_process(delta): if Input.is_action_just_pressed("jump") and is_on_floor() and $jump_timeout.is_stopped(): if beast: - speed -= 5 + jump_debuff_used = jump_debuff + speed -= jump_debuff_used $jump_timeout.start() velocity.y = jump_velocity @@ -114,7 +117,7 @@ func _physics_process(delta): func _input(event): if !npc: - if event is InputEventMouseMotion and !has_node("./game_menu"): + if event is InputEventMouseMotion and mouse_locked: var camera_rotation = event.relative * 0.01 * Game.settings["sensitivity"] if $cam_y.rotation.x <= 1.6 && camera_rotation.y <= 0: $cam_y.rotate(Vector3.RIGHT, -camera_rotation.y) @@ -130,14 +133,16 @@ func _input(event): func beast_init(): if !npc: Game.is_beast = true + add_child(load("res://menus/ability_select.tscn").instantiate()) + mouse_locked = false beast = true - speed += 2 - position = get_parent().find_child("beast_spawns").find_child("0").position + speed += 1 $hammer/CSGBox3D/detect_hit.monitoring = true $hammer/CSGBox3D/detect_hit.monitorable = true $hammer/CSGBox3D/detect_hit/CollisionShape3D.disabled = false $hammer.show() $bag.show() + func _on_detect_hit_body_entered(body): if enabled and body is CharacterBody3D and !got_person: @@ -190,11 +195,10 @@ func _on_time_in_bag_timeout(): position = position_pre $in_bag.visible = false - func _on_show_fps_timeout(): $fps_counter.text = "FPS: "+str(Engine.get_frames_per_second()) $health.text = "HP: "+str(hp) func _on_jump_timeout_timeout(): - speed += 5 + speed += jump_debuff_used