Branch Sync.

This commit is contained in:
patrick_pluto 2024-09-01 21:35:29 +02:00
parent 785bbd8f05
commit 3c0be2d800
7 changed files with 64 additions and 15 deletions

View file

@ -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"] [node name="3" type="Node3D" parent="player_spawns"]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -20, 2, 0) 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)

40
menus/ability_select.tscn Normal file
View file

@ -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"]

View file

@ -61,7 +61,7 @@ grow_vertical = 0
[node name="Label" type="Label" parent="ver_string"] [node name="Label" type="Label" parent="ver_string"]
layout_mode = 2 layout_mode = 2
theme_override_font_sizes/font_size = 32 theme_override_font_sizes/font_size = 32
text = "M9 Development" text = "M10 Development"
horizontal_alignment = 2 horizontal_alignment = 2
[node name="Control" type="Control" parent="."] [node name="Control" type="Control" parent="."]

View file

@ -50,7 +50,7 @@ visible = false
radius = 0.375 radius = 0.375
[node name="time_in_bag" type="Timer" parent="."] [node name="time_in_bag" type="Timer" parent="."]
wait_time = 30.0 wait_time = 60.0
one_shot = true one_shot = true
[node name="show_fps" type="Timer" parent="."] [node name="show_fps" type="Timer" parent="."]

11
scripts/ability_select.gd Normal file
View file

@ -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()

View file

@ -17,13 +17,12 @@
extends Node extends Node
const PORT = 35000 const PORT = 35000
const MAX_CONNECTIONS = 256 const MAX_CONNECTIONS = 1024
var game_rooms = {} var game_rooms = {}
var player_associations = {} var player_associations = {}
var name_associations = {} var name_associations = {}
func _ready(): func _ready():
multiplayer.peer_disconnected.connect(_on_player_disconnected) multiplayer.peer_disconnected.connect(_on_player_disconnected)
multiplayer.peer_connected.connect(_on_player_connected) multiplayer.peer_connected.connect(_on_player_connected)

View file

@ -32,6 +32,8 @@ var beast = false
var mouse_locked = true var mouse_locked = true
var is_frozen = false var is_frozen = false
var hp = 100 var hp = 100
var jump_debuff = 5
var jump_debuff_used = 5
var menu = preload("res://menus/game_menu.tscn") 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 Input.is_action_just_pressed("jump") and is_on_floor() and $jump_timeout.is_stopped():
if beast: if beast:
speed -= 5 jump_debuff_used = jump_debuff
speed -= jump_debuff_used
$jump_timeout.start() $jump_timeout.start()
velocity.y = jump_velocity velocity.y = jump_velocity
@ -114,7 +117,7 @@ func _physics_process(delta):
func _input(event): func _input(event):
if !npc: 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"] var camera_rotation = event.relative * 0.01 * Game.settings["sensitivity"]
if $cam_y.rotation.x <= 1.6 && camera_rotation.y <= 0: if $cam_y.rotation.x <= 1.6 && camera_rotation.y <= 0:
$cam_y.rotate(Vector3.RIGHT, -camera_rotation.y) $cam_y.rotate(Vector3.RIGHT, -camera_rotation.y)
@ -130,14 +133,16 @@ func _input(event):
func beast_init(): func beast_init():
if !npc: if !npc:
Game.is_beast = true Game.is_beast = true
add_child(load("res://menus/ability_select.tscn").instantiate())
mouse_locked = false
beast = true beast = true
speed += 2 speed += 1
position = get_parent().find_child("beast_spawns").find_child("0").position
$hammer/CSGBox3D/detect_hit.monitoring = true $hammer/CSGBox3D/detect_hit.monitoring = true
$hammer/CSGBox3D/detect_hit.monitorable = true $hammer/CSGBox3D/detect_hit.monitorable = true
$hammer/CSGBox3D/detect_hit/CollisionShape3D.disabled = false $hammer/CSGBox3D/detect_hit/CollisionShape3D.disabled = false
$hammer.show() $hammer.show()
$bag.show() $bag.show()
func _on_detect_hit_body_entered(body): func _on_detect_hit_body_entered(body):
if enabled and body is CharacterBody3D and !got_person: if enabled and body is CharacterBody3D and !got_person:
@ -190,11 +195,10 @@ func _on_time_in_bag_timeout():
position = position_pre position = position_pre
$in_bag.visible = false $in_bag.visible = false
func _on_show_fps_timeout(): func _on_show_fps_timeout():
$fps_counter.text = "FPS: "+str(Engine.get_frames_per_second()) $fps_counter.text = "FPS: "+str(Engine.get_frames_per_second())
$health.text = "HP: "+str(hp) $health.text = "HP: "+str(hp)
func _on_jump_timeout_timeout(): func _on_jump_timeout_timeout():
speed += 5 speed += jump_debuff_used