diff --git a/GreatSpringGameJam/Content/Tilesets/World.tsx b/GreatSpringGameJam/Content/Tilesets/World.tsx
index 2006b56..7deb736 100644
--- a/GreatSpringGameJam/Content/Tilesets/World.tsx
+++ b/GreatSpringGameJam/Content/Tilesets/World.tsx
@@ -30,16 +30,25 @@
+
+
+
+
+
+
+
+
+
@@ -84,17 +93,29 @@
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/GreatSpringGameJam/GameImpl.cs b/GreatSpringGameJam/GameImpl.cs
index cdb1346..ecb3c03 100644
--- a/GreatSpringGameJam/GameImpl.cs
+++ b/GreatSpringGameJam/GameImpl.cs
@@ -78,7 +78,7 @@ namespace GreatSpringGameJam {
}
// display end of level info
- var snowRemoved = this.Map.TotalSnow - this.Map.GetTotalTiles("Snow");
+ var snowRemoved = this.Map.TotalSnow - this.Map.GetTotalTiles("Snow") / 2;
var plantsGrown = this.Map.TotalSeeds - this.Map.GetTotalTiles("Seed");
var gnomesCollected = this.Map.TotalGnomes - this.Map.GetEntities().Count();
// snow removal is less important, gnomes are more important
diff --git a/GreatSpringGameJam/GreatSpringGameJam.csproj b/GreatSpringGameJam/GreatSpringGameJam.csproj
index a9982e7..61ce11d 100644
--- a/GreatSpringGameJam/GreatSpringGameJam.csproj
+++ b/GreatSpringGameJam/GreatSpringGameJam.csproj
@@ -9,9 +9,9 @@
-
-
-
+
+
+
diff --git a/GreatSpringGameJam/Map.cs b/GreatSpringGameJam/Map.cs
index b6ca87c..e4c3126 100644
--- a/GreatSpringGameJam/Map.cs
+++ b/GreatSpringGameJam/Map.cs
@@ -11,6 +11,7 @@ using MLEM.Startup;
using MLEM.Textures;
using MonoGame.Extended;
using MonoGame.Extended.Tiled;
+using RectangleF = MLEM.Misc.RectangleF;
namespace GreatSpringGameJam {
public class Map {
@@ -32,8 +33,12 @@ namespace GreatSpringGameJam {
public Map(TiledMap map) {
this.map = map;
this.renderer = new IndividualTiledMapRenderer(this.map);
- this.Collisions = new TiledMapCollisions(this.map);
- this.TotalSnow = this.GetTotalTiles("Snow");
+ this.Collisions = new TiledMapCollisions(this.map, (collisions, info) => {
+ // snow should only "collide" with the snow blower wind
+ if (info.Layer.Name != "Snow")
+ TiledMapCollisions.DefaultCollectCollisions(collisions, info);
+ });
+ this.TotalSnow = this.GetTotalTiles("Snow") / 2;
this.TotalSeeds = this.GetTotalTiles("Seed");
foreach (var (pos, _) in this.EnumerateTiles("Gnome")) {
@@ -84,6 +89,10 @@ namespace GreatSpringGameJam {
return tile.GetTileset(this.map);
}
+ public RectangleF GetArea(TiledMapObject obj, Vector2? pos = null) {
+ return obj.GetArea(this.map, pos).ToMlem();
+ }
+
public void Draw(GameTime time, SpriteBatch batch, Camera camera) {
batch.Begin(SpriteSortMode.Deferred, null, SamplerState.PointClamp, transformMatrix: camera.ViewMatrix);
// render background
diff --git a/GreatSpringGameJam/SnowBlowerWind.cs b/GreatSpringGameJam/SnowBlowerWind.cs
index 1dbadec..62190be 100644
--- a/GreatSpringGameJam/SnowBlowerWind.cs
+++ b/GreatSpringGameJam/SnowBlowerWind.cs
@@ -1,8 +1,10 @@
using System;
+using System.Linq;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using MLEM.Extended.Tiled;
using MLEM.Extensions;
+using MLEM.Misc;
using MLEM.Textures;
namespace GreatSpringGameJam {
@@ -26,13 +28,21 @@ namespace GreatSpringGameJam {
var (x, y) = this.Position.ToPoint();
var tile = this.Map.GetTile("Snow", x, y);
if (!tile.IsBlank) {
- this.Map.SetTile("Snow", x, y, 0);
- var hidden = this.Map.GetTile("SnowHidden", x, y);
- if (!hidden.IsBlank) {
- this.Map.SetTile("Ground", x, y, hidden.GlobalIdentifier);
- this.Map.SetTile("SnowHidden", x, y, 0);
+ var tilesetTile = this.Map.GetTilesetTile(tile, this.Map.GetTileset(tile));
+ // check if the wind actually intersects with the snow's collision box
+ if (tilesetTile.Objects.Any(o => this.Map.GetArea(o, new Vector2(x, y)).Contains(this.Position))) {
+ if (tilesetTile.Properties.GetBool("SnowBottom"))
+ y--;
+ for (var yOff = 0; yOff <= 1; yOff++) {
+ this.Map.SetTile("Snow", x, y + yOff, 0);
+ var hidden = this.Map.GetTile("SnowHidden", x, y + yOff);
+ if (!hidden.IsBlank) {
+ this.Map.SetTile("Ground", x, y + yOff, hidden.GlobalIdentifier);
+ this.Map.SetTile("SnowHidden", x, y + yOff, 0);
+ }
+ this.Map.RemoveEntity(this);
+ }
}
- this.Map.RemoveEntity(this);
}
}
}