First commit

This commit is contained in:
2025-12-04 11:13:48 -05:00
commit 5d8452c70d
39 changed files with 1509 additions and 0 deletions

4
scripts/autos/game.gd Normal file
View File

@@ -0,0 +1,4 @@
extends Node
var player : Player

View File

@@ -0,0 +1 @@
uid://cro6hr2qds783

View File

@@ -0,0 +1,30 @@
extends Node
const SERVER_PORT = 8080
const SERVER_IP = "127.0.0.1"
func become_host() -> void:
print("Starting host!")
var server_peer = ENetMultiplayerPeer.new()
server_peer.create_server(SERVER_PORT)
multiplayer.multiplayer_peer = server_peer
multiplayer.peer_connected.connect(_add_player_to_game)
multiplayer.peer_disconnected.connect(_remove_player_from_game)
func join_game() -> void:
print("Player 2 joining.")
var client_peer = ENetMultiplayerPeer.new()
client_peer.create_client(SERVER_IP, SERVER_PORT)
func _add_player_to_game(id : int) -> void:
print("Player %s joined the game!" % id)
func _remove_player_from_game(id : int) -> void:
print("Player %s left the game!" % id)

View File

@@ -0,0 +1 @@
uid://dhrl1x443cqt1

18
scripts/level_camera.gd Normal file
View File

@@ -0,0 +1,18 @@
extends Camera3D
var target
var offset : Vector3
func _enter_tree() -> void:
call_deferred("register_player")
func register_player() -> void:
target = Game.player
offset = global_position - target.global_position
func _process(delta: float) -> void:
if target:
global_position = target.global_position + offset

View File

@@ -0,0 +1 @@
uid://cymi1n4gavixy

View File

@@ -0,0 +1,16 @@
class_name MultiplayerPlayer extends Player
@export var player_id := 1 :
set(id):
player_id = id
func _enter_tree() -> void:
Game.player = self
func _physics_process(delta: float) -> void:
var dir = Input.get_vector("west", "east", "north", "south")
dir = Vector3(dir.x, 0, dir.y)
if dir.length_squared() > 0:
body.look_at(body.global_position - dir)
velocity = speed * dir
move_and_slide()

View File

@@ -0,0 +1 @@
uid://wpjuowslx60b

View File

@@ -0,0 +1,54 @@
extends Control
var host : bool
func _on_host_game_button_pressed() -> void:
%Menu.visible = false
%Hosting.visible = true
host = true
func _on_join_game_button_pressed() -> void:
%Menu.visible = false
%Joining.visible = true
host = false
func _on_menu_back_button_pressed() -> void:
Game.go_to_title_screen()
func _on_start_hosting_button_pressed() -> void:
#Validate entries
%Hosting.visible = false
#Set fields
%"Host Waiting".visible = true
func _on_hosting_back_button_pressed() -> void:
%Hosting.visible = false
%Menu.visible = true
func _on_start_game_button_pressed() -> void:
Game.start_vs_com()
func _on_waiting_back_button_pressed() -> void:
%"Host Waiting".visible = false
if host:
%Hosting.visible = true
else:
%Joining.visible = true
func _on_join_button_pressed() -> void:
#Check for valid game
#If found
%Joining.visible = false
%"Host Waiting".visible = true
func _on_joining_back_button_pressed() -> void:
%Joining.visible = false
%Menu.visible = true

View File

@@ -0,0 +1 @@
uid://dep7nr2nkdmga

15
scripts/player.gd Normal file
View File

@@ -0,0 +1,15 @@
class_name Player extends CharacterBody3D
@export var speed : float = 10
@onready var body = $Body
func _enter_tree() -> void:
Game.player = self
func _physics_process(delta: float) -> void:
var dir = Input.get_vector("west", "east", "north", "south")
dir = Vector3(dir.x, 0, dir.y)
if dir.length_squared() > 0:
body.look_at(body.global_position - dir)
velocity = speed * dir
move_and_slide()

1
scripts/player.gd.uid Normal file
View File

@@ -0,0 +1 @@
uid://bcs7ygh6s3l35

9
scripts/static.gd Normal file
View File

@@ -0,0 +1,9 @@
@tool
extends TextureRect
@export var tex : NoiseTexture2D
func _enter_tree() -> void:
pass
func _process(delta : float) -> void:
pass

1
scripts/static.gd.uid Normal file
View File

@@ -0,0 +1 @@
uid://bnmklbse62lrf

41
scripts/title_screen.gd Normal file
View File

@@ -0,0 +1,41 @@
extends Control
var opened : bool = false
var menu_choice : int = 0
@onready var menu_list : Array = [
%STORY,
%"VS-COM",
%"VS-MAN",
%RECORD,
%OPTION
]
func _process(delta: float) -> void:
if Input.is_action_just_pressed("ui_menu"):
opened = !opened
%START.visible = !opened
%Menu.visible = opened
%SelectSound.play()
if opened:
menu_choice = 0
switch_menu()
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()
func switch_menu() -> void:
for child in %Menu.get_children():
child.visible = false
menu_list[menu_choice].visible = true

View File

@@ -0,0 +1 @@
uid://dhu2psbhh1rl8