Fixed merge errors

This commit is contained in:
Jojackman1
2026-01-19 10:41:03 -07:00
parent 9e0eed66c3
commit 985a975577
50 changed files with 1622 additions and 81 deletions

View File

@@ -0,0 +1,52 @@
using Godot;
using System;
public partial class ChangeMenuInitiator : Node
{
float TransitionDelay = 0; // seconds
Node cameFrom;
public void ChangeMenu(string type, string destination, Node cameFromInput)
{
cameFromInput = cameFrom;
if (type == "SLOW")
{
// Load the menu change manager
var scene = GD.Load<PackedScene>("res://Assets/Scenes/MenusAndLevels/MenuChangeManager.tscn");
var inst = (Node2D)scene.Instantiate();
GetTree().Root.GetNode("Camera").AddChild(inst);
inst.Position = GetTree().Root.GetNode("Camera").GetNode<Node2D>("Camera2D").Position;
// Pass args to menu change manager
inst.GetNode<MenuChangeManager>("MenuChangeManager").TargetMenu = destination;
inst.GetNode<MenuChangeManager>("MenuChangeManager").TransitionDelay = TransitionDelay;
// Wait for intro animation to finish before freeing the scene
inst.GetNode<AnimationPlayer>("AnimationPlayer").AnimationFinished += DeleteMenu;
}
if (type == "FAST")
{
var scene = GD.Load<PackedScene>($"res://Assets/Scenes/MenusAndLevels/{destination}.tscn");
var inst = (Node2D)scene.Instantiate();
GetTree().Root.AddChild(inst);
//reset camera
GetTree().Root.GetNode("Camera").GetNode<CameraMovement>("Camera2D").TeleportCamera(Vector2.Zero);
GetTree().Root.GetNode("Camera").GetNode<CameraMovement>("Camera2D").FixedPosition = GetTree().Root.GetNode("Camera").GetNode<Node2D>("Camera2D").Position;
GetTree().Root.GetNode("Camera").SetMeta("CameraMode", "FIXED");
DeleteMenu("LoadIn");
}
}
void DeleteMenu(StringName arg)
{
if (arg == "LoadIn")
{
// Delete current scene (MAKE SURE THE PARENT OF THE PARENT OF THIS SCRIPT IS THE SCENE)
cameFrom.QueueFree();
}
}
}

View File

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

View File

@@ -9,19 +9,9 @@ public partial class CommonData : Node
// Level information
public string CurrentLevel;
// Level high scores
public int Level1HighScore = 0;
public int Level2HighScore = 0;
public int Level3HighScore = 0;
public int Level4HighScore = 0;
public int Level5HighScore = 0;
public int Level6HighScore = 0;
public int Level7HighScore = 0;
public int Level8HighScore = 0;
public int Level9HighScore = 0;
public int Level10HighScore = 0;
public int Level11HighScore = 0;
// Player information
public float CurrentHealth;
public float MaxHealth = 100;
// Levels Completed
public HashSet<string> LevelsCompleted = new HashSet<string>();

View File

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

View File

@@ -0,0 +1,37 @@
using Godot;
using System;
using System.Collections.Generic;
public partial class LevelSelectionManager : Node2D
{
Dictionary<string, string> ConnectionRef = new Dictionary<string, string>();
public override void _Ready()
{
// Create Dictionary
ConnectionRef.Add("Level1", "Level2");
ConnectionRef.Add("Level2", "Level3");
ConnectionRef.Add("Level3", "Level4");
ConnectionRef.Add("Level4", "Level5");
// Disable all levels but the first
foreach (Node2D arg in GetNode("UISelector").GetChildren())
{
if (ConnectionRef.ContainsValue(arg.Name))
arg.SetProcess(false);
}
// Edit buttons according to what is completed
foreach (string arg in GetTree().Root.GetNode<CommonData>("CommonData").LevelsCompleted)
{
if (ConnectionRef.ContainsKey(arg))
{
// Remove fake button
GetNode("FakeButtons").GetNode<Node2D>(ConnectionRef[arg]).Visible = false;
// Add real button
GetNode("UISelector").GetNode<Node2D>(ConnectionRef[arg]).Visible = true;
GetNode("UISelector").GetNode<Node2D>(ConnectionRef[arg]).SetProcess(true);
}
}
}
}

View File

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

View File

@@ -0,0 +1,80 @@
using Godot;
using System;
public partial class MenuChangeManager : Node
{
public string TargetMenu;
public float TransitionDelay = 10;
bool TimerLock = true;
public override void _Ready()
{
// Setup timer
if (TransitionDelay == 10)
{
GD.Randomize();
TransitionDelay += GD.Randf() * 7; // seconds maximum - 10
}
// Connect to signal
GetParent().GetNode<AnimationPlayer>("AnimationPlayer").AnimationFinished += TimerUnlock;
// Stop audio
GetTree().Root.GetNode<CommonData>("CommonData").StopMusic();
}
public override void _Process(double delta)
{
if (TransitionDelay < 0.0f) // Manage waiting
{
TransitionDelay = 1;
TimerLock = true;
SecondHalf();
}
if (TimerLock == false) // Dectiment timer
{
TransitionDelay -= (float)delta;
}
}
void TimerUnlock(StringName arg)
{
if (arg == "LoadIn")
{
TimerLock = false;
}
}
void SecondHalf()
{
//GetTree().Root.GetNode("Camera").GetNode<CameraMovement>("Camera2D").FixedPosition = GetTree().Root.GetNode("Camera").GetNode<Node2D>("Camera2D").Position;
GetTree().Root.GetNode("Camera").GetNode<CameraMovement>("Camera2D").TeleportCamera(Vector2.Zero);
// Load the target menu
var scene = GD.Load<PackedScene>($"res://Assets/Scenes/MenusAndLevels/{TargetMenu}.tscn");
var inst = scene.Instantiate();
GetTree().Root.AddChild(inst);
// Play audio (AUDIO NAME NEEDS TO BE THE SAME NAME AS THE SCENE)
if (ResourceLoader.Exists($"res://Assets/Audio/Music/{TargetMenu}.mp3"))
GetTree().Root.GetNode<CommonData>("CommonData").PlayMusic(TargetMenu);
// Check if the player is there and if it is not then make the camera mode FIXED
var RootChildren = GetTree().Root.GetChildren();
if (RootChildren[2].HasNode("Player") == false)
GetTree().Root.GetNode("Camera").SetMeta("CameraMode", "FIXED");
GetParent().GetNode<AnimationPlayer>("AnimationPlayer").CurrentAnimation = "LoadOut";
// Check when animation is finished
GetParent().GetNode<AnimationPlayer>("AnimationPlayer").AnimationFinished += DeleteMenu;
}
void DeleteMenu(StringName arg)
{
if (arg == "LoadOut")
{
// Delete change manager
GetParent().QueueFree();
}
}
}

View File

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

View File

@@ -0,0 +1,10 @@
using Godot;
using System;
public partial class SceneChangeButton : Button
{
void _on_pressed()
{
GetTree().Root.GetNode("CommonData").GetNode<ChangeMenuInitiator>("ChangeMenuInitiator").ChangeMenu("HTP", "slow",GetParent());
}
}

View File

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

View File

@@ -7,9 +7,7 @@ public partial class TipManager : RichTextLabel
string[] TipList =
{
"Example Tip 1",
"Example Tip 2",
"Example Tip 3"
"Example Tip"
};
public override void _Ready()

View File

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

View File

@@ -3,6 +3,7 @@ using System;
public partial class UI : Node2D
{
public override void _Process(double delta)
{
GlobalPosition = GetTree().Root.GetNode("Camera").GetNode<Node2D>("Camera2D").GlobalPosition;

View File

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

View File

@@ -0,0 +1,46 @@
using Godot;
using System;
using System.Collections.Generic;
public partial class UISelector : Node2D
{
List<Node2D> AvailableOptions = new List<Node2D>();
public Node2D SelectedOption;
int SelectedKey = 0;
Node2D SelectionIndicator;
public override void _Ready()
{
// Set up selection indicator
SelectionIndicator = GetNode<Node2D>("SelectionIndicator");
// Set up list of options
foreach (Node2D option in GetChildren())
{
if (option != SelectionIndicator)
AvailableOptions.Add(option);
}
// Set defaults
SelectedOption = AvailableOptions[SelectedKey];
SelectionIndicator.Position = SelectedOption.Position;
}
public override void _Process(double delta)
{
// Select next option
if(Input.IsActionJustPressed("menu_right") && SelectedKey < AvailableOptions.Count - 1)
{
SelectedKey += 1;
}
// Select previous option
if(Input.IsActionJustPressed("menu_left") && SelectedKey != 0)
{
SelectedKey -= 1;
}
SelectedOption = AvailableOptions[SelectedKey];
SelectionIndicator.Position = SelectedOption.Position;
}
}

View File

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