Physics Tests
This commit is contained in:
parent
c483a438c7
commit
97ac75c936
10 changed files with 69 additions and 56 deletions
0
export_presets.cfg
Normal file
0
export_presets.cfg
Normal file
1
icon.svg
1
icon.svg
|
@ -1 +0,0 @@
|
|||
<svg xmlns="http://www.w3.org/2000/svg" width="128" height="128"><rect width="124" height="124" x="2" y="2" fill="#363d52" stroke="#212532" stroke-width="4" rx="14"/><g fill="#fff" transform="translate(12.322 12.322)scale(.101)"><path d="M105 673v33q407 354 814 0v-33z"/><path fill="#478cbf" d="m105 673 152 14q12 1 15 14l4 67 132 10 8-61q2-11 15-15h162q13 4 15 15l8 61 132-10 4-67q3-13 15-14l152-14V427q30-39 56-81-35-59-83-108-43 20-82 47-40-37-88-64 7-51 8-102-59-28-123-42-26 43-46 89-49-7-98 0-20-46-46-89-64 14-123 42 1 51 8 102-48 27-88 64-39-27-82-47-48 49-83 108 26 42 56 81zm0 33v39c0 276 813 276 814 0v-39l-134 12-5 69q-2 10-14 13l-162 11q-12 0-16-11l-10-65H446l-10 65q-4 11-16 11l-162-11q-12-3-14-13l-5-69z"/><path d="M483 600c0 34 58 34 58 0v-86c0-34-58-34-58 0z"/><circle cx="725" cy="526" r="90"/><circle cx="299" cy="526" r="90"/></g><g fill="#414042" transform="translate(12.322 12.322)scale(.101)"><circle cx="307" cy="532" r="60"/><circle cx="717" cy="532" r="60"/></g></svg>
|
Before Width: | Height: | Size: 994 B |
|
@ -1,37 +0,0 @@
|
|||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://cmoqyf6xfwvl7"
|
||||
path="res://.godot/imported/icon.svg-218a8f2b3041327d8a5756f3a245f83b.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://icon.svg"
|
||||
dest_files=["res://.godot/imported/icon.svg-218a8f2b3041327d8a5756f3a245f83b.ctex"]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=0
|
||||
compress/high_quality=false
|
||||
compress/lossy_quality=0.7
|
||||
compress/hdr_compression=1
|
||||
compress/normal_map=0
|
||||
compress/channel_pack=0
|
||||
mipmaps/generate=false
|
||||
mipmaps/limit=-1
|
||||
roughness/mode=0
|
||||
roughness/src_normal=""
|
||||
process/fix_alpha_border=true
|
||||
process/premult_alpha=false
|
||||
process/normal_map_invert_y=false
|
||||
process/hdr_as_srgb=false
|
||||
process/hdr_clamp_exposure=false
|
||||
process/size_limit=0
|
||||
detect_3d/compress_to=1
|
||||
svg/scale=1.0
|
||||
editor/scale_with_editor_scale=false
|
||||
editor/convert_colors_with_editor_theme=false
|
|
@ -13,7 +13,8 @@ config_version=5
|
|||
config/name="Hotel Madness"
|
||||
run/main_scene="res://start.tscn"
|
||||
config/features=PackedStringArray("4.3", "Forward Plus")
|
||||
config/icon="res://icon.svg"
|
||||
boot_splash/bg_color=Color(0, 0, 0, 1)
|
||||
boot_splash/show_image=false
|
||||
|
||||
[autoload]
|
||||
|
||||
|
@ -73,6 +74,35 @@ window/size/viewport_height=600
|
|||
window/stretch/mode="canvas_items"
|
||||
window/stretch/aspect="expand"
|
||||
|
||||
[input]
|
||||
|
||||
move_forwards={
|
||||
"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":87,"key_label":0,"unicode":119,"location":0,"echo":false,"script":null)
|
||||
]
|
||||
}
|
||||
move_backwards={
|
||||
"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":83,"key_label":0,"unicode":115,"location":0,"echo":false,"script":null)
|
||||
]
|
||||
}
|
||||
move_left={
|
||||
"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":65,"key_label":0,"unicode":97,"location":0,"echo":false,"script":null)
|
||||
]
|
||||
}
|
||||
move_right={
|
||||
"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":68,"key_label":0,"unicode":100,"location":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,"location":0,"echo":false,"script":null)
|
||||
]
|
||||
}
|
||||
|
||||
[rendering]
|
||||
|
||||
textures/vram_compression/import_etc2_astc=true
|
||||
environment/defaults/default_clear_color=Color(0, 0, 0, 1)
|
||||
|
|
|
@ -16,3 +16,4 @@ mesh = SubResource("CapsuleMesh_yly5q")
|
|||
shape = SubResource("CapsuleShape3D_7frjr")
|
||||
|
||||
[node name="Camera3D" type="Camera3D" parent="."]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.5, 0)
|
||||
|
|
|
@ -1,6 +1,9 @@
|
|||
[gd_scene load_steps=2 format=3 uid="uid://cbyee7drds7qu"]
|
||||
[gd_scene load_steps=4 format=3 uid="uid://cbyee7drds7qu"]
|
||||
|
||||
[ext_resource type="Script" path="res://scripts/maps/map.gd" id="1_4npcs"]
|
||||
[ext_resource type="PackedScene" uid="uid://bsghm187n6ykx" path="res://scenes/objects/closet.tscn" id="2_yvpvm"]
|
||||
|
||||
[sub_resource type="Environment" id="Environment_pq0iv"]
|
||||
|
||||
[node name="Testmap" type="Node3D"]
|
||||
script = ExtResource("1_4npcs")
|
||||
|
@ -20,9 +23,11 @@ transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 16, 4, 0)
|
|||
[node name="2" type="Node3D" parent="PlayerSpawn"]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 3, 15)
|
||||
|
||||
[node name="Camera3D" type="Camera3D" parent="."]
|
||||
transform = Transform3D(0.707107, -0.353553, 0.612372, 0, 0.866025, 0.5, -0.707107, -0.353553, 0.612372, 43, 20, 43)
|
||||
current = true
|
||||
|
||||
[node name="DirectionalLight3D" type="DirectionalLight3D" parent="."]
|
||||
transform = Transform3D(-0.965926, 0.258819, 0, -0.224144, -0.836516, 0.5, 0.12941, 0.482963, 0.866025, 0, 0, 0)
|
||||
transform = Transform3D(-0.899519, 0.375, 0.224144, -0.224144, -0.836516, 0.5, 0.375, 0.399519, 0.836516, 0, 0, 0)
|
||||
|
||||
[node name="WorldEnvironment" type="WorldEnvironment" parent="."]
|
||||
environment = SubResource("Environment_pq0iv")
|
||||
|
||||
[node name="Closet" parent="." instance=ExtResource("2_yvpvm")]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -2, 10, 2)
|
||||
|
|
15
scenes/objects/closet.tscn
Normal file
15
scenes/objects/closet.tscn
Normal file
|
@ -0,0 +1,15 @@
|
|||
[gd_scene load_steps=3 format=3 uid="uid://bsghm187n6ykx"]
|
||||
|
||||
[sub_resource type="BoxMesh" id="BoxMesh_qilbd"]
|
||||
size = Vector3(1, 2, 1)
|
||||
|
||||
[sub_resource type="BoxShape3D" id="BoxShape3D_by26a"]
|
||||
size = Vector3(1, 2, 1)
|
||||
|
||||
[node name="Closet" type="RigidBody3D"]
|
||||
|
||||
[node name="MeshInstance3D" type="MeshInstance3D" parent="."]
|
||||
mesh = SubResource("BoxMesh_qilbd")
|
||||
|
||||
[node name="CollisionShape3D" type="CollisionShape3D" parent="."]
|
||||
shape = SubResource("BoxShape3D_by26a")
|
|
@ -22,10 +22,10 @@ func _physics_process(delta: float) -> void:
|
|||
if not is_on_floor():
|
||||
velocity += get_gravity() * delta
|
||||
|
||||
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: Vector2 = Input.get_vector("ui_left", "ui_right", "ui_up", "ui_down")
|
||||
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()
|
||||
|
||||
if direction:
|
||||
|
|
|
@ -13,7 +13,7 @@ func error(message: String, alert_message: String) -> void:
|
|||
if OS.shell_open(OS.get_user_data_dir()) != OK:
|
||||
Log.warning("Couldn't open file explorer!")
|
||||
else:
|
||||
OS.alert("An error has occured. The program will now exit.", "Error!")
|
||||
OS.alert("An error has occurred. The program will now exit.", "Error!")
|
||||
get_tree().quit()
|
||||
mutex.unlock()
|
||||
|
||||
|
|
|
@ -17,7 +17,6 @@ func _ready() -> void:
|
|||
if playerlist_changed.connect(_on_playerlist_changed) != OK:
|
||||
Log.error("FAILED to connect the playerlist_changed signal to _on_playerlist_changed!", "Internal Error: Failed to connect signal.")
|
||||
|
||||
|
||||
func _on_playerlist_changed() -> void:
|
||||
pass
|
||||
|
||||
|
@ -44,6 +43,7 @@ func join_server() -> Error:
|
|||
# Close all network connections.
|
||||
func close_network() -> void:
|
||||
multiplayer.multiplayer_peer = null
|
||||
Input.set_mouse_mode(Input.MOUSE_MODE_VISIBLE)
|
||||
Log.info("Closed all network connections.")
|
||||
|
||||
## Matchmaking Code
|
||||
|
@ -152,7 +152,6 @@ func peer_disconnected_message(id: int) -> void:
|
|||
return
|
||||
Log.info("Peer %d successfully removed." % id)
|
||||
|
||||
|
||||
# This is the initial server response, which tells the client what its role is.
|
||||
@rpc("authority", "call_remote", "reliable")
|
||||
func server_response(status: int, manager: int) -> void:
|
||||
|
@ -217,7 +216,7 @@ func request_playerlist(peername: String) -> void:
|
|||
Log.warning("Couldn't send failure response to peer %d!" % multiplayer.get_remote_sender_id())
|
||||
Log.warning("Peer %d tried to send this client a request meant for the room host!" % multiplayer.get_remote_sender_id())
|
||||
|
||||
# Recive the playerlist on the client.
|
||||
# Receive the playerlist on the client.
|
||||
@rpc("any_peer", "call_remote", "reliable")
|
||||
func send_playerlist(status: int, newPeers: Dictionary) -> void:
|
||||
if multiplayer.get_remote_sender_id() == managerID:
|
||||
|
@ -229,7 +228,7 @@ func send_playerlist(status: int, newPeers: Dictionary) -> void:
|
|||
Log.error("Couldn't change to the lobby scene! Closing application.", "Couldn't change to the lobby scene!")
|
||||
1:
|
||||
peers = newPeers
|
||||
Log.debug("Playerlist recived.")
|
||||
Log.debug("Playerlist received.")
|
||||
if emit_signal("playerlist_changed") != OK:
|
||||
Log.warning("Couldn't emit playerlist_changed signal.")
|
||||
2:
|
||||
|
@ -265,10 +264,11 @@ func start_game() -> void:
|
|||
|
||||
func player_sync_call(position: Vector3, rotation: Vector3) -> void:
|
||||
for peer: int in Networking.get_ids():
|
||||
if rpc_id(peer, "player_sync", position, rotation) != OK:
|
||||
Log.warning("Couldn't send RPC to %d!" % peer)
|
||||
if peer != multiplayer.get_unique_id():
|
||||
if rpc_id(peer, "player_sync", position, rotation) != OK:
|
||||
Log.warning("Couldn't send RPC to %d!" % peer)
|
||||
|
||||
# Starts the game.
|
||||
# Synchronizes the player state.
|
||||
@rpc("any_peer", "call_local", "reliable")
|
||||
func player_sync(position: Vector3, rotation: Vector3) -> void:
|
||||
if verify_id(multiplayer.get_remote_sender_id()):
|
||||
|
|
Loading…
Reference in a new issue