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
12 changes: 7 additions & 5 deletions Classes/Notes/Note.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,21 +13,20 @@ public partial class Note : Resource
private int _baseVal;
private Action<BattleDirector, Note, Timing> NoteEffect; //TODO: Where/How to deal with timing.

public string Tooltip;
public Texture2D Texture;

//public string Tooltip;

public Note(
string name,
PuppetTemplate owner = null,
string tooltip,
Texture2D texture = null,
PuppetTemplate owner = null,
int baseVal = 1,
Action<BattleDirector, Note, Timing> noteEffect = null
)
{
Name = name;
Owner = owner;
Texture = texture;
NoteEffect =
noteEffect
?? (
Expand All @@ -37,6 +36,8 @@ public Note(
}
);
_baseVal = baseVal;
Texture = texture;
Tooltip = tooltip;
}

public void OnHit(BattleDirector BD, Timing timing)
Expand All @@ -48,6 +49,7 @@ public Note Clone()
{
//Eventually could look into something more robust, but for now shallow copy is preferable.
//We only would want val and name to be copied by value
return (Note)MemberwiseClone();
Note newNote = new Note(Name, Tooltip, Texture, Owner, _baseVal, NoteEffect);
return newNote;
}
}
19 changes: 14 additions & 5 deletions Classes/Relics/RelicTemplate.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,25 @@ public partial class RelicTemplate : Resource
public RelicEffect[] Effects;
public string Name;

//public Texture2D Texture
//public string Tooltip
public RelicTemplate(string Name = "", RelicEffect[] EffectTags = null)
public Texture2D Texture;
public string Tooltip;

public RelicTemplate(
string name = "",
string tooltip = "",
Texture2D texture = null,
RelicEffect[] EffectTags = null
)
{
Effects = EffectTags;
this.Name = Name;
Name = name;
Tooltip = tooltip;
Texture = texture;
}

public RelicTemplate Clone()
{
return (RelicTemplate)MemberwiseClone();
RelicTemplate newRelic = new RelicTemplate(Name, Tooltip, Texture, Effects);
return newRelic;
}
}
Binary file added Classes/Relics/assets/relic_Breakfast.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
34 changes: 34 additions & 0 deletions Classes/Relics/assets/relic_Breakfast.png.import
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
[remap]

importer="texture"
type="CompressedTexture2D"
uid="uid://csjx2hb4tdlw8"
path="res://.godot/imported/relic_Breakfast.png-c1b968058adbb855fcf957a2aec74dc2.ctex"
metadata={
"vram_texture": false
}

[deps]

source_file="res://Classes/Relics/assets/relic_Breakfast.png"
dest_files=["res://.godot/imported/relic_Breakfast.png-c1b968058adbb855fcf957a2aec74dc2.ctex"]

[params]

compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=false
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/fix_alpha_border=true
process/premult_alpha=false
process/normal_map_invert_y=false
process/hdr_as_srgb=false
process/hdr_clamp_exposure=false
process/size_limit=0
detect_3d/compress_to=1
Binary file added Classes/Relics/assets/relic_GoodVibes.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
34 changes: 34 additions & 0 deletions Classes/Relics/assets/relic_GoodVibes.png.import
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
[remap]

importer="texture"
type="CompressedTexture2D"
uid="uid://dg4tnp7plxmp7"
path="res://.godot/imported/relic_GoodVibes.png-cd102b29bb163411bb7ce8cf724ef0c0.ctex"
metadata={
"vram_texture": false
}

[deps]

source_file="res://Classes/Relics/assets/relic_GoodVibes.png"
dest_files=["res://.godot/imported/relic_GoodVibes.png-cd102b29bb163411bb7ce8cf724ef0c0.ctex"]

[params]

compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=false
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/fix_alpha_border=true
process/premult_alpha=false
process/normal_map_invert_y=false
process/hdr_as_srgb=false
process/hdr_clamp_exposure=false
process/size_limit=0
detect_3d/compress_to=1
1 change: 1 addition & 0 deletions Globals/FunkEngineNameSpace.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ public enum BattleEffectTrigger
NotePlaced,
NoteHit,
SelfNoteHit,
OnPickup,
}

public enum Timing
Expand Down
36 changes: 15 additions & 21 deletions Globals/Scribe.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ public partial class Scribe : Node
{
new Note(
"EnemyBase",
null,
"Basic enemy note, deals damage to player.",
GD.Load<Texture2D>("res://scenes/BattleDirector/assets/Character1.png"),
null,
1,
(director, note, timing) =>
Expand All @@ -22,8 +23,9 @@ public partial class Scribe : Node
),
new Note(
"PlayerBase",
null,
"Basic player note, deals damage to enemy",
GD.Load<Texture2D>("res://Classes/Notes/assets/single_note.png"),
null,
1,
(director, note, timing) =>
{
Expand All @@ -32,8 +34,9 @@ public partial class Scribe : Node
),
new Note(
"PlayerDouble",
null,
"Basic player note, deals double damage to enemy",
GD.Load<Texture2D>("res://Classes/Notes/assets/double_note.png"),
null,
1,
(director, note, timing) =>
{
Expand All @@ -48,39 +51,30 @@ public partial class Scribe : Node
{
new RelicTemplate(
"Breakfast", //Reference ha ha, Item to give when relic pool is empty.
"Increases max hp.", //TODO: Description can include the relics values?
GD.Load<Texture2D>("res://Classes/Relics/assets/relic_Breakfast.png"),
new RelicEffect[]
{
new RelicEffect(
BattleEffectTrigger.NotePlaced,
1,
BattleEffectTrigger.OnPickup,
10,
(director, val) =>
{
director.Player.Heal(val);
StageProducer.PlayerStats.MaxHealth += val;
StageProducer.PlayerStats.CurrentHealth += val;
}
),
}
),
new RelicTemplate(
"Good Vibes",
"Good vibes, heals the player whenever they place a note.", //TODO: Description can include the relics values?
GD.Load<Texture2D>("res://Classes/Relics/assets/relic_GoodVibes.png"),
new RelicEffect[]
{
new RelicEffect(
BattleEffectTrigger.NotePlaced,
5,
(director, val) =>
{
director.Player.Heal(val);
}
),
}
),
new RelicTemplate(
"Dummy Item",
new RelicEffect[]
{
new RelicEffect(
BattleEffectTrigger.NotePlaced,
100,
1,
(director, val) =>
{
director.Player.Heal(val);
Expand Down
60 changes: 50 additions & 10 deletions Globals/StageProducer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,14 @@
public static RandomNumberGenerator GlobalRng = new RandomNumberGenerator();
private ulong _seed;
private ulong _lastRngState;
private bool _isInitialized = false;

private Stages _curStage = Stages.Title;
private Node _curScene;
public static MapGrid.Room CurRoom { get; private set; }
public static Vector2I MapSize { get; private set; } = new Vector2I(7, 6); //For now, make width an odd number

private MapGrid _map = new MapGrid();
public static MapGrid Map { get; } = new MapGrid();

//Hold here to persist between changes
//TODO: Allow for permanent changes and battle temporary stat changes.
Expand All @@ -25,8 +28,13 @@
private int[,] _map;
private Room[] _rooms;
private int _curIdx = 0;
private int _curRoom = 0;

Check warning on line 31 in Globals/StageProducer.cs

View workflow job for this annotation

GitHub Actions / build

The field 'StageProducer.MapGrid._curRoom' is assigned but its value is never used

Check warning on line 31 in Globals/StageProducer.cs

View workflow job for this annotation

GitHub Actions / build

The field 'StageProducer.MapGrid._curRoom' is assigned but its value is never used

public Room[] GetRooms()
{
return _rooms;
}

public class Room
{
public Room(int idx, int x, int y)
Expand All @@ -48,10 +56,10 @@
Children = Children.Append(newIdx).ToArray();
}

private int Idx;
private int[] Children = Array.Empty<int>();
private int X;
private int Y;
public int Idx { get; private set; }
public int[] Children { get; private set; } = Array.Empty<int>();
public int X { get; private set; }
public int Y { get; private set; }
private string Type;
}

Expand All @@ -61,15 +69,15 @@
_rooms = Array.Empty<Room>();
_map = new int[width, height]; //x,y

int startX = GlobalRng.RandiRange(0, width - 1); //TODO: Replace with seeding
int startX = (width / 2);
_rooms = _rooms.Append(new Room(_curIdx, startX, 0)).ToArray();
_map[startX, 0] = _curIdx++;

for (int i = 0; i < paths; i++)
{
GeneratePath_r(startX, 0, width, height);
}

CreateCommonChildren(width, height);
AddBossRoom(width, height);
}

Expand All @@ -93,9 +101,25 @@
}
}

//Asserts that if there is a room at the same x, but y+1 they are connected
private void CreateCommonChildren(int width, int height)
{
foreach (Room room in _rooms)
{
Vector2I curPos = new Vector2I(room.X, room.Y);
if (room.Y + 1 >= height)
continue;
if (_map[curPos.X, curPos.Y + 1] == 0)
continue;
GD.Print("Added child on same X.");
room.AddChild(_map[curPos.X, curPos.Y + 1]);
}
}

//Adds a boss room at the end of rooms, all max height rooms connect to it.
private void AddBossRoom(int width, int height)
{
_rooms = _rooms.Append(new Room(_curIdx, 0, height)).ToArray();
_rooms = _rooms.Append(new Room(_curIdx, width / 2, height)).ToArray();
_rooms[_curIdx].SetType("Boss");
for (int i = 0; i < width; i++) //Attach all last rooms to a boss room
{
Expand All @@ -109,10 +133,19 @@

public void StartGame()
{
_map.InitMapGrid(2, 2, 1);
Map.InitMapGrid(MapSize.X, MapSize.Y, 3);
_seed = GlobalRng.Seed;
_lastRngState = GlobalRng.State;
PlayerStats = new PlayerStats();

CurRoom = Map.GetRooms()[0];
_isInitialized = true;
}

public void TransitionFromRoom(int nextRoomIdx)
{
//CurRoom = Map.GetRooms()[nextRoomIdx];
TransitionStage(Stages.Battle);
}

public void TransitionStage(Stages nextStage)
Expand All @@ -121,12 +154,19 @@
switch (nextStage)
{
case Stages.Title:
_isInitialized = false;
GetTree().ChangeSceneToFile("res://scenes/SceneTransitions/TitleScreen.tscn");
break;
case Stages.Battle:
StartGame();
GetTree().ChangeSceneToFile("res://scenes/BattleDirector/test_battle_scene.tscn");
break;
case Stages.Map:
GetTree().ChangeSceneToFile("res://scenes/Maps/cartographer.tscn");
if (!_isInitialized)
{
StartGame();
}
break;
case Stages.Quit:
GD.Print("Exiting game");
GetTree().Quit();
Expand Down
5 changes: 5 additions & 0 deletions project.godot
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,11 @@ Pause={
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":4194305,"key_label":0,"unicode":0,"location":0,"echo":false,"script":null)
]
}
Inventory={
"deadzone": 0.5,
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":73,"key_label":0,"unicode":105,"location":0,"echo":false,"script":null)
]
}

[rendering]

Expand Down
8 changes: 4 additions & 4 deletions scenes/BattleDirector/NotePlacementBar.tscn
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@ gradient = SubResource("Gradient_0u6yv")
width = 26
height = 100

[sub_resource type="Gradient" id="Gradient_lyd0l"]
[sub_resource type="Gradient" id="Gradient_xvck1"]
offsets = PackedFloat32Array(0, 0.485915, 0.739437, 1)
colors = PackedColorArray(0, 1, 0, 1, 0.68, 0, 0.272, 1, 0, 0.64, 0.608, 1, 0.4, 0, 0, 1)

[sub_resource type="GradientTexture2D" id="GradientTexture2D_k7kvy"]
gradient = SubResource("Gradient_lyd0l")
[sub_resource type="GradientTexture2D" id="GradientTexture2D_0bqho"]
gradient = SubResource("Gradient_xvck1")
width = 24
height = 98
fill_to = Vector2(0, 1)
Expand All @@ -42,7 +42,7 @@ offset_right = 26.0
offset_bottom = 100.0
fill_mode = 3
texture_under = SubResource("GradientTexture2D_hhds4")
texture_progress = SubResource("GradientTexture2D_k7kvy")
texture_progress = SubResource("GradientTexture2D_0bqho")
texture_progress_offset = Vector2(1, 1)

[node name="TextEdit" type="TextEdit" parent="."]
Expand Down
Loading