Renamed a bunch of player stuff to pawn stuff and implemented extensive work on getting single-address 'netplay' code working. Not sure if I've created issues with single player but in theory it should all transfer across as if the player is simply always the host.

This commit is contained in:
2026-01-08 07:15:20 -05:00
parent 9fe376e27e
commit ec02685065
69 changed files with 1525 additions and 708 deletions

View File

@@ -1,60 +1,77 @@
extends Control
@onready var menu_list : Array = [
{
"option": %STORY,
"scene" : preload("res://scenes/character_select.tscn")
},
{
"option": %"VS-COM",
"scene" : preload("res://scenes/character_select.tscn")
},
{
"option": %"VS-MAN",
"scene" : preload("res://scenes/multiplayer_setup.tscn")
},
{
"option": %STORY,
"scene" : preload("res://scenes/character_select.tscn")
},
{
"option": %RECORD,
"scene" : preload("res://scenes/character_select.tscn")
},
{
"option": %OPTION,
"scene" : preload("res://scenes/character_select.tscn")
}
]
@onready var switch_sound : AudioStreamPlayer = %SwitchSound
@onready var select_sound : AudioStreamPlayer = %SelectSound
@onready var menu : Control = %Menu
@onready var start : Label = %START
@onready var target : TextureRect = %Target
var opened : bool = false
var menu_choice : int = 0
var shot_tween : Tween
var glow_tween : Tween
@onready var menu_list : Array = [
%STORY,
%"VS-COM",
%"VS-MAN",
%RECORD,
%OPTION
]
var vs_com_scene = preload("res://scenes/character_select.tscn")
func _ready() -> void:
shot_tween = create_tween()
%Target.scale = Vector2(2,2)
%Target.modulate.a = 0
target.scale = Vector2(2,2)
target.modulate.a = 0
shot_tween.set_parallel(true)
shot_tween.tween_property(%Target, "modulate:a", 1, 1)
shot_tween.tween_property(%Target, "scale", Vector2(1,1), 1)
shot_tween.tween_property(%Target, "rotation", PI / 4, 1)
shot_tween.tween_property(target, "modulate:a", 1, 1)
shot_tween.tween_property(target, "scale", Vector2(1,1), 1)
shot_tween.tween_property(target, "rotation", PI / 4, 1)
glow_tween = create_tween()
glow_tween.set_loops(-1)
glow_tween.tween_property(%Target, "modulate:a", .8, .5)
glow_tween.tween_property(%Target, "modulate:a", 1, .5)
glow_tween.tween_property(target, "modulate:a", .8, .5)
glow_tween.tween_property(target, "modulate:a", 1, .5)
func _process(delta: float) -> void:
if Input.is_action_just_pressed("ui_menu"):
opened = !opened
%START.visible = !opened
%Menu.visible = opened
%SelectSound.play()
start.visible = !opened
menu.visible = opened
select_sound.play()
if opened:
menu_choice = 0
switch_menu()
switch_menu(0)
if opened:
if Input.is_action_just_pressed("ui_up"):
menu_choice -= 1
if menu_choice < 0:
menu_choice = len(menu_list) - 1
%SwitchSound.play()
switch_menu()
elif Input.is_action_just_pressed("ui_down"):
menu_choice += 1
if menu_choice >= len(menu_list):
menu_choice = 0
%SwitchSound.play()
switch_menu()
elif Input.is_action_just_pressed("ui_accept"):
Game.switch_scene(vs_com_scene)
var menu_dir = 0
menu_dir += 1 if Input.is_action_just_pressed("ui_down") else 0
menu_dir -= 1 if Input.is_action_just_pressed("ui_up") else 0
if menu_dir != 0:
switch_sound.play()
switch_menu(wrapi(menu_choice + menu_dir, 0, len(menu_list)))
if Input.is_action_just_pressed("ui_accept"):
Game.switch_scene(menu_list[menu_choice].scene)
func switch_menu() -> void:
for child in %Menu.get_children():
child.visible = false
menu_list[menu_choice].visible = true
func switch_menu(new_choice : int) -> void:
menu_list[menu_choice].option.visible = false
menu_choice = new_choice
menu_list[menu_choice].option.visible = true