Skip to content

Commit 1a9670a

Browse files
committed
Setting Up second area level
Also tweaking cartographer camera scroll
1 parent 8ff4014 commit 1a9670a

14 files changed

Lines changed: 166 additions & 22 deletions

Classes/MapAreas/MapLevels.cs

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -107,18 +107,35 @@ private MapLevels(
107107
public int[] EventIds { get; private set; }
108108

109109
#region Preset Levels
110-
private static readonly MapConfig FirstMapConfig = new MapConfig(7, 7, 3, [10, 1, 5, 5, 5])
110+
private static readonly MapConfig FirstMapConfig = new MapConfig(7, 7, 3, [10, 2, 5, 6, 5])
111111
.AddSetRoom(3, Stages.Chest)
112112
.AddMinHeight(Stages.Chest, 2)
113113
.AddMinHeight(Stages.Shop, 3)
114114
.AddMinHeight(Stages.Elite, 3);
115115

116+
private static readonly MapConfig CityMapConfig = new MapConfig(9, 10, 5, [12, 1, 5, 5, 4])
117+
.AddSetRoom(2, Stages.Chest)
118+
.AddSetRoom(4, Stages.Shop)
119+
.AddMinHeight(Stages.Chest, 1)
120+
.AddMinHeight(Stages.Shop, 3)
121+
.AddMinHeight(Stages.Elite, 2);
122+
116123
private static readonly MapConfig TutorialMapConfig = new MapConfig(1, 2, 1, [10, 0, 0, 0, 0]);
117124

118125
private static readonly MapLevels[] PresetLevels = new[]
119126
{
120127
new MapLevels(0, TutorialMapConfig, [4], [0], [5], [], 1),
121-
new MapLevels(1, FirstMapConfig, [1, 3], [2], [0], [], -1),
128+
new MapLevels(1, FirstMapConfig, [1, 2], [3], [0], [], 2),
129+
new MapLevels(
130+
2,
131+
CityMapConfig,
132+
[1, 2],
133+
[3],
134+
[0],
135+
[],
136+
-1,
137+
"res://SharedAssets/BackGround_City.png"
138+
),
122139
};
123140
#endregion
124141

Globals/FunkEngineNameSpace.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -291,6 +291,7 @@ public class MapGrid
291291
private int[,] _map;
292292
private Room[] _rooms;
293293
private int _curIdx;
294+
public int Width { get; private set; }
294295

295296
public Room[] GetRooms()
296297
{
@@ -330,6 +331,7 @@ public void AddChild(int newIdx)
330331
*/
331332
public void InitMapGrid(MapLevels.MapConfig curConfig)
332333
{
334+
Width = curConfig.Width;
333335
_curIdx = 0;
334336
_rooms = [];
335337
_map = new int[curConfig.Width, curConfig.Height]; //x,y

Globals/StageProducer.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -228,7 +228,7 @@ private BattleConfig MakeBattleConfig(Stages nextRoom, int nextRoomIdx)
228228
int elitIdx = stageRng.RandiRange(0, CurLevel.EliteBattles.Length - 1);
229229
result.CurSong = Scribe.SongDictionary[CurLevel.EliteBattles[elitIdx]];
230230
result.EnemyScenePath = Scribe
231-
.SongDictionary[CurLevel.BossBattles[elitIdx]]
231+
.SongDictionary[CurLevel.EliteBattles[elitIdx]]
232232
.EnemyScenePath;
233233
break;
234234
case Stages.Boss:
@@ -275,6 +275,7 @@ public static bool IsMoreLevels()
275275

276276
public void ProgressLevels()
277277
{
278+
GD.Print(CurLevel.Id);
278279
CurLevel = CurLevel.GetNextLevel();
279280

280281
Map = new();

Scenes/Maps/Assets/FirstIcon.png

693 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://dxiceak20m0l7"
6+
path="res://.godot/imported/FirstIcon.png-51362bbefd81dee000fc3aedbade09ac.ctex"
7+
metadata={
8+
"vram_texture": false
9+
}
10+
11+
[deps]
12+
13+
source_file="res://Scenes/Maps/Assets/FirstIcon.png"
14+
dest_files=["res://.godot/imported/FirstIcon.png-51362bbefd81dee000fc3aedbade09ac.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

Scenes/Maps/Assets/StartIcon.png

678 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://cyip3p5s5pav5"
6+
path="res://.godot/imported/StartIcon.png-7b0cc3340e736d4b2b89804cd6171f26.ctex"
7+
metadata={
8+
"vram_texture": false
9+
}
10+
11+
[deps]
12+
13+
source_file="res://Scenes/Maps/Assets/StartIcon.png"
14+
dest_files=["res://.godot/imported/StartIcon.png-7b0cc3340e736d4b2b89804cd6171f26.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

Scenes/Maps/Cartographer.tscn

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,17 +18,23 @@ Camera = NodePath("TheView")
1818
top_level = true
1919
anchor_mode = 0
2020
limit_top = -10
21+
limit_bottom = 530
2122

2223
[node name="UI" type="CanvasLayer" parent="." node_paths=PackedStringArray("CurSceneNode")]
2324
script = ExtResource("2_cl7v0")
2425
CurSceneNode = NodePath("..")
2526

2627
[node name="BG" type="TextureRect" parent="."]
2728
modulate = Color(0.462, 0.462, 0.66, 1)
28-
offset_left = -557.0
29-
offset_top = -84.0
30-
offset_right = 83.0
31-
offset_bottom = 96.0
29+
anchors_preset = 15
30+
anchor_right = 1.0
31+
anchor_bottom = 1.0
32+
offset_left = -320.0
33+
offset_top = -10.0
34+
offset_right = 320.0
35+
offset_bottom = 170.0
36+
grow_horizontal = 2
37+
grow_vertical = 2
3238
scale = Vector2(3, 3)
3339
texture = ExtResource("2_5g6at")
3440
script = ExtResource("5_taedj")

Scenes/Maps/InBetween.tscn

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,5 +20,5 @@ offset_bottom = 284.0
2020
theme = ExtResource("2_dapxv")
2121
text = "INBETWEEN_CONTINUE"
2222
script = ExtResource("3_35xdc")
23-
ScenePath = 9
23+
ScenePath = 7
2424
_startFocused = true

Scenes/Maps/Scripts/Cartographer.cs

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,12 @@ public partial class Cartographer : Node2D
2727
private static readonly Dictionary<Stages, Texture2D> StageIcons = new()
2828
{
2929
{ Stages.Battle, GD.Load<Texture2D>("res://Scenes/Maps/Assets/BattleIcon.png") },
30-
{ Stages.Elite, GD.Load<Texture2D>("res://Scenes/Maps/Assets/BossIcon.png") },
31-
{ Stages.Boss, GD.Load<Texture2D>("res://Scenes/Maps/Assets/EliteIcon.png") },
30+
{ Stages.Elite, GD.Load<Texture2D>("res://Scenes/Maps/Assets/EliteIcon.png") },
31+
{ Stages.Boss, GD.Load<Texture2D>("res://Scenes/Maps/Assets/BossIcon.png") },
3232
{ Stages.Chest, GD.Load<Texture2D>("res://Scenes/Maps/Assets/ChestIcon.png") },
3333
{ Stages.Shop, GD.Load<Texture2D>("res://Scenes/Maps/Assets/ShopIcon.png") },
3434
{ Stages.Event, GD.Load<Texture2D>("res://Scenes/Maps/Assets/EventIcon.png") },
35+
{ Stages.Map, GD.Load<Texture2D>("res://Scenes/Maps/Assets/FirstIcon.png") },
3536
};
3637

3738
public override void _Ready()
@@ -54,7 +55,7 @@ public override void _EnterTree()
5455

5556
private Vector2 GetPosition(int x, int y)
5657
{
57-
return new Vector2((float)x * 640 / 8 + 32, y * 48 + 16);
58+
return new Vector2((float)(x + 1) * 640 / (StageProducer.Map.Width + 1), y * 48 + 16);
5859
}
5960

6061
private void DrawMap()
@@ -80,7 +81,6 @@ private void DrawMap()
8081

8182
private void DrawMapSprite(MapGrid.Room room)
8283
{
83-
GD.Print(room.Type);
8484
var newButton = new Button();
8585
newButton.Theme = ButtonTheme;
8686
newButton.CustomMinimumSize = MapIconSize;
@@ -118,16 +118,20 @@ private void DrawMapSprite(MapGrid.Room room)
118118
}
119119

120120
newButton.Icon = StageIcons[room.Type];
121+
if (room.Y == 0)
122+
newButton.Icon = StageIcons[Stages.Map];
121123

122124
newButton.ZIndex = 1;
123125
newButton.Position = GetPosition(room.X, room.Y) - newButton.Size / 2;
124126
if (room == StageProducer.GetCurRoom())
125127
{
126128
PlayerSprite.Position = newButton.Position + newButton.Size * .5f;
127-
Camera.Position -= //TODO: Better camera matching for areas.
129+
Camera.Position -=
128130
(
129131
(GetViewportRect().Size / 2) - (newButton.Position + newButton.Size * .5f)
130-
).Normalized() * 20;
132+
).Normalized()
133+
* room.X
134+
* 48;
131135
}
132136
}
133137

0 commit comments

Comments
 (0)