Optimized common data

This commit is contained in:
Jojackman1
2026-01-29 06:36:26 -07:00
parent b58f4412f2
commit 1c4f90fa96
4 changed files with 22 additions and 20 deletions

View File

@@ -14,7 +14,7 @@ public partial class CommonData : Node
// Level information
public string CurrentLevel;
// Player information
// Player stats
public float CurrentHealth;
public float MaxHealth = 100;
@@ -33,13 +33,14 @@ public partial class CommonData : Node
GetTree().Root.CallDeferred(Node.MethodName.AddChild, inst);
// Start game by loading the main menu
scene = GD.Load<PackedScene>("res://Assets/Scenes/MenusAndLevels/MainMenu.tscn");
//scene = GD.Load<PackedScene>("res://Assets/Scenes/DEVSCENES/EnemyTest.tscn");
//scene = GD.Load<PackedScene>("res://Assets/Scenes/MenusAndLevels/MainMenu.tscn");
scene = GD.Load<PackedScene>("res://Assets/Scenes/DEVSCENES/EnemyTest.tscn");
inst = scene.Instantiate();
GetTree().Root.CallDeferred(Node.MethodName.AddChild, inst);
PlayMusic("MainMenu");
// Load in saved data
//....?
}
public override void _Process(double delta)
@@ -49,28 +50,18 @@ public partial class CommonData : Node
GlobalTimer = NumFramesElapsed / FPS;
GlobalTimer = (float)Convert.ToDouble(GlobalTimer.ToString("0.##")); // Truncates seconds elapsed to hundreds place (0.00)
//GD.Print(GlobalTimer);
if (Input.IsActionJustPressed("quit_game")){GetTree().Quit();}
if (Input.IsActionJustPressed("quit_game")) GetTree().Quit();
if (Input.IsActionJustPressed("mute"))
{
if (Muted)
{
Muted = false;
GetNode<AudioStreamPlayer>("AudioStreamPlayer").VolumeDb = 0;
}
else
{
Muted = true;
GetNode<AudioStreamPlayer>("AudioStreamPlayer").VolumeDb = -80;
}
if (Input.IsActionJustPressed("mute")){
Muted = ! Muted;
GetNode<AudioStreamPlayer>("AudioStreamPlayer").VolumeDb = (Muted) ? -80 : 0;
}
}
// BG Audio Management
public void StopMusic(){GetNode<AudioStreamPlayer>("AudioStreamPlayer").Stop();}// Stop whatever audio is playing\
public void PlayMusic(string AudioName)
{
public void PlayMusic(string AudioName){
// Load target audio and play the audio
GetNode<AudioStreamPlayer>("AudioStreamPlayer").Stream = (Godot.AudioStream)GD.Load($"res://Assets/Audio/Music/{AudioName}.mp3");
GetNode<AudioStreamPlayer>("AudioStreamPlayer").Play();

View File

@@ -1,4 +1,4 @@
<Project Sdk="Godot.NET.Sdk/4.5.1">
<Project Sdk="Godot.NET.Sdk/4.6.0">
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<TargetFramework Condition=" '$(GodotTargetPlatform)' == 'android' ">net9.0</TargetFramework>

7
fracturepoint.csproj.old Normal file
View File

@@ -0,0 +1,7 @@
<Project Sdk="Godot.NET.Sdk/4.5.1">
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<TargetFramework Condition=" '$(GodotTargetPlatform)' == 'android' ">net9.0</TargetFramework>
<EnableDynamicLoading>true</EnableDynamicLoading>
</PropertyGroup>
</Project>

View File

@@ -8,11 +8,15 @@
config_version=5
[animation]
compatibility/default_parent_skeleton_in_mesh_instance_3d=true
[application]
config/name="fracturepoint"
run/main_scene="uid://bn5opy6atakg"
config/features=PackedStringArray("4.5", "C#", "GL Compatibility")
config/features=PackedStringArray("4.6", "C#", "GL Compatibility")
run/max_fps=90
config/icon="res://icon.svg"