Commit 5489f3c5 authored by Maxime's avatar Maxime
Browse files

Merge branch 'main' into teleporter

parents 045dd488 176571fc
<?xml version="1.0" encoding="UTF-8"?>
<map version="1.0" tiledversion="1.7.2" orientation="orthogonal" renderorder="right-down" width="24" height="15" tilewidth="32" tileheight="32" infinite="0" nextlayerid="4" nextobjectid="5">
<tileset firstgid="1" source="../tiles.tsx"/>
<layer id="1" name="Calque de Tuiles 1" width="24" height="15">
<data encoding="csv">
2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,
2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,
2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,
2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,
2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,
2,0,3,3,0,0,3,0,0,3,0,3,0,0,3,3,0,0,3,0,0,3,0,3,
2,3,0,0,0,3,0,3,0,3,0,3,0,3,0,0,0,3,0,3,0,3,0,3,
2,3,0,0,0,3,0,3,0,3,0,3,0,3,0,0,0,3,0,3,0,3,0,3,
2,0,3,3,0,0,3,0,0,0,3,0,0,0,3,3,0,0,3,0,0,0,3,2,
2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,
2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,
2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,
2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,
2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,
2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2
</data>
</layer>
</map>
......@@ -18,7 +18,6 @@
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2
</data>
</data>
</layer>
<objectgroup id="2" name="Calque d'Objets 1"/>
</map>
......@@ -18,8 +18,6 @@
0,0,0,0,0,0,0,0,0,0,3,3,0,0,0,0,0,0,0,0,0,0,0,2,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,
2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2
</data>
</data>
</layer>
<objectgroup id="2" name="Calque d'Objets 1">
</objectgroup>
</map>
......@@ -18,7 +18,6 @@
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
2,2,2,2,2,2,2,2,2,0,0,0,0,0,0,2,2,2,2,2,2,2,2,2
</data>
</data>
</layer>
<objectgroup id="2" name="Calque d'Objets 1"/>
</map>
......@@ -130,16 +130,19 @@
<Content Include="Data\Fonts\anonymous_pro.ttf">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<None Include="Data\Levels\World0\world0_1-1.tmx">
<None Include="Data\Levels\World0\world0_0!-1.tmx">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="Data\Levels\World0\world0_0-0.tmx">
<None Include="Data\Levels\World0\world0_1!1.tmx">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="Data\Levels\World0\world0_0-1.tmx">
<None Include="Data\Levels\World0\world0_0!0.tmx">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="Data\Levels\World0\world0_0-2.tmx">
<None Include="Data\Levels\World0\world0_0!1.tmx">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="Data\Levels\World0\world0_0!2.tmx">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="Data\Particles\background.pex">
......
<?xml version="1.0" encoding="UTF-8"?>
<map version="1.0" tiledversion="1.7.2" orientation="orthogonal" renderorder="right-down" width="24" height="15" tilewidth="32" tileheight="32" infinite="0" nextlayerid="4" nextobjectid="5">
<tileset firstgid="1" source="../tiles.tsx"/>
<layer id="1" name="Calque de Tuiles 1" width="24" height="15">
<data encoding="csv">
2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,
2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,
2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,
2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,
2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,
2,0,3,3,0,0,3,0,0,3,0,3,0,0,3,3,0,0,3,0,0,3,0,3,
2,3,0,0,0,3,0,3,0,3,0,3,0,3,0,0,0,3,0,3,0,3,0,3,
2,3,0,0,0,3,0,3,0,3,0,3,0,3,0,0,0,3,0,3,0,3,0,3,
2,0,3,3,0,0,3,0,0,0,3,0,0,0,3,3,0,0,3,0,0,0,3,2,
2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,
2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,
2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,
2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,
2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,
2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2
</data>
</layer>
</map>
......@@ -18,7 +18,6 @@
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2
</data>
</data>
</layer>
<objectgroup id="2" name="Calque d'Objets 1"/>
</map>
......@@ -18,8 +18,6 @@
0,0,0,0,0,0,0,0,0,0,3,3,0,0,0,0,0,0,0,0,0,0,0,2,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,
2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2
</data>
</data>
</layer>
<objectgroup id="2" name="Calque d'Objets 1">
</objectgroup>
</map>
......@@ -18,7 +18,6 @@
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
2,2,2,2,2,2,2,2,2,0,0,0,0,0,0,2,2,2,2,2,2,2,2,2
</data>
</data>
</layer>
<objectgroup id="2" name="Calque d'Objets 1"/>
</map>
......@@ -126,16 +126,19 @@
<AndroidAsset Include="Assets\Data\Particles\background.pex">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</AndroidAsset>
<AndroidAsset Include="Assets\Data\Levels\World0\world0_0-0.tmx">
<AndroidAsset Include="Assets\Data\Levels\World0\world0_0!0.tmx">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</AndroidAsset>
<AndroidAsset Include="Assets\Data\Levels\World0\world0_0-1.tmx">
<AndroidAsset Include="Assets\Data\Levels\World0\world0_0!1.tmx">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</AndroidAsset>
<AndroidAsset Include="Assets\Data\Levels\World0\world0_0-2.tmx">
<AndroidAsset Include="Assets\Data\Levels\World0\world0_0!2.tmx">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</AndroidAsset>
<AndroidAsset Include="Assets\Data\Levels\World0\world0_1-1.tmx">
<AndroidAsset Include="Assets\Data\Levels\World0\world0_1!1.tmx">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</AndroidAsset>
<AndroidAsset Include="Assets\Data\Levels\World0\world0_0!-1.tmx">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</AndroidAsset>
<None Include="Resources\AboutResources.txt" />
......
......@@ -25,7 +25,7 @@
{
public const string BasePath = "Levels/";
public const string World0Path = "Levels/World0/";
public const string World0Start = "Levels/World0/world0_0-0.tmx";
public const string World0Start = "Levels/World0/world0_0!0.tmx";
}
......
......@@ -44,6 +44,7 @@ namespace ZZZZZZ.Worlds
private void SetSpawn()
{
var layer = TileMap.GetLayer(1);
if (layer == null) return;
for (uint i = 0; i < layer.NumObjects; i++)
{
......@@ -61,6 +62,7 @@ namespace ZZZZZZ.Worlds
private void GenerateTriggerBox()
{
var layer = TileMap.GetLayer(1);
if (layer == null) return;
for (uint i = 0; i < layer.NumObjects; i++)
{
if (layer.GetObject(i).Name == "Goto")
......
......@@ -32,11 +32,12 @@ namespace ZZZZZZ.Worlds
GameManager.Current.Camera.Node.Position = new Vector3(obj.CameraPosition.Y * 7.68f + 3.84f, obj.CameraPosition.X * 4.8f + 2.4f, 0);
Current = Loaded.Find(x => x.WorldX == obj.CameraPosition.X && x.WorldY == obj.CameraPosition.Y);
var regex = new Regex("world([0-9*])_([0-9*])-([0-9*]).tmx");
var regex = new Regex(@"world(-?\d+)_(-?\d+)!(-?\d+).tmx");
var match = regex.Match(Current.Name).Groups;
if (match.Count >= 4)
{
var toLoad = Path.Combine(Path.GetDirectoryName(Current.Name), $"world{match[1]}_{match[2]}-{match[3]}.tmx");
var toLoad = Path.Combine(Path.GetDirectoryName(Current.Name), $"world{match[1]}_{match[2]}!{match[3]}.tmx");
Unload();
Load(toLoad);
}
......@@ -51,7 +52,7 @@ namespace ZZZZZZ.Worlds
{
var toDelete = Loaded.Select(x => (x.WorldX, x.WorldY)).ToList();
for (int i = Current.WorldX - 1; i <= Current.WorldX + 1; i++)
for (int j = Current.WorldY - 1; j <= Current.WorldY + 1; j++)
for (int j = Current.WorldY - 1; j <= Current.WorldY + 1; j++)
toDelete.Remove((i, j));
foreach (var (WorldX, WorldY) in toDelete)
{
......@@ -60,19 +61,19 @@ namespace ZZZZZZ.Worlds
toDispose.Dispose();
Loaded.Remove(toDispose);
}
}
public void Load(string level)
{
var filename = Path.GetFileNameWithoutExtension(level);
var path = Path.GetDirectoryName(level);
var splitted = filename.Split('_');
var splitted2 = splitted[1].Split('-');
var regex = new Regex(@"world(-?\d+)_(-?\d+)!(-?\d+).tmx");
var match = regex.Match(level);
var groups = match.Groups;
var levelX = int.Parse(splitted2[0]);
var levelY = int.Parse(splitted2[1]);
var levelX = int.Parse($"{groups[2]}");
var levelY = int.Parse($"{groups[3]}");
for (int i = levelX - 1; i <= levelX + 1; i++)
{
......@@ -80,7 +81,7 @@ namespace ZZZZZZ.Worlds
{
if (!Loaded.Exists(x => x.WorldX == i && x.WorldY == j))
{
var filePathToLoad = Path.Combine(path, $"{splitted[0]}_{i}-{j}.tmx");
var filePathToLoad = Path.Combine(path, $"world{groups[1]}_{i}!{j}.tmx");
var tmxLevel = Application.Current.ResourceCache.GetTmxFile2D(filePathToLoad, false);
if (tmxLevel != null)
{
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment