Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion project.godot
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ config_version=5
[application]

config/name="Funk Engine"
run/main_scene="res://scenes/BattleDirector/test_battle_scene.tscn"
run/main_scene="res://scenes/TestTransition/testTransition.tscn"
config/features=PackedStringArray("4.3", "C#", "Forward Plus")
config/icon="res://icon.svg"

Expand Down
17 changes: 16 additions & 1 deletion scenes/BattleDirector/test_battle_scene.tscn
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
[gd_scene load_steps=7 format=3 uid="uid://b0mrgr7h0ty1y"]
[gd_scene load_steps=10 format=3 uid="uid://b0mrgr7h0ty1y"]

[ext_resource type="Script" path="res://scenes/BattleDirector/scripts/BattleDirector.cs" id="1_cwqqr"]
[ext_resource type="PackedScene" uid="uid://dfevfib11kou1" path="res://scenes/ChartViewport/ChartViewport.tscn" id="2_cupb3"]
[ext_resource type="Script" path="res://scenes/BattleDirector/scripts/Conductor.cs" id="2_pcp76"]
[ext_resource type="Texture2D" uid="uid://ci0g72j8q4ec2" path="res://scenes/BattleDirector/assets/CoolBG.jpg" id="4_13o87"]
[ext_resource type="PackedScene" uid="uid://duhiilcv4tat3" path="res://scenes/BattleDirector/NotePlacementBar.tscn" id="7_3ko4g"]
[ext_resource type="AudioStream" uid="uid://cv6lqjj6lu36h" path="res://Audio/335571__magntron__gamemusic_120bpm.mp3" id="8_caqms"]
[ext_resource type="Script" path="res://scripts/SceneChange.cs" id="9_bxa6e"]

[node name="ProtoBattleDirector" type="Node2D" node_paths=PackedStringArray("CM", "NotePlacementBar", "CD", "Audio")]
script = ExtResource("1_cwqqr")
Expand Down Expand Up @@ -48,6 +49,20 @@ offset_top = 164.0
offset_right = 16.0
offset_bottom = 164.0

[node name="Control" type="Control" parent="."]
layout_mode = 3
anchors_preset = 0
offset_right = 40.0
offset_bottom = 40.0

[node name="Button" type="Button" parent="Control"]
layout_mode = 0
offset_right = 8.0
offset_bottom = 8.0
text = "Return to Title"
script = ExtResource("9_bxa6e")
ScenePath = "res://scenes/TestTransition/testTransition.tscn"

[node name="TempRelicList" type="Label" parent="."]
offset_left = 564.0
offset_top = 165.0
Expand Down
11 changes: 11 additions & 0 deletions scenes/ChartViewport/ChartManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -127,4 +127,15 @@ private NoteArrow CreateNote(ArrowType arrow, int beat = 0)
newArrow.Position += Vector2.Right * newArrow.Bounds * 10; //temporary fix for notes spawning and instantly calling loop from originating at 0,0
return newArrow;
}

public override void _ExitTree()
{
GD.Print("[DEBUG] Stopping tweens before exiting the scene...");

foreach (var tween in GetTree().GetProcessedTweens())
{
tween.Stop();
GD.Print("[DEBUG] Stopped tween.");
}
}
}
33 changes: 33 additions & 0 deletions scenes/TestTransition/testTransition.tscn
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
[gd_scene load_steps=2 format=3 uid="uid://dbeplni2du158"]

[ext_resource type="Script" path="res://scripts/SceneChange.cs" id="1_n6d5u"]

[node name="Control" type="Control"]
layout_mode = 3
anchors_preset = 0
offset_right = 40.0
offset_bottom = 40.0

[node name="Node2D" type="Node2D" parent="."]

[node name="StartButton" type="Button" parent="."]
layout_mode = 0
offset_left = 120.0
offset_top = 56.0
offset_right = 128.0
offset_bottom = 64.0
scale = Vector2(2.48, 2.48)
text = "start battle"
script = ExtResource("1_n6d5u")
ScenePath = "res://scenes/BattleDirector/test_battle_scene.tscn"

[node name="ExitButton" type="Button" parent="."]
layout_mode = 0
offset_left = 471.0
offset_top = 95.0
offset_right = 508.0
offset_bottom = 126.0
scale = Vector2(2.56, 2.56)
text = "exit"
script = ExtResource("1_n6d5u")
ScenePath = "exit"
35 changes: 35 additions & 0 deletions scripts/SceneChange.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
using System;
using Godot;

public partial class SceneChange : Button
{
[Export]
public string ScenePath = "";

public override void _Ready()
{
Pressed += OnButtonPressed;
GD.Print($"[DEBUG] Scene Path: '{ScenePath}'");
}

private void OnButtonPressed()
{
//ScenePath = ScenePath.Trim('\"');
if (ScenePath.ToLower() == "exit")
{
GD.Print("Exiting game");
GetTree().Quit();
return;
}

if (string.IsNullOrEmpty(ScenePath) || !ResourceLoader.Exists(ScenePath))
{
GD.PrintErr($"❌ Scene not found: {ScenePath}");
GD.Print($"[DEBUG] Trying to load: '{ScenePath}'");
return;
}

GD.Print($"✅ Loading scene: {ScenePath}");
GetTree().ChangeSceneToFile(ScenePath);
}
}