This commit is contained in:
Paul Black 2023-03-05 22:08:14 -07:00
parent 32725e5f26
commit a895ebf791
7 changed files with 106 additions and 3 deletions

View file

@ -91,7 +91,7 @@ func _physics_process(delta):
if Global.playerAlive:
# Handle Jump.
if Input.is_action_just_pressed("ui_accept") and is_on_floor():
if Input.is_action_just_pressed("jump") and is_on_floor():
velocity.y = JUMP_VELOCITY
var input_dir = Input.get_vector("player_left", "player_right", "player_forward", "player_backward")
var direction = (neck.transform.basis * Vector3(input_dir.x, 0, input_dir.y)).normalized()
@ -132,6 +132,13 @@ func _physics_process(delta):
elif Global.consoleOpen:
Input.set_mouse_mode(Input.MOUSE_MODE_CAPTURED)
Global.consoleOpen = false # We remove the scene in console.gd
if Global.roundInSession == false:
if teddyAuthority == 1:
Global.HUDStartLabelText = "PRESS ENTER/RETURN TO START THE ROUND"
if Input.is_action_just_pressed("start_game"):
if teddyAuthority == 1:
Global.roundInSession = true
rpc("round_start")
rpc("remote_set_position", global_position, $CollisionShape3D/Neck/Camera3D/BulletGenerator.global_position, $CollisionShape3D/Neck/Camera3D/BulletGenerator.global_rotation)
rpc("set_teddy_name", teddyName, Global.playerName)
move_and_slide()
@ -165,3 +172,7 @@ func teddy_dead_nomore():
@rpc("any_peer", "unreliable")
func set_teddy_name(node, name):
get_node(node).set_text(name)
@rpc("authority", "reliable", "call_remote")
func round_start():
Global.roundInSession = true

BIN
fonts/League.otf Normal file

Binary file not shown.

33
fonts/League.otf.import Normal file
View file

@ -0,0 +1,33 @@
[remap]
importer="font_data_dynamic"
type="FontFile"
uid="uid://dvvqq2hluaa3o"
path="res://.godot/imported/League.otf-4bf82794605133c3c9f41f6a15f76895.fontdata"
[deps]
source_file="res://fonts/League.otf"
dest_files=["res://.godot/imported/League.otf-4bf82794605133c3c9f41f6a15f76895.fontdata"]
[params]
Rendering=null
antialiasing=1
generate_mipmaps=false
multichannel_signed_distance_field=false
msdf_pixel_range=8
msdf_size=48
allow_system_fallback=true
force_autohinter=false
hinting=1
subpixel_positioning=1
oversampling=0.0
Fallbacks=null
fallbacks=[]
Compress=null
compress=true
preload=[]
language_support={}
script_support={}
opentype_features={}

View file

@ -74,3 +74,14 @@ console_send={
"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":4194309,"key_label":0,"unicode":0,"echo":false,"script":null)
]
}
start_game={
"deadzone": 0.5,
"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":4194309,"key_label":0,"unicode":0,"echo":false,"script":null)
, 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":4194310,"key_label":0,"unicode":0,"echo":false,"script":null)
]
}
jump={
"deadzone": 0.5,
"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":32,"key_label":0,"unicode":32,"echo":false,"script":null)
]
}

View file

@ -1,7 +1,8 @@
[gd_scene load_steps=3 format=3 uid="uid://ytbacsuahxie"]
[gd_scene load_steps=4 format=3 uid="uid://ytbacsuahxie"]
[ext_resource type="Script" path="res://scripts/HUD.gd" id="1_mqiiw"]
[ext_resource type="Texture2D" uid="uid://tjvdle3jlb6g" path="res://textures/crosshair1.png" id="2_5dvrx"]
[ext_resource type="FontFile" uid="uid://dvvqq2hluaa3o" path="res://fonts/League.otf" id="3_x1wqt"]
[node name="HUD" type="Control"]
layout_mode = 3
@ -132,3 +133,34 @@ offset_right = 145.0
offset_bottom = 244.0
text = "Player 10: 0"
horizontal_alignment = 1
[node name="timerPanel" type="Panel" parent="."]
layout_mode = 0
offset_left = 476.0
offset_top = 41.0
offset_right = 674.0
offset_bottom = 116.0
[node name="timer" type="Label" parent="."]
layout_mode = 1
anchors_preset = 5
anchor_left = 0.5
anchor_right = 0.5
offset_left = -91.0
offset_top = 54.0
offset_right = 91.0
offset_bottom = 107.0
grow_horizontal = 2
theme_override_fonts/font = ExtResource("3_x1wqt")
theme_override_font_sizes/font_size = 60
text = "10:00"
[node name="startLabel" type="Label" parent="."]
layout_mode = 0
offset_left = 253.0
offset_top = 560.0
offset_right = 878.0
offset_bottom = 593.0
theme_override_fonts/font = ExtResource("3_x1wqt")
theme_override_font_sizes/font_size = 29
horizontal_alignment = 1

View file

@ -1,10 +1,24 @@
extends Control
var roundTimer := 600.0
var minutes
var seconds
func _ready():
pass
minutes = roundTimer / 60
seconds = fmod(roundTimer, 60)
$timer.text = "%02d:%02d" % [minutes, seconds]
func _process(delta):
$startLabel.text = Global.HUDStartLabelText
$Fatigue.value = Global.fatigue
$Health.value = Global.playerHealth
if Global.roundInSession == true and roundTimer >= 0:
$startLabel.text = ""
roundTimer -= delta
minutes = roundTimer / 60
seconds = fmod(roundTimer, 60)
$timer.text = "%02d:%02d" % [minutes, seconds]
if roundTimer <= 0.0:
Global.HUDStartLabelText = "GAME OVER"

View file

@ -19,6 +19,8 @@ var multiplayerCurrent = false # Whether the player is using multiplayer
var currentMapNode # Defined in map scripts
var teddyAuthorityID # Defined from teddy.gd after object is initalized
var miniMenuResume = false # Set to true by mainmenu.gd
var roundInSession = false # Goes true once the round is started in Teddy.gd
var HUDStartLabelText = "" # The text displayed at the bottom of the screen of the server
func _process(delta):
if godMode: