0.1.0
Added a basic test map, options menu, bug fixes, and much more.
This commit is contained in:
parent
d72b5ac57b
commit
2dce012535
34 changed files with 1268 additions and 84 deletions
|
@ -1,4 +1,4 @@
|
|||
class_name Coffin
|
||||
class_name Coffin
|
||||
extends StaticBody3D
|
||||
|
||||
var caught_player: Player = null
|
||||
|
@ -12,9 +12,7 @@ func _on_dropoff(body: Node3D) -> void:
|
|||
player.released_player.rpc_id(player.get_multiplayer_authority())
|
||||
(player.get_node("ReleaseTimer") as Timer).stop()
|
||||
($DamageTimer as Timer).start()
|
||||
for i: int in range(Multiplayer.players.size()):
|
||||
if Multiplayer.players[i].id == caught_player.get_multiplayer_authority():
|
||||
Multiplayer.players[i].captured = true
|
||||
Multiplayer.players[caught_player.get_multiplayer_authority()].captured = true
|
||||
elif !player.hunter and player.visible and caught_player and caught_player.health > 0:
|
||||
caught_player.go_free.rpc_id(caught_player.get_multiplayer_authority())
|
||||
caught_player = null
|
||||
|
|
|
@ -1,10 +0,0 @@
|
|||
extends Area3D
|
||||
|
||||
func _on_body_entered(body: Node3D) -> void:
|
||||
if multiplayer.is_server() and body is Player:
|
||||
var player: Player = body
|
||||
if !player.hunter:
|
||||
for i: int in range(Multiplayer.players.size()):
|
||||
if Multiplayer.players[i].id == player.get_multiplayer_authority():
|
||||
Multiplayer.players[i].escaped = true
|
||||
player.get_caught.rpc_id(player.get_multiplayer_authority(), $"../SpectatorCamera".get_path())
|
|
@ -1 +0,0 @@
|
|||
uid://bvjyyj4m56b7b
|
|
@ -1,12 +1,16 @@
|
|||
[gd_scene load_steps=3 format=3 uid="uid://dbgqg1wtqmhw3"]
|
||||
[gd_scene load_steps=3 format=3 uid="uid://bncmv3p36y2qg"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://bvjyyj4m56b7b" path="res://entities/escape_area.gd" id="1_ubptc"]
|
||||
[sub_resource type="GDScript" id="GDScript_yuux7"]
|
||||
script/source = "class_name EscapeArea
|
||||
extends Area3D
|
||||
|
||||
"
|
||||
|
||||
[sub_resource type="BoxShape3D" id="BoxShape3D_eij3b"]
|
||||
size = Vector3(10, 10, 10)
|
||||
|
||||
[node name="EscapeArea" type="Area3D"]
|
||||
script = ExtResource("1_ubptc")
|
||||
script = SubResource("GDScript_yuux7")
|
||||
|
||||
[node name="CollisionShape3D" type="CollisionShape3D" parent="."]
|
||||
shape = SubResource("BoxShape3D_eij3b")
|
||||
|
|
|
@ -5,7 +5,7 @@ var done: bool = false
|
|||
|
||||
func _ready() -> void:
|
||||
if multiplayer.is_server():
|
||||
Multiplayer.fuseboxes += 1
|
||||
Multiplayer.add_fusebox.rpc()
|
||||
|
||||
func _on_fixing_started(body: Node3D) -> void:
|
||||
if multiplayer.is_server() and !done and body is Player:
|
||||
|
@ -16,4 +16,4 @@ func _on_fixing_started(body: Node3D) -> void:
|
|||
func complete_fusebox() -> void:
|
||||
($Hinge as Node3D).rotation.y = 0
|
||||
done = true
|
||||
Multiplayer.fuseboxes -= 1
|
||||
Multiplayer.remove_fusebox.rpc()
|
||||
|
|
|
@ -5,16 +5,25 @@ const SPEED: float = 5.0
|
|||
const JUMP_VELOCITY: float = 4.5
|
||||
|
||||
@onready var camera_x: Node3D = $ViewY/ViewX
|
||||
@onready var camera: Camera3D = $ViewY/ViewX/View
|
||||
@onready var spring_arm: SpringArm3D = $ViewY/ViewX/Arm
|
||||
@onready var camera: Camera3D = $ViewY/ViewX/Arm/View
|
||||
|
||||
@onready var syringe: Node3D = $Syringe
|
||||
@onready var needle: Area3D = $Syringe/SyringeNeedle
|
||||
|
||||
@onready var bag: Node3D = $Bag
|
||||
@onready var captured: Node3D = $Bag/Captured
|
||||
|
||||
@onready var mesh: MeshInstance3D = $Mesh
|
||||
@onready var collision: CollisionShape3D = $Collision
|
||||
|
||||
var hunter: bool = true
|
||||
var caught_player: Player = null
|
||||
var new_spawn: Vector3
|
||||
|
||||
var crouching: bool = false
|
||||
var speed_penalty: float = 0.0
|
||||
|
||||
@export var health: int = 100
|
||||
|
||||
func _ready() -> void:
|
||||
|
@ -31,9 +40,9 @@ func _ready() -> void:
|
|||
func _physics_process(delta: float) -> void:
|
||||
# Zoom
|
||||
if Input.is_action_just_released("zoom_in") and camera.position.z > 0:
|
||||
camera.position.z += -1
|
||||
spring_arm.spring_length -= 1
|
||||
elif Input.is_action_just_released("zoom_out"):
|
||||
camera.position.z += 1
|
||||
spring_arm.spring_length += 1
|
||||
|
||||
if is_multiplayer_authority():
|
||||
# Focus
|
||||
|
@ -49,15 +58,31 @@ func _physics_process(delta: float) -> void:
|
|||
velocity += get_gravity() * delta
|
||||
|
||||
# Jumping
|
||||
if Input.is_action_just_pressed("jump") and is_on_floor():
|
||||
if Input.is_action_just_pressed("jump") and is_on_floor() and !crouching:
|
||||
velocity.y = JUMP_VELOCITY
|
||||
if hunter:
|
||||
speed_penalty += 2.0
|
||||
if speed_penalty > SPEED - 1.0:
|
||||
speed_penalty = SPEED - 1.0
|
||||
|
||||
# Crouching
|
||||
if Input.is_action_just_pressed("crouch") and is_on_floor() and !hunter:
|
||||
if crouching:
|
||||
mesh.rotation_degrees.x = 0.0
|
||||
collision.rotation_degrees.x = 0.0
|
||||
camera_x.position.y = 0.5
|
||||
else:
|
||||
mesh.rotation_degrees.x = -90.0
|
||||
collision.rotation_degrees.x = -90.0
|
||||
camera_x.position.y = 0.0
|
||||
crouching = !crouching
|
||||
|
||||
# Movement
|
||||
var input_dir: Vector2 = Input.get_vector("move_left", "move_right", "move_forwards", "move_backwards")
|
||||
var direction: Vector3 = (transform.basis * Vector3(input_dir.x, 0, input_dir.y)).normalized()
|
||||
|
||||
velocity.x = direction.x * SPEED
|
||||
velocity.z = direction.z * SPEED
|
||||
velocity.x = direction.x * (SPEED - speed_penalty)
|
||||
velocity.z = direction.z * (SPEED - speed_penalty)
|
||||
|
||||
# Hunter specific
|
||||
if hunter:
|
||||
|
@ -67,6 +92,11 @@ func _physics_process(delta: float) -> void:
|
|||
syringe.position.z += 0.1
|
||||
syringe.position.z = clampf(syringe.position.z, -0.8, -0.3)
|
||||
|
||||
if speed_penalty > 0.0:
|
||||
speed_penalty -= delta / 3.0
|
||||
if speed_penalty <= 0.0:
|
||||
speed_penalty = 0.0
|
||||
|
||||
if move_and_slide():
|
||||
pass
|
||||
|
||||
|
@ -127,7 +157,7 @@ func get_imprisoned(coffin_path: NodePath) -> void:
|
|||
# This is called on any player that has just stabbed/caught another.
|
||||
@rpc("any_peer", "call_local", "reliable")
|
||||
func capture_player(player_path: NodePath) -> void:
|
||||
if multiplayer.get_remote_sender_id() == 1:
|
||||
if multiplayer.get_remote_sender_id() == 1 and !caught_player:
|
||||
var player: Player = get_node(player_path)
|
||||
caught_player = player
|
||||
captured.visible = true
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
[gd_scene load_steps=6 format=3 uid="uid://4hmftsrl305n"]
|
||||
[gd_scene load_steps=7 format=3 uid="uid://4hmftsrl305n"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://dtlssj0xohnpc" path="res://entities/player.gd" id="1_merdl"]
|
||||
|
||||
|
@ -14,6 +14,8 @@ height = 1.8
|
|||
height = 0.2
|
||||
radius = 0.05
|
||||
|
||||
[sub_resource type="SeparationRayShape3D" id="SeparationRayShape3D_merdl"]
|
||||
|
||||
[sub_resource type="SceneReplicationConfig" id="SceneReplicationConfig_merdl"]
|
||||
properties/0/path = NodePath(".:position")
|
||||
properties/0/spawn = true
|
||||
|
@ -30,6 +32,15 @@ properties/3/replication_mode = 1
|
|||
properties/4/path = NodePath(".:health")
|
||||
properties/4/spawn = true
|
||||
properties/4/replication_mode = 1
|
||||
properties/5/path = NodePath("Bag/Captured:visible")
|
||||
properties/5/spawn = true
|
||||
properties/5/replication_mode = 1
|
||||
properties/6/path = NodePath("Mesh:rotation")
|
||||
properties/6/spawn = true
|
||||
properties/6/replication_mode = 1
|
||||
properties/7/path = NodePath("Collision:rotation")
|
||||
properties/7/spawn = true
|
||||
properties/7/replication_mode = 1
|
||||
|
||||
[node name="Player" type="CharacterBody3D"]
|
||||
script = ExtResource("1_merdl")
|
||||
|
@ -68,8 +79,11 @@ radius = 0.3
|
|||
[node name="ViewX" type="Node3D" parent="ViewY"]
|
||||
transform = Transform3D(1, 0, 0, 0, 0.866025, 0.5, 0, -0.5, 0.866025, 0, 0.5, 0)
|
||||
|
||||
[node name="View" type="Camera3D" parent="ViewY/ViewX"]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 4)
|
||||
[node name="Arm" type="SpringArm3D" parent="ViewY/ViewX"]
|
||||
shape = SubResource("SeparationRayShape3D_merdl")
|
||||
spring_length = 10.0
|
||||
|
||||
[node name="View" type="Camera3D" parent="ViewY/ViewX/Arm"]
|
||||
size = 5.0
|
||||
|
||||
[node name="MultiplayerSynchronizer" type="MultiplayerSynchronizer" parent="."]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue