Moved UI assets to their own folder, updted the code for new version of Godot.
parent
ec411b9f43
commit
7dfd455e2d
BIN
Asset Sources/Weapons/Handgun/Casing.blend (Stored with Git LFS)
BIN
Asset Sources/Weapons/Handgun/Casing.blend (Stored with Git LFS)
Binary file not shown.
|
@ -11,7 +11,7 @@ extends CharacterBody3D
|
|||
@onready var tween = $Head/Camera/Tween
|
||||
|
||||
@onready var ground_check = $GroundCheck
|
||||
@onready var climb_tween = $ClimbTween
|
||||
@onready var climb_tween = $ClimbTween # undergoing redesign in Godot 4
|
||||
@onready var climb_check = $ClimbCheck
|
||||
@onready var body = $Body
|
||||
@onready var mesh = $Mesh
|
||||
|
@ -101,20 +101,31 @@ var gravity_vec := Vector3.ZERO
|
|||
player_name += ['a','b','c', 'd', 'e', 'f'][randi() % 5]
|
||||
|
||||
var color = Color(randf(),randf(),randf())
|
||||
# rpc(&'set_info', PlayerInfo.new(player_name, 0, color).serialize() )
|
||||
rpc(&'set_info', PlayerInfo.new(player_name, 0, color).serialize() )
|
||||
|
||||
@puppet func update_movement(player_transform, head_rotation):
|
||||
global_transform = player_transform
|
||||
head.set_rotation(head_rotation)
|
||||
|
||||
func _ready() -> void:
|
||||
#Input.set_mouse_mode(Input.MOUSE_MODE_CAPTURED)
|
||||
view_zoom = 1.0
|
||||
|
||||
#generate_info()
|
||||
generate_info()
|
||||
|
||||
rpc_config(&'move_and_slide', MultiplayerAPI.RPC_MODE_PUPPETSYNC)
|
||||
rpc_config(&"aim", MultiplayerAPI.RPC_MODE_PUPPETSYNC)
|
||||
rpc_config(&"set_global_transform", MultiplayerAPI.RPC_MODE_PUPPET)
|
||||
rpc_config(&"set_linear_velocity", MultiplayerAPI.RPC_MODE_PUPPET)
|
||||
head.rpc_config(&"set_rotation", MultiplayerAPI.RPC_MODE_PUPPETSYNC)
|
||||
rpc_config(&"set_info", MultiplayerAPI.RPC_MODE_PUPPETSYNC)
|
||||
rpc_config(&'move_and_slide', MultiplayerAPI.RPC_MODE_REMOTE)
|
||||
rpc_config(&"aim", MultiplayerAPI.RPC_MODE_REMOTE)
|
||||
rpc_config(&"set_global_transform", MultiplayerAPI.RPC_MODE_REMOTE)
|
||||
rpc_config(&"set_linear_velocity", MultiplayerAPI.RPC_MODE_REMOTE)
|
||||
head.rpc_config(&"set_rotation", MultiplayerAPI.RPC_MODE_REMOTE)
|
||||
rpc_config(&"set_info", MultiplayerAPI.RPC_MODE_REMOTE)
|
||||
|
||||
# rpc_config(&'move_and_slide', MultiplayerAPI.RPC_MODE_PUPPETSYNC)
|
||||
# rpc_config(&"aim", MultiplayerAPI.RPC_MODE_PUPPETSYNC)
|
||||
# rpc_config(&"set_global_transform", MultiplayerAPI.RPC_MODE_PUPPET)
|
||||
# rpc_config(&"set_linear_velocity", MultiplayerAPI.RPC_MODE_PUPPET)
|
||||
# head.rpc_config(&"set_rotation", MultiplayerAPI.RPC_MODE_PUPPETSYNC)
|
||||
# rpc_config(&"set_info", MultiplayerAPI.RPC_MODE_PUPPETSYNC)
|
||||
|
||||
func aim(event) -> void:
|
||||
var mouse_motion = event as InputEventMouseMotion
|
||||
|
@ -141,8 +152,8 @@ func _input(event) -> void:
|
|||
tween.start()
|
||||
|
||||
# rpc_unreliable(&'aim', event)
|
||||
# aim(event)
|
||||
rpc(&'aim', event)
|
||||
aim(event)
|
||||
# rpc(&'aim', event)
|
||||
|
||||
if Input.is_action_just_pressed("trigger_primary"):
|
||||
weapon.rpc(&'trigger', 0, true)
|
||||
|
@ -156,8 +167,8 @@ func _input(event) -> void:
|
|||
func _physics_process(delta):
|
||||
# rpc_unreliable(&'set_global_transform', global_transform)
|
||||
# head.rpc_unreliable(&'set_rotation', head.get_rotation())
|
||||
rpc(&'set_global_transform', global_transform)
|
||||
head.rpc(&'set_rotation', head.get_rotation())
|
||||
#rpc(&'set_global_transform', global_transform)
|
||||
#head.rpc(&'set_rotation', head.get_rotation())
|
||||
|
||||
direction = Vector3.ZERO
|
||||
|
||||
|
@ -197,17 +208,20 @@ func _physics_process(delta):
|
|||
# rpc_unreliable(&'set_linear_velocity', linear_velocity)
|
||||
# rpc_unreliable(&"move_and_slide")
|
||||
# rpc(&'set_linear_velocity', linear_velocity)
|
||||
rpc(&'move_and_slide')
|
||||
# move_and_slide()
|
||||
# rpc(&'move_and_slide')
|
||||
move_and_slide()
|
||||
|
||||
if not is_on_floor() and not ground_check.is_colliding(): # while in mid-air collisions affect momentum
|
||||
velocity.x = linear_velocity.x
|
||||
velocity.z = linear_velocity.z
|
||||
gravity_vec.y = linear_velocity.y
|
||||
|
||||
# update puppets
|
||||
rpc(&'update_movement', global_transform, head.get_rotation())
|
||||
|
||||
# (stair) climbing
|
||||
|
||||
if get_slide_count() > 1 and climb_check.is_colliding():
|
||||
if get_slide_count() > 1 and climb_check.is_colliding() and false: # disabled - Tween is undergoing redesign in Godot 4
|
||||
#print("climb started at climb state: ", climb_state)
|
||||
var test_y = climb_height * (1 - climb_state)
|
||||
#print("test_y: ", test_y)
|
||||
|
|
Binary file not shown.
Before Width: | Height: | Size: 164 KiB After Width: | Height: | Size: 131 B |
|
@ -1,6 +1,6 @@
|
|||
[gd_scene load_steps=2 format=2]
|
||||
|
||||
[ext_resource path="res://Menu.tscn" type="PackedScene" id=1]
|
||||
[ext_resource path="res://Assets/UI/Menu.tscn" type="PackedScene" id=1]
|
||||
|
||||
[node name="ControlsMenu" instance=ExtResource( 1 )]
|
||||
|
|
@ -1,13 +1,13 @@
|
|||
[gd_scene load_steps=4 format=2]
|
||||
|
||||
[ext_resource path="res://GUI.gd" type="Script" id=1]
|
||||
[ext_resource path="res://Menu.tscn" type="PackedScene" id=2]
|
||||
[ext_resource path="res://MenuButton.tscn" type="PackedScene" id=3]
|
||||
[ext_resource path="res://Assets/UI/MenuButton.tscn" type="PackedScene" id=1]
|
||||
[ext_resource path="res://Assets/UI/Menu.tscn" type="PackedScene" id=2]
|
||||
[ext_resource path="res://Assets/UI/GUI.gd" type="Script" id=3]
|
||||
|
||||
[node name="GUI" type="CenterContainer"]
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
script = ExtResource( 1 )
|
||||
script = ExtResource( 3 )
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
@ -18,7 +18,7 @@ offset_top = 252.0
|
|||
offset_right = 547.0
|
||||
offset_bottom = 347.0
|
||||
|
||||
[node name="Options" parent="Menu" instance=ExtResource( 3 )]
|
||||
[node name="Options" parent="Menu" instance=ExtResource( 1 )]
|
||||
anchor_right = 0.0
|
||||
anchor_bottom = 0.0
|
||||
offset_top = 33.0
|
||||
|
@ -27,7 +27,7 @@ offset_bottom = 62.0
|
|||
text = "options"
|
||||
label = "options"
|
||||
|
||||
[node name="Quit" parent="Menu" instance=ExtResource( 3 )]
|
||||
[node name="Quit" parent="Menu" instance=ExtResource( 1 )]
|
||||
anchor_right = 0.0
|
||||
anchor_bottom = 0.0
|
||||
offset_top = 66.0
|
|
@ -1,8 +1,8 @@
|
|||
[gd_scene load_steps=4 format=2]
|
||||
|
||||
[ext_resource path="res://Menu.tscn" type="PackedScene" id=1]
|
||||
[ext_resource path="res://GraphicsMenu.gd" type="Script" id=2]
|
||||
[ext_resource path="res://MenuCheckButton.tscn" type="PackedScene" id=3]
|
||||
[ext_resource path="res://Assets/UI/Menu.tscn" type="PackedScene" id=1]
|
||||
[ext_resource path="res://Assets/UI/GraphicsMenu.gd" type="Script" id=2]
|
||||
[ext_resource path="res://Assets/UI/MenuCheckButton.tscn" type="PackedScene" id=3]
|
||||
|
||||
[node name="GraphicsMenu" instance=ExtResource( 1 )]
|
||||
script = ExtResource( 2 )
|
|
@ -1,6 +1,6 @@
|
|||
[gd_scene load_steps=2 format=2]
|
||||
|
||||
[ext_resource path="res://Menu.gd" type="Script" id=1]
|
||||
[ext_resource path="res://Assets/UI/Menu.gd" type="Script" id=1]
|
||||
|
||||
[node name="Menu" type="VBoxContainer"]
|
||||
offset_left = 475.0
|
|
@ -1,4 +1,4 @@
|
|||
extends "res://MenuItem.gd"
|
||||
extends "res://Assets/UI/MenuItem.gd"
|
||||
|
||||
func on_label_changed():
|
||||
self.text = label
|
|
@ -1,6 +1,6 @@
|
|||
[gd_scene load_steps=2 format=2]
|
||||
|
||||
[ext_resource path="res://MenuButton.gd" type="Script" id=1]
|
||||
[ext_resource path="res://Assets/UI/MenuButton.gd" type="Script" id=1]
|
||||
|
||||
[node name="MenuButton" type="Button"]
|
||||
anchor_right = 1.0
|
|
@ -1,6 +1,6 @@
|
|||
[gd_scene load_steps=2 format=2]
|
||||
|
||||
[ext_resource path="res://MenuCheckButton.gd" type="Script" id=1]
|
||||
[ext_resource path="res://Assets/UI/MenuCheckButton.gd" type="Script" id=1]
|
||||
|
||||
[node name="MenuCheckButton" type="CheckButton"]
|
||||
anchor_right = 1.0
|
|
@ -0,0 +1,7 @@
|
|||
[gd_scene load_steps=3 format=2]
|
||||
|
||||
[ext_resource path="res://Assets/UI/MenuItem.tscn" type="PackedScene" id=1]
|
||||
[ext_resource path="res://Assets/UI/MenuData.gd" type="Script" id=2]
|
||||
|
||||
[node name="MenuData" instance=ExtResource( 1 )]
|
||||
script = ExtResource( 2 )
|
|
@ -1,6 +1,6 @@
|
|||
[gd_scene load_steps=2 format=2]
|
||||
|
||||
[ext_resource path="res://MenuItem.gd" type="Script" id=1]
|
||||
[ext_resource path="res://Assets/UI/MenuItem.gd" type="Script" id=1]
|
||||
|
||||
[node name="MenuItem" type="Control"]
|
||||
anchor_right = 1.0
|
|
@ -1,7 +1,7 @@
|
|||
[gd_scene load_steps=3 format=2]
|
||||
|
||||
[ext_resource path="res://Menu.tscn" type="PackedScene" id=1]
|
||||
[ext_resource path="res://MenuButton.tscn" type="PackedScene" id=2]
|
||||
[ext_resource path="res://Assets/UI/Menu.tscn" type="PackedScene" id=1]
|
||||
[ext_resource path="res://Assets/UI/MenuButton.tscn" type="PackedScene" id=2]
|
||||
|
||||
[node name="OptionsMenu" instance=ExtResource( 1 )]
|
||||
|
|
@ -19,7 +19,12 @@ var flash = preload("res://Assets/Weapons/Handgun/Flash.tscn")
|
|||
|
||||
$Handgun/AnimationPlayer.play("Shoot", 0, 2.5)
|
||||
|
||||
var flash_effect = flash.instance()
|
||||
var flash_effect
|
||||
if flash.has_method(&"instance"):
|
||||
flash_effect = flash.instance()
|
||||
else:
|
||||
flash_effect = flash.instantiate()
|
||||
|
||||
get_parent().add_child(flash_effect)
|
||||
flash_effect.global_transform = muzzle.global_transform
|
||||
|
||||
|
|
10
Game/Main.gd
10
Game/Main.gd
|
@ -3,7 +3,7 @@ extends Node
|
|||
enum GameFocus {MENU, GAME, CHAT, AWAY}
|
||||
|
||||
const NET_PORT = 12597
|
||||
const NET_SERVER = "localhost"# "liblast.unfa.xyz"
|
||||
const NET_SERVER = "localhost" #liblast.unfa.xyz"
|
||||
|
||||
var peer = NetworkedMultiplayerENet.new()
|
||||
|
||||
|
@ -45,7 +45,13 @@ func _input(_event) -> void:
|
|||
|
||||
|
||||
func create_player(id: int, is_local: bool) -> void:
|
||||
var new_player = player_scene.instance() #tiate()
|
||||
var new_player
|
||||
|
||||
if player_scene.has_method(&"instance"):
|
||||
new_player = player_scene.instance()
|
||||
else:
|
||||
new_player = player_scene.instantiate()
|
||||
|
||||
var spawnpoint = $Map/SpawnPoints.get_children()[randi() % len($Map/SpawnPoints.get_children())]
|
||||
new_player.name = str(id)
|
||||
new_player.global_transform = spawnpoint.global_transform
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
[gd_scene load_steps=5 format=2]
|
||||
|
||||
[ext_resource path="res://Map.tscn" type="PackedScene" id=1]
|
||||
[ext_resource path="res://GUI.tscn" type="PackedScene" id=2]
|
||||
[ext_resource path="res://Assets/UI/GUI.tscn" type="PackedScene" id=2]
|
||||
[ext_resource path="res://Main.gd" type="Script" id=3]
|
||||
[ext_resource path="res://Assets/HUD/HUD.tscn" type="PackedScene" id=4]
|
||||
|
||||
|
|
|
@ -1,7 +0,0 @@
|
|||
[gd_scene load_steps=3 format=2]
|
||||
|
||||
[ext_resource path="res://MenuItem.tscn" type="PackedScene" id=1]
|
||||
[ext_resource path="res://MenuData.gd" type="Script" id=2]
|
||||
|
||||
[node name="MenuData" instance=ExtResource( 1 )]
|
||||
script = ExtResource( 2 )
|
Reference in New Issue