Skip to content

Commit 1f003c2

Browse files
authored
Merge pull request #73 from Project-Funk-Engine/game_beautification
Game beautification
2 parents 7a93dc4 + df12691 commit 1f003c2

33 files changed

Lines changed: 653 additions & 191 deletions

Classes/Notes/assets/heal_note.png

1.03 KB
Loading
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
[remap]
2+
3+
importer="texture"
4+
type="CompressedTexture2D"
5+
uid="uid://cdf3g3174du4r"
6+
path="res://.godot/imported/heal_note.png-09ca289a296eee82d33c64101a4e593a.ctex"
7+
metadata={
8+
"vram_texture": false
9+
}
10+
11+
[deps]
12+
13+
source_file="res://Classes/Notes/assets/heal_note.png"
14+
dest_files=["res://.godot/imported/heal_note.png-09ca289a296eee82d33c64101a4e593a.ctex"]
15+
16+
[params]
17+
18+
compress/mode=0
19+
compress/high_quality=false
20+
compress/lossy_quality=0.7
21+
compress/hdr_compression=1
22+
compress/normal_map=0
23+
compress/channel_pack=0
24+
mipmaps/generate=false
25+
mipmaps/limit=-1
26+
roughness/mode=0
27+
roughness/src_normal=""
28+
process/fix_alpha_border=true
29+
process/premult_alpha=false
30+
process/normal_map_invert_y=false
31+
process/hdr_as_srgb=false
32+
process/hdr_clamp_exposure=false
33+
process/size_limit=0
34+
detect_3d/compress_to=1
1020 Bytes
Loading
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
[remap]
2+
3+
importer="texture"
4+
type="CompressedTexture2D"
5+
uid="uid://uksjoqp7p0gq"
6+
path="res://.godot/imported/quarter_note.png-2b4c9985d99038807abfd63e553c2d6a.ctex"
7+
metadata={
8+
"vram_texture": false
9+
}
10+
11+
[deps]
12+
13+
source_file="res://Classes/Notes/assets/quarter_note.png"
14+
dest_files=["res://.godot/imported/quarter_note.png-2b4c9985d99038807abfd63e553c2d6a.ctex"]
15+
16+
[params]
17+
18+
compress/mode=0
19+
compress/high_quality=false
20+
compress/lossy_quality=0.7
21+
compress/hdr_compression=1
22+
compress/normal_map=0
23+
compress/channel_pack=0
24+
mipmaps/generate=false
25+
mipmaps/limit=-1
26+
roughness/mode=0
27+
roughness/src_normal=""
28+
process/fix_alpha_border=true
29+
process/premult_alpha=false
30+
process/normal_map_invert_y=false
31+
process/hdr_as_srgb=false
32+
process/hdr_clamp_exposure=false
33+
process/size_limit=0
34+
detect_3d/compress_to=1
1.19 KB
Loading
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
[remap]
2+
3+
importer="texture"
4+
type="CompressedTexture2D"
5+
uid="uid://dg0lmu0pip4lr"
6+
path="res://.godot/imported/vampire_note.png-4331f817a6feee1f1066a9e9f95934c8.ctex"
7+
metadata={
8+
"vram_texture": false
9+
}
10+
11+
[deps]
12+
13+
source_file="res://Classes/Notes/assets/vampire_note.png"
14+
dest_files=["res://.godot/imported/vampire_note.png-4331f817a6feee1f1066a9e9f95934c8.ctex"]
15+
16+
[params]
17+
18+
compress/mode=0
19+
compress/high_quality=false
20+
compress/lossy_quality=0.7
21+
compress/hdr_compression=1
22+
compress/normal_map=0
23+
compress/channel_pack=0
24+
mipmaps/generate=false
25+
mipmaps/limit=-1
26+
roughness/mode=0
27+
roughness/src_normal=""
28+
process/fix_alpha_border=true
29+
process/premult_alpha=false
30+
process/normal_map_invert_y=false
31+
process/hdr_as_srgb=false
32+
process/hdr_clamp_exposure=false
33+
process/size_limit=0
34+
detect_3d/compress_to=1

Globals/FunkEngineNameSpace.cs

Lines changed: 151 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,24 @@
1-
using Godot;
1+
using System;
2+
using System.Linq;
3+
using Godot;
24

35
namespace FunkEngine;
46

7+
public struct SongData
8+
{
9+
public int Bpm;
10+
public double SongLength;
11+
public int NumLoops;
12+
}
13+
14+
public struct ArrowData
15+
{
16+
public Color Color;
17+
public string Key;
18+
public NoteChecker Node;
19+
public ArrowType Type;
20+
}
21+
522
public enum ArrowType
623
{
724
Up = 0,
@@ -10,14 +27,6 @@ public enum ArrowType
1027
Right = 3,
1128
}
1229

13-
public enum BattleEffectTrigger
14-
{
15-
NotePlaced,
16-
NoteHit,
17-
SelfNoteHit,
18-
OnPickup,
19-
}
20-
2130
public enum Timing
2231
{
2332
Miss = 0,
@@ -27,6 +36,22 @@ public enum Timing
2736
Perfect = 4,
2837
}
2938

39+
public struct BattleConfig
40+
{
41+
public MapRooms RoomType { get; private set; }
42+
public MapGrid.Room CurRoom { get; private set; }
43+
public SongData CurSong { get; set; }
44+
public int TodoEnemyAndChart;
45+
}
46+
47+
public enum BattleEffectTrigger
48+
{
49+
NotePlaced,
50+
NoteHit,
51+
SelfNoteHit,
52+
OnPickup,
53+
}
54+
3055
public enum Stages
3156
{
3257
Title,
@@ -35,19 +60,127 @@ public enum Stages
3560
Map,
3661
}
3762

38-
public struct SongData
63+
public enum MapRooms
3964
{
40-
public int Bpm;
41-
public double SongLength;
42-
public int NumLoops;
65+
Battle,
66+
Chest,
67+
Boss,
4368
}
4469

45-
public struct ArrowData
70+
public class MapGrid
4671
{
47-
public Color Color;
48-
public string Key;
49-
public NoteChecker Node;
50-
public ArrowType Type;
72+
private int[,] _map;
73+
private Room[] _rooms;
74+
private int _curIdx = 0;
75+
private int _curRoom = 0;
76+
77+
public Room[] GetRooms()
78+
{
79+
return _rooms;
80+
}
81+
82+
public class Room
83+
{
84+
public Room(int idx, int x, int y)
85+
{
86+
Idx = idx;
87+
X = x;
88+
Y = y;
89+
}
90+
91+
public void SetType(MapRooms type)
92+
{
93+
Type = type;
94+
}
95+
96+
public void AddChild(int newIdx)
97+
{
98+
if (Children.Contains(newIdx))
99+
return;
100+
Children = Children.Append(newIdx).ToArray();
101+
}
102+
103+
public int Idx { get; private set; }
104+
public int[] Children { get; private set; } = Array.Empty<int>();
105+
public int X { get; private set; }
106+
public int Y { get; private set; }
107+
public MapRooms Type { get; private set; }
108+
}
109+
110+
public void InitMapGrid(int width, int height, int paths)
111+
{
112+
_curIdx = 0;
113+
_rooms = Array.Empty<Room>();
114+
_map = new int[width, height]; //x,y
115+
116+
int startX = (width / 2);
117+
_rooms = _rooms.Append(new Room(_curIdx, startX, 0)).ToArray();
118+
_map[startX, 0] = _curIdx++;
119+
120+
for (int i = 0; i < paths; i++)
121+
{
122+
GeneratePath_r(startX, 0, width, height);
123+
}
124+
CreateCommonChildren(width, height);
125+
AddBossRoom(width, height);
126+
}
127+
128+
//Start at x, y, assume prev room exists. Picks new x pos within +/- 1, attaches recursively
129+
private void GeneratePath_r(int x, int y, int width, int height)
130+
{
131+
int nextX = StageProducer.GlobalRng.RandiRange(
132+
Math.Max(x - 1, 0),
133+
Math.Min(x + 1, width - 1)
134+
);
135+
if (_map[nextX, y + 1] == 0)
136+
{
137+
_rooms = _rooms.Append(new Room(_curIdx, nextX, y + 1)).ToArray();
138+
_map[nextX, y + 1] = _curIdx;
139+
_rooms[_map[x, y]].AddChild(_curIdx++);
140+
_rooms[^1].SetType(MapRooms.Battle);
141+
if (y > 0 && y % 3 == 0)
142+
{
143+
_rooms[^1].SetType(MapRooms.Chest);
144+
}
145+
}
146+
else
147+
{
148+
_rooms[_map[x, y]].AddChild(_map[nextX, y + 1]);
149+
}
150+
if (y < height - 2)
151+
{
152+
GeneratePath_r(nextX, y + 1, width, height);
153+
}
154+
}
155+
156+
//Asserts that if there is a room at the same x, but y+1 they are connected
157+
private void CreateCommonChildren(int width, int height)
158+
{
159+
foreach (Room room in _rooms)
160+
{
161+
Vector2I curPos = new Vector2I(room.X, room.Y);
162+
if (room.Y + 1 >= height)
163+
continue;
164+
if (_map[curPos.X, curPos.Y + 1] == 0)
165+
continue;
166+
GD.Print("Added child on same X.");
167+
room.AddChild(_map[curPos.X, curPos.Y + 1]);
168+
}
169+
}
170+
171+
//Adds a boss room at the end of rooms, all max height rooms connect to it.
172+
private void AddBossRoom(int width, int height)
173+
{
174+
_rooms = _rooms.Append(new Room(_curIdx, width / 2, height)).ToArray();
175+
_rooms[_curIdx].SetType(MapRooms.Boss);
176+
for (int i = 0; i < width; i++) //Attach all last rooms to a boss room
177+
{
178+
if (_map[i, height - 1] != 0)
179+
{
180+
_rooms[_map[i, height - 1]].AddChild(_curIdx);
181+
}
182+
}
183+
}
51184
}
52185

53186
public interface IBattleEvent

Globals/Scribe.cs

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,40 @@ public partial class Scribe : Node
4545
director.Enemy.TakeDamage(2 * (int)timing);
4646
}
4747
),
48+
new Note(
49+
"PlayerHeal",
50+
"Basic player note, heals player",
51+
GD.Load<Texture2D>("res://Classes/Notes/assets/heal_note.png"),
52+
null,
53+
1,
54+
(director, note, timing) =>
55+
{
56+
director.Player.Heal((int)timing);
57+
}
58+
),
59+
new Note(
60+
"PlayerVampire",
61+
"Steals health from enemy",
62+
GD.Load<Texture2D>("res://Classes/Notes/assets/vampire_note.png"),
63+
null,
64+
1,
65+
(director, note, timing) =>
66+
{
67+
director.Player.Heal((int)timing);
68+
director.Enemy.TakeDamage((int)timing);
69+
}
70+
),
71+
new Note(
72+
"PlayerQuarter",
73+
"Basic note at a quarter of the cost",
74+
GD.Load<Texture2D>("res://Classes/Notes/assets/quarter_note.png"),
75+
null,
76+
1,
77+
(director, note, timing) =>
78+
{
79+
director.Enemy.TakeDamage((int)timing);
80+
}
81+
),
4882
};
4983

5084
public static readonly RelicTemplate[] RelicDictionary = new[]

0 commit comments

Comments
 (0)