made the gnome look good

This commit is contained in:
Ell 2021-03-09 23:21:52 +01:00
parent e29a4d2126
commit a881cf0bdc
7 changed files with 61 additions and 22 deletions

View File

@ -27,12 +27,12 @@
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,38,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,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,38,1,2,2,3,0,0,0,0,0,0,0,0,1,2,2,2,2,3,38,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,33,33,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,116,117,118,119,120,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,2,2,2,2,5,18,18,19,0,0,0,0,0,0,0,0,17,18,18,18,18,4,2,2,2,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,49,49,0,0,0,0,0,
0,0,68,69,70,0,0,84,85,86,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,38,0,0,0,17,18,18,18,18,18,18,18,4,2,2,2,2,3,0,0,1,5,18,18,18,18,18,18,18,18,19,0,0,0,0,0,0,0,0,0,0,0,0,0,0,65,81,81,0,55,54,0,
0,0,71,72,73,0,0,100,101,102,103,104,0,0,0,0,0,0,39,0,0,0,0,0,0,0,0,1,2,2,2,3,0,0,0,17,18,18,18,18,18,18,18,18,18,18,18,18,19,0,0,17,18,4,2,2,2,5,18,18,18,19,39,39,0,0,0,0,1,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,1,2,2,2,2,2,2,3,0,0,0,0,0,0,0,17,18,18,18,19,0,0,0,17,4,2,2,2,2,5,18,18,18,18,18,18,19,0,0,9,21,18,18,18,18,18,18,18,18,4,2,2,3,0,0,0,17,18,18,18,18,18,18,18,18,18,18,18,18,18,18,
0,0,0,0,0,0,0,0,0,0,0,0,17,18,18,18,18,18,18,19,0,0,0,0,38,39,0,17,4,2,5,19,0,0,0,17,18,18,18,18,18,18,18,18,4,2,2,5,19,0,0,0,9,10,21,18,18,18,18,18,18,18,18,18,19,0,0,0,17,4,2,2,2,2,2,5,18,18,18,18,18,18,18,
2,2,2,2,2,2,2,2,2,2,2,2,5,18,4,2,2,2,5,19,0,0,0,1,2,2,2,5,18,18,18,19,0,0,0,17,18,18,18,18,18,18,18,18,18,18,18,18,19,0,0,0,0,0,17,18,4,2,2,2,2,2,2,5,19,0,0,0,17,18,18,18,18,18,18,18,18,4,2,2,2,5,18,
18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,19,0,0,0,17,18,18,18,18,18,18,18,19,0,0,0,17,18,18,4,2,2,2,2,2,2,5,18,18,19,0,37,0,82,0,17,18,18,18,18,18,18,18,18,18,19,0,0,0,17,18,18,18,18,18,18,18,18,18,18,18,18,18,18,
0,0,68,69,70,0,0,84,85,86,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,38,0,0,0,17,18,18,18,18,18,18,18,4,2,2,2,2,3,0,0,0,17,18,18,18,18,18,18,18,18,19,0,0,0,0,0,0,0,0,0,0,0,0,0,0,65,81,81,0,55,54,0,
0,0,71,72,73,0,0,100,101,102,103,104,0,0,0,0,0,0,39,0,0,0,0,0,0,0,0,1,2,2,2,3,0,0,0,17,18,18,18,18,18,18,18,18,18,18,18,18,19,0,0,1,5,4,2,2,2,5,18,18,18,19,39,39,0,0,0,0,1,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,1,2,2,2,2,2,2,3,0,0,0,0,0,0,0,17,18,18,18,19,0,0,0,17,4,2,2,2,2,5,18,18,18,18,18,18,19,0,0,9,10,10,21,18,18,18,18,18,18,4,2,2,3,0,0,0,17,18,18,18,18,18,18,18,18,18,18,18,18,18,18,
0,0,0,0,0,0,0,0,0,0,0,0,17,18,18,18,18,18,18,19,0,0,0,0,38,39,0,17,4,2,5,19,0,0,0,17,18,18,18,18,18,18,18,18,4,2,2,5,19,0,0,0,0,0,17,18,18,18,18,18,18,18,18,18,19,0,0,0,17,4,2,2,2,2,2,5,18,18,18,18,18,18,18,
2,2,2,2,2,2,2,2,2,2,2,2,5,18,4,2,2,2,5,19,0,0,0,1,2,2,2,5,18,18,18,19,0,0,0,17,18,18,18,18,18,18,18,18,18,18,18,18,19,0,0,0,82,0,17,18,4,2,2,2,2,2,2,5,19,0,0,0,17,18,18,18,18,18,18,18,18,4,2,2,2,5,18,
18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,19,0,0,0,17,18,18,18,18,18,18,18,19,0,0,0,17,18,18,4,2,2,2,2,2,2,5,18,18,19,0,37,0,0,0,17,18,18,18,18,18,18,18,18,18,19,0,0,0,17,18,18,18,18,18,18,18,18,18,18,18,18,18,18,
18,18,18,18,18,18,4,2,2,2,2,2,5,18,18,18,18,18,18,19,0,0,0,17,4,2,2,2,2,5,18,19,0,0,0,17,18,18,18,18,18,18,18,18,18,18,18,18,19,0,1,2,2,2,5,18,18,18,18,18,4,2,2,5,19,0,0,0,17,18,18,18,4,2,2,2,2,2,5,18,18,18,18,
18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,19,0,0,0,17,18,18,18,18,18,18,18,19,0,0,0,17,18,18,18,18,18,18,18,18,18,18,18,18,19,0,9,21,18,18,18,18,18,18,18,18,18,18,18,18,19,0,0,0,17,18,18,18,18,18,18,18,18,18,18,18,18,18,18,
18,4,2,2,2,5,18,18,18,18,4,2,2,2,2,2,2,5,18,19,0,0,0,17,18,4,2,2,2,2,5,19,0,0,0,17,4,2,2,2,2,5,18,18,18,18,18,18,19,0,0,17,4,2,2,2,2,2,5,18,18,18,18,18,19,0,0,0,17,4,2,2,2,2,2,5,18,18,18,18,18,18,18,

View File

@ -32,10 +32,10 @@
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,39,0,0,0,0,0,0,0,0,0,1,2,2,2,3,0,0,0,0,0,0,0,0,0,0,0,0,0,1,5,18,18,4,2,2,2,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,49,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,1,2,2,2,3,0,0,0,0,0,0,0,0,0,17,18,18,18,19,39,0,0,0,0,0,0,0,38,0,0,0,0,17,18,18,18,18,18,18,18,19,0,0,0,0,0,0,38,0,0,0,0,0,0,0,0,65,81,0,54,55,0,0,54,0,0,
0,0,0,0,0,39,0,0,0,0,0,0,0,0,0,0,0,17,4,2,5,4,2,3,0,0,0,0,39,0,0,17,4,2,5,4,3,0,0,0,0,1,2,2,2,2,2,2,2,5,4,2,2,2,5,18,18,19,0,0,0,0,1,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,2,2,2,2,3,0,0,0,0,0,0,0,17,18,18,18,18,18,19,0,0,0,1,2,2,2,5,18,18,18,18,19,0,0,0,0,17,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,19,0,0,0,0,17,18,18,18,18,18,18,18,18,18,18,18,18,18,18,4,2,2,2,5,18,
18,18,18,18,18,18,18,18,18,19,0,0,0,0,0,0,0,17,18,4,2,2,5,19,0,0,0,17,18,18,18,18,18,18,18,18,19,0,0,0,0,9,10,10,21,4,2,2,2,5,18,18,18,18,18,18,18,4,3,0,0,38,17,18,4,2,2,2,2,2,2,5,18,4,2,2,5,18,18,18,18,18,18,
18,18,4,2,2,2,2,5,18,4,3,0,0,0,0,37,39,17,18,18,18,18,18,19,0,0,0,17,18,4,2,2,2,2,2,5,19,0,0,0,0,0,0,0,17,18,18,18,18,18,18,4,2,2,2,2,2,5,19,0,0,1,5,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,
18,18,18,18,18,4,2,2,5,18,19,0,0,0,1,2,2,5,4,2,2,5,18,19,0,0,0,17,4,2,2,2,5,18,18,18,4,2,2,3,0,0,82,0,17,4,2,2,2,2,5,18,18,18,18,18,18,18,19,0,0,17,18,4,2,2,2,5,18,18,18,4,2,2,2,2,2,2,2,5,18,18,18,
2,2,2,2,2,2,2,2,2,3,0,0,0,0,0,0,0,17,18,18,18,18,18,19,0,0,0,1,2,2,2,5,18,18,18,18,19,0,0,0,0,9,10,10,21,18,18,18,18,18,18,18,18,18,18,18,18,19,0,0,0,0,17,18,18,18,18,18,18,18,18,18,18,18,18,18,18,4,2,2,2,5,18,
18,18,18,18,18,18,18,18,18,19,0,0,0,0,0,0,0,17,18,4,2,2,5,19,0,0,0,17,18,18,18,18,18,18,18,18,19,0,0,0,0,0,0,0,17,4,2,2,2,5,18,18,18,18,18,18,18,4,3,0,0,38,17,18,4,2,2,2,2,2,2,5,18,4,2,2,5,18,18,18,18,18,18,
18,18,4,2,2,2,2,5,18,4,3,0,0,0,0,37,39,17,18,18,18,18,18,19,0,0,0,17,18,4,2,2,2,2,2,5,19,0,0,0,0,0,82,0,17,18,18,18,18,18,18,4,2,2,2,2,2,5,19,0,0,1,5,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,
18,18,18,18,18,4,2,2,5,18,19,0,0,0,1,2,2,5,4,2,2,5,18,19,0,0,0,17,4,2,2,2,5,18,18,18,4,2,2,3,0,0,0,0,17,4,2,2,2,2,5,18,18,18,18,18,18,18,19,0,0,17,18,4,2,2,2,5,18,18,18,4,2,2,2,2,2,2,2,5,18,18,18,
18,18,18,18,18,18,18,18,18,18,4,3,0,0,17,18,18,18,18,18,18,18,18,19,0,0,0,17,18,18,18,18,18,18,18,18,18,18,18,19,0,1,2,2,5,18,18,18,18,18,18,18,18,18,18,18,18,18,19,0,0,17,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,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0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,2,2,2,5,18,18,18,19,0,0,0,0,0,0,0,17,18,18,18,18,18,18,18,18,18,18,18,20,11,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,0,0,0,0,0,17,18,18,18,18,18,18,18,4,2,2,2,2,2,2,2,5,18,18,18,18,18,18,18,18,18,18,18,19,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,0,0,0,0,0,0,17,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,4,2,2,2,2,2,2,5,18,18,18,18,19,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,0,0,0,0,0,0,17,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,19,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,

View File

@ -1,4 +1,5 @@
using System.Collections.Generic;
using System.Linq;
using Coroutine;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Content;
@ -50,7 +51,7 @@ namespace GreatSpringGameJam {
AutoScaleWithScreen = true,
Scale = 4
};
this.StartLevel(3);
this.StartLevel(1);
}
protected override void DoUpdate(GameTime gameTime) {
@ -79,7 +80,7 @@ namespace GreatSpringGameJam {
// display end of level info
var snowRemoved = this.Map.TotalSnow - this.Map.GetTotalTiles("Snow");
var plantsGrown = this.Map.TotalSeeds - this.Map.GetTotalTiles("Seed");
var gnomesCollected = this.Map.TotalGnomes - this.Map.GetTotalTiles("Gnome");
var gnomesCollected = this.Map.TotalGnomes - this.Map.GetEntities<Gnome>().Count();
// snow removal is less important, gnomes are more important
var completion = (snowRemoved / 3F + plantsGrown + gnomesCollected * 10F) / (this.Map.TotalSnow / 3F + this.Map.TotalSeeds + this.Map.TotalGnomes * 10F);

View File

@ -0,0 +1,27 @@
using System;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using MLEM.Misc;
using MLEM.Textures;
namespace GreatSpringGameJam {
public class Gnome : Entity {
public Gnome(Map map, Vector2 position) : base(map, position) {
}
public override void Update(GameTime time) {
if (GameImpl.Instance.Player.Bounds.Contains(this.Position + Vector2.One / 2))
this.Map.RemoveEntity(this);
}
public override void Draw(GameTime time, SpriteBatch batch) {
base.Draw(time, batch);
var tex = StuffTexture[1, 1];
var offset = new Vector2(0, MathF.Sin((float) time.TotalGameTime.TotalSeconds * 2) * 0.15F);
var rotation = MathF.Sin((float) time.TotalGameTime.TotalSeconds * 1.5F) * 0.25F;
batch.Draw(tex, this.Position * this.Map.TileSize + tex.Size.ToVector2() / 2 + offset * this.Map.TileSize, Color.White, rotation, tex.Size.ToVector2() / 2, 1, SpriteEffects.None, 1);
}
}
}

View File

@ -1,4 +1,5 @@
using System.Collections.Generic;
using System.Linq;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using MLEM.Cameras;
@ -34,7 +35,12 @@ namespace GreatSpringGameJam {
this.Collisions = new TiledMapCollisions(this.map);
this.TotalSnow = this.GetTotalTiles("Snow");
this.TotalSeeds = this.GetTotalTiles("Seed");
this.TotalGnomes = this.GetTotalTiles("Gnome");
foreach (var (pos, _) in this.EnumerateTiles("Gnome")) {
this.entities.Add(new Gnome(this, new Vector2(pos.X, pos.Y)));
this.SetTile(pos.Layer, pos.X, pos.Y, 0);
}
this.TotalGnomes = this.entities.OfType<Gnome>().Count();
}
public void AddEntity(Entity entity) {
@ -45,6 +51,10 @@ namespace GreatSpringGameJam {
this.entities.Remove(entity);
}
public IEnumerable<T> GetEntities<T>() where T : Entity {
return this.entities.OfType<T>();
}
public void Update(GameTime time) {
this.renderer.UpdateAnimations(time);
for (var i = this.entities.Count - 1; i >= 0; i--)
@ -96,19 +106,22 @@ namespace GreatSpringGameJam {
}
public int GetTotalTiles(string type) {
var total = 0;
return this.EnumerateTiles(type).Count();
}
public IEnumerable<(LayerPosition, TiledMapTilesetTile)> EnumerateTiles(string type) {
for (var x = 0; x < this.map.Width; x++) {
for (var y = 0; y < this.map.Height; y++) {
foreach (var tile in this.map.GetTiles(x, y)) {
foreach (var layer in this.map.TileLayers) {
var tile = layer.GetTile(x, y);
if (tile.IsBlank)
continue;
var tilesetTile = this.GetTilesetTile(tile, this.GetTileset(tile));
if (tilesetTile.Properties.GetBool(type))
total++;
yield return (new LayerPosition(layer.Name, x, y), tilesetTile);
}
}
}
return total;
}
private void DrawLayer(SpriteBatch batch, string layer, Camera camera) {

View File

@ -47,13 +47,11 @@ namespace GreatSpringGameJam {
jumpHeight = 0.25F;
var (_, foregroundInside) = this.GetTileBelow(Vector2.Zero, "Foreground");
var ((insideX, insideY), tileInside) = this.GetTileBelow(Vector2.Zero);
var (_, tileInside) = this.GetTileBelow(Vector2.Zero);
if (foregroundInside != null && foregroundInside.Properties.GetBool("Goal")) {
GameImpl.Instance.Finish();
return;
}
if (tileInside != null && tileInside.Properties.GetBool("Gnome"))
this.Map.SetTile("Ground", insideX, insideY, 0);
// input
var move = Vector2.Zero;