2023-05-25

This commit is contained in:
Andrey Solomatin 2023-05-26 00:21:46 +03:00
parent 628684ed2c
commit 9d4d3a7b63
8 changed files with 93 additions and 2 deletions

BIN
images/arrow.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 605 B

35
images/arrow.png.import Normal file
View File

@ -0,0 +1,35 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://bfnvenb4ha5dm"
path.s3tc="res://.godot/imported/arrow.png-c10f174082a3fbfbe1894477bdb33238.s3tc.ctex"
metadata={
"imported_formats": ["s3tc_bptc"],
"vram_texture": true
}
[deps]
source_file="res://images/arrow.png"
dest_files=["res://.godot/imported/arrow.png-c10f174082a3fbfbe1894477bdb33238.s3tc.ctex"]
[params]
compress/mode=2
compress/high_quality=false
compress/lossy_quality=0.7
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=true
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=0

View File

@ -47,7 +47,7 @@ func get_local_ip():
for address in local_addresses_array:
if (address.split('.').size() == 4):
local_ip=address
"X11":
"Linux":
local_ip = "localhost"
"Windows":
local_ip = "127.0.0.1"

View File

@ -16,6 +16,7 @@ var gravity = ProjectSettings.get_setting("physics/3d/default_gravity")
# Player synchronized input.
@onready var input = $PlayerInput
func _ready():
# Set the camera as current if we are this player.
if player == multiplayer.get_unique_id():
@ -47,3 +48,12 @@ func _physics_process(delta):
velocity.z = move_toward(velocity.z, 0, SPEED)
move_and_slide()
#func _unhandled_input(event):
# if event is InputEventMouseMotion and Input.get_mouse_mode() == Input.MOUSE_MODE_CAPTURED:
# var event_rotaty_y = deg_to_rad(-input.event_relative.x * 0.10)
# var event_rotaty_x = deg_to_rad(-input.event_relative.y * 0.10)
# rotate_y(event_rotaty_y)
# $Camera3D.rotate_x(event_rotaty_x)
# var cam_rotation_limit = clamp($Camera3D.rotation.x, deg_to_rad(-89), deg_to_rad(89))
# $Camera3D.rotation.x = cam_rotation_limit

View File

@ -1,7 +1,8 @@
[gd_scene load_steps=7 format=3 uid="uid://dkaqqf5anv0bf"]
[gd_scene load_steps=8 format=3 uid="uid://dkaqqf5anv0bf"]
[ext_resource type="Script" path="res://scenes/controllers/Player.gd" id="1_mh1m5"]
[ext_resource type="Script" path="res://scenes/controllers/PlayerInput.gd" id="2_arrkr"]
[ext_resource type="Texture2D" uid="uid://bfnvenb4ha5dm" path="res://images/arrow.png" id="3_g8beb"]
[sub_resource type="SceneReplicationConfig" id="SceneReplicationConfig_ghomm"]
properties/0/path = NodePath(".:player")
@ -45,3 +46,7 @@ mesh = SubResource("CapsuleMesh_b4ty1")
[node name="Camera3D" type="Camera3D" parent="."]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1, 2)
[node name="Sprite3D" type="Sprite3D" parent="."]
transform = Transform3D(8, 0, 0, 0, 5.65685, 5.65685, 0, -5.65685, 5.65685, 1.2, 0.2, 0.1)
texture = ExtResource("3_g8beb")

View File

@ -6,10 +6,15 @@ extends MultiplayerSynchronizer
# Synchronized property.
@export var direction := Vector2()
@export var event_relative := Vector2()
var paused := false
func _ready():
# Only process for the local player
set_process(get_multiplayer_authority() == multiplayer.get_unique_id())
Input.set_mouse_mode(Input.MOUSE_MODE_CAPTURED)
@rpc("call_local")
@ -23,3 +28,15 @@ func _process(delta):
direction = Input.get_vector("move_left", "move_right", "move_forward", "move_backward")
if Input.is_action_just_pressed("ui_accept"):
jump.rpc()
if Input.is_action_just_pressed("ui_cancel"):
if paused == false:
Input.set_mouse_mode(Input.MOUSE_MODE_VISIBLE)
paused = true
else:
Input.set_mouse_mode(Input.MOUSE_MODE_CAPTURED)
paused = false
func _unhandled_input(event):
if event is InputEventMouseMotion and Input.get_mouse_mode() == Input.MOUSE_MODE_CAPTURED:
event_relative = event.relative

Binary file not shown.

View File

@ -0,0 +1,24 @@
[remap]
importer="wav"
type="AudioStreamWAV"
uid="uid://4j02c707wf41"
path="res://.godot/imported/158144__duesto__usp-silenced.wav-1a89ee8d31e52e00e7d7c4525a5d0b4c.sample"
[deps]
source_file="res://sounds/weapons/158144__duesto__usp-silenced.wav"
dest_files=["res://.godot/imported/158144__duesto__usp-silenced.wav-1a89ee8d31e52e00e7d7c4525a5d0b4c.sample"]
[params]
force/8_bit=false
force/mono=false
force/max_rate=false
force/max_rate_hz=44100
edit/trim=false
edit/normalize=false
edit/loop_mode=0
edit/loop_begin=0
edit/loop_end=-1
compress/mode=0