feat: Implement core Player character with networking, movement, and character selection logic, along with a new pointer shader.

This commit is contained in:
Yogi Wiguna
2026-03-16 12:18:00 +08:00
parent 855b05b017
commit 07387e67af
3 changed files with 22 additions and 4 deletions
@@ -0,0 +1,8 @@
shader_type spatial;
render_mode unshaded, blend_mix, depth_draw_opaque;
uniform vec4 pointer_color : source_color = vec4(0.0, 1.0, 0.0, 1.0);
void fragment() {
ALBEDO = pointer_color.rgb;
}
@@ -0,0 +1 @@
uid://kadpokx0uoai
+13 -4
View File
@@ -219,13 +219,22 @@ func _ready():
$Name.text = display_name $Name.text = display_name
# Character Pointer Visibility # Character Pointer Visibility
# Show only for our local player (not bots, not other players) # Visible to all human players. Green for local player, Red for others.
var pointer = get_node_or_null("CharacterPointer") var pointer = get_node_or_null("CharacterPointer")
if pointer: if pointer:
if is_bot or is_in_group("Bots"): pointer.visible = true
pointer.visible = false
var pointer_shader = load("res://assets/shaders/character_pointer.gdshader")
var mat = ShaderMaterial.new()
mat.shader = pointer_shader
if is_multiplayer_authority():
mat.set_shader_parameter("pointer_color", Color(0.0, 1.0, 0.0, 1.0)) # Green
else: else:
pointer.visible = is_multiplayer_authority() mat.set_shader_parameter("pointer_color", Color(1.0, 0.0, 0.0, 1.0)) # Red
if pointer is MeshInstance3D:
pointer.material_override = mat
# Sync name to other peers if this is our local player or a bot we own # Sync name to other peers if this is our local player or a bot we own
if is_multiplayer_authority() and can_rpc(): if is_multiplayer_authority() and can_rpc():