From 18f90721b8e1e50d0dfee8ff08674bc3da292004 Mon Sep 17 00:00:00 2001 From: Ellpeck Date: Mon, 8 Mar 2021 02:37:40 +0100 Subject: [PATCH] added snow blower and watering can --- GreatSpringGameJam/Content/Content.mgcb | 5 + GreatSpringGameJam/Content/Maps/Level1.tmx | 78 +++++++++++++++- .../Content/Textures/Stuff.aseprite | Bin 0 -> 535 bytes GreatSpringGameJam/Content/Textures/Stuff.png | Bin 0 -> 400 bytes .../Content/Tilesets/World.aseprite | Bin 738 -> 1101 bytes GreatSpringGameJam/Content/Tilesets/World.png | Bin 670 -> 1183 bytes GreatSpringGameJam/Content/Tilesets/World.tsx | 10 ++ GreatSpringGameJam/Entity.cs | 20 ++++ GreatSpringGameJam/GameImpl.cs | 10 +- GreatSpringGameJam/Map.cs | 30 +++++- GreatSpringGameJam/Player.cs | 87 +++++++++++++----- GreatSpringGameJam/SnowBlowerWind.cs | 45 +++++++++ GreatSpringGameJam/WaterDrop.cs | 53 +++++++++++ 13 files changed, 302 insertions(+), 36 deletions(-) create mode 100644 GreatSpringGameJam/Content/Textures/Stuff.aseprite create mode 100644 GreatSpringGameJam/Content/Textures/Stuff.png create mode 100644 GreatSpringGameJam/SnowBlowerWind.cs create mode 100644 GreatSpringGameJam/WaterDrop.cs diff --git a/GreatSpringGameJam/Content/Content.mgcb b/GreatSpringGameJam/Content/Content.mgcb index 826bf32..5db4950 100644 --- a/GreatSpringGameJam/Content/Content.mgcb +++ b/GreatSpringGameJam/Content/Content.mgcb @@ -29,3 +29,8 @@ /processor:TextureProcessor /build:Textures/Player.png +#begin Textures/Stuff.png +/importer:TextureImporter +/processor:TextureProcessor +/build:Textures/Stuff.png + diff --git a/GreatSpringGameJam/Content/Maps/Level1.tmx b/GreatSpringGameJam/Content/Maps/Level1.tmx index b4f18f4..6100796 100644 --- a/GreatSpringGameJam/Content/Maps/Level1.tmx +++ b/GreatSpringGameJam/Content/Maps/Level1.tmx @@ -1,7 +1,7 @@ - + - + 0,0,0,0,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 index 0000000000000000000000000000000000000000..88274dc8e0536b40c4b696d3b5f55c1903ed5b2c GIT binary patch literal 535 zcmWey!5 zK=Sp~y+AVU@J%3TQS%N+np!Rbk~4cjWTam{kkpp)29g}CeE+S0cCmoMMF40I$daBk zpz%Pnfd&Ij1sVx74`>+BB%m=sGk^vFbpy4^gLEn|Be@l5Bm+BxPhw?ik%HkoAcs`} zh=K4wFcKiZgn@&hVoq{GLV|~N&1ZWaW1hl>ckJD>%AIfdpLl1!HRg+a%hsiPHYPcx z?cKL)`kDu+`EciZXT*3S!+85klgvn%zb{svCE_V!oVJIj9yPkvBVD)Wn< zv}g05TimsmNYf!Um&Q95R?R%F5+={Je-ZE>hiqfMOPd<3x zUVc$t)huG)88(UUy8_pi7A@Zwqv_^y^RE^VV(Z>#(?C@5lDNU*0V4 z$n9rY*Uek)51%Eb>!EbJnbHbh=Pva3KJ3p~Z+Wf$ w7xS~gbt29`PJhhSFZs1R_y;g}$OGE%MLp)Exz0*u;sF`p>FVdQ&MBb@05=Yp(*OVf literal 0 HcmV?d00001 diff --git a/GreatSpringGameJam/Content/Tilesets/World.aseprite b/GreatSpringGameJam/Content/Tilesets/World.aseprite index 4bf1ba8b3454c6bf82cced68eafdef627d0352d1..8cb7089968a5d5d0a9b8aeb291be8e2a776abd6a 100644 GIT binary patch delta 770 zcmV+d1O5Es1jms=wXn4H z4mN_7g(pxDEbRoZ5Lt0x9CzbpC)t^G{||=f=FPr+`yNePwk?^@y_Xz|Eg9DCG{k(%x!26i8u{?9N9)CZBH&#Qy!Y+B zq<+m^w^aU=cZ=~`yVF44<#B6H{i>;-OY+GFd9VHav6`Y)a_bi_!M$6L#oC>Q)baAv zyr&+wcD~%t*M5GPZ|zP)%)9p>@7Ck6cBcW}*YW=TbU#w0+Eb5NGaufU^B(hXeR=a0 zQ|nUe*UoR*c_w!Ro52^JQ`8clY6L{|vc<&QcN z@?N9<*5=Fe@1UHP>UaJ(YCUhQ(@Om=*IUn9>)^PqPvE^z;2i*e000000000000000 z004kt2>0)c{S5p;e&%|L<WICH(H?&X5_>e?Z=rkIn*uLYzw{=HAjj}$CTsi#;Te~%vcW=Zdw z{y;r6`{mU67wqf(qd9jf{qlZrZpJ_SyG`fj@HQORwT0&Vdu}`MhxhaEpLB}2P~$bF Axc~qF delta 404 zcmV;F0c-xv2;v0-;sTKZega|wk%C4E+(bP80094tW|7fc2HZqE|BPmnGXX|_X#oHL z1t0(b0RR91{{jF200000002(_AOLur?U>OG0wD~BS;fQ^Oic9AEgZrjoWNn6!3}(J z7Y&I`dX>XoLE4%&`Cov)2Oj~NODUz*W%u-?^p5*!{amWKoIP`$ubYXueIxw953l2K z*iTeiYi_?Cw;#E)xPGkKe65Lpvcv1hOt9!W=@^`sdO7|q%8ZkLXqYqq4h zebM%p*umMV<-=#Nr=OnhZys)2Pd{cSx!-%L#B51_YkrB}3p_&gT_U^XS5~GCKY0qWu9pj9Z>_Lm4p4riB-!J*K?_9|p zZRxG>q+l29G}&nfX6LQG(+*%q>lcglomF-)C(E+Tj>E7v?w5YcXV#N~U9byw`aC?d y^Z5TxJAmDY`mEJY|KDkcr}_@>vo^OJUg|sAugxt-ycO~YcJc^z@^}G%^HG>WY|Lo@ diff --git a/GreatSpringGameJam/Content/Tilesets/World.png b/GreatSpringGameJam/Content/Tilesets/World.png index a09c7fa6af5e034411cbc2409cb617027a7598a0..7c12efb06f06350723f74af88f277cd7dce13e16 100644 GIT binary patch delta 1111 zcmV-d1gQI-1)m9!FnQwuG$ zQ^yJp4t4CHn>x9=WOeAKqX-(P(oUuL4;L|oN@_t`P!hy;EQWJvUwHQ~xy#+<@{;do zN&D{ouGjm$yu7=2xwGWhP+`IrgX}DASRx{uOT&@3d-nWk-+%JrkKd8EW28{FA_sMl zlOn;%zdL;B_^C@-r2WObqDUG_R$yi?gz z$0U}BvjMnwdZ*DF!Oqf#Ri3(8-}cJse~!BO-zPosdL6wHOugvy)NK|oA~OE`gZVvx zh%@o}&IsB`s((CeSyJ&+Qj^t%T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v7W`v6;0;&{EJ_5u3R znsq7peJTLj(FXRM0_Zsf&~t0`JOIrl|2zQgB>y}B?Ig7iFqunx_5pfM7tnJGlVJoW glW+tH7+8D%00l9xQ6-a^V*mgE07*qoM6N<$f&qstumAu6 diff --git a/GreatSpringGameJam/Content/Tilesets/World.tsx b/GreatSpringGameJam/Content/Tilesets/World.tsx index 825cfee..64d2339 100644 --- a/GreatSpringGameJam/Content/Tilesets/World.tsx +++ b/GreatSpringGameJam/Content/Tilesets/World.tsx @@ -41,4 +41,14 @@ + + + + + + + + + + diff --git a/GreatSpringGameJam/Entity.cs b/GreatSpringGameJam/Entity.cs index b88351e..570f352 100644 --- a/GreatSpringGameJam/Entity.cs +++ b/GreatSpringGameJam/Entity.cs @@ -1,9 +1,17 @@ +using System; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using MLEM.Extensions; +using MLEM.Startup; +using MLEM.Textures; +using RectangleF = MonoGame.Extended.RectangleF; namespace GreatSpringGameJam { public class Entity { + public static readonly UniformTextureAtlas StuffTexture = new(MlemGame.LoadContent("Textures/Stuff"), 8, 8); + protected static readonly Random Random = new(); + public readonly Map Map; public Vector2 Position; @@ -18,5 +26,17 @@ namespace GreatSpringGameJam { public virtual void Draw(GameTime time, SpriteBatch batch) { } + protected void Collide(Func getArea, ref Vector2 velocity, out bool onGround) { + onGround = false; + foreach (var (normal, penetration) in this.Map.Collisions.GetPenetrations(getArea)) { + if (penetration.Equals(0, 0.015F)) + continue; + this.Position -= normal * penetration; + velocity *= new Vector2(Math.Abs(normal.Y), Math.Abs(normal.X)); + if (normal.Y > 0) + onGround = true; + } + } + } } \ No newline at end of file diff --git a/GreatSpringGameJam/GameImpl.cs b/GreatSpringGameJam/GameImpl.cs index 081bd7b..0f6dc46 100644 --- a/GreatSpringGameJam/GameImpl.cs +++ b/GreatSpringGameJam/GameImpl.cs @@ -8,10 +8,11 @@ namespace GreatSpringGameJam { public static GameImpl Instance { get; private set; } public Map Map { get; private set; } public Player Player { get; private set; } - private Camera camera; + public Camera Camera { get; private set; } public GameImpl() { Instance = this; + this.IsMouseVisible = true; } protected override void LoadContent() { @@ -21,7 +22,7 @@ namespace GreatSpringGameJam { base.LoadContent(); this.InputHandler.HandleKeyboardRepeats = false; - this.camera = new Camera(this.GraphicsDevice) { + this.Camera = new Camera(this.GraphicsDevice) { AutoScaleWithScreen = true, Scale = 4, Position = new Vector2(0, float.MaxValue) @@ -35,13 +36,14 @@ namespace GreatSpringGameJam { base.DoUpdate(gameTime); this.Map.Update(gameTime); - this.camera.ConstrainWorldBounds(Vector2.Zero, this.Map.SizeInPixels.ToVector2()); + this.Camera.LookingPosition = Vector2.Lerp(this.Camera.LookingPosition, (this.Player.Position + Vector2.One / 2) * this.Map.TileSize, 0.25F); + this.Camera.ConstrainWorldBounds(Vector2.Zero, this.Map.SizeInPixels.ToVector2()); } protected override void DoDraw(GameTime gameTime) { this.GraphicsDevice.Clear(Color.CornflowerBlue); base.DoDraw(gameTime); - this.Map.Draw(gameTime, this.SpriteBatch, this.camera); + this.Map.Draw(gameTime, this.SpriteBatch, this.Camera); } } diff --git a/GreatSpringGameJam/Map.cs b/GreatSpringGameJam/Map.cs index c192ca7..76fed6f 100644 --- a/GreatSpringGameJam/Map.cs +++ b/GreatSpringGameJam/Map.cs @@ -29,19 +29,43 @@ namespace GreatSpringGameJam { this.entities.Add(entity); } + public void RemoveEntity(Entity entity) { + this.entities.Remove(entity); + } + public void Update(GameTime time) { this.renderer.UpdateAnimations(time); - foreach (var entity in this.entities) - entity.Update(time); + for (var i = this.entities.Count - 1; i >= 0; i--) + this.entities[i].Update(time); + } + + public TiledMapTile GetTile(string layer, int x, int y) { + return this.map.GetTile(layer, x, y); + } + + public void SetTile(string layer, int x, int y, int globalTile) { + var index = this.map.GetTileLayerIndex(layer); + this.map.SetTile(layer, x, y, globalTile); + this.renderer.UpdateDrawInfo(index, x, y); + this.Collisions.UpdateCollisionInfo(index, x, y); + } + + public TiledMapTilesetTile GetTilesetTile(TiledMapTile tile) { + return tile.GetTilesetTile(this.map); } public void Draw(GameTime time, SpriteBatch batch, Camera camera) { batch.Begin(SpriteSortMode.Deferred, null, SamplerState.PointClamp, transformMatrix: camera.ViewMatrix); - this.renderer.Draw(batch, camera.GetVisibleRectangle().ToExtended()); + this.DrawLayer(batch, "Ground", camera); foreach (var entity in this.entities) entity.Draw(time, batch); + this.DrawLayer(batch, "Snow", camera); batch.End(); } + private void DrawLayer(SpriteBatch batch, string layer, Camera camera) { + this.renderer.DrawLayer(batch, this.map.GetTileLayerIndex(layer), camera.GetVisibleRectangle().ToExtended()); + } + } } \ No newline at end of file diff --git a/GreatSpringGameJam/Player.cs b/GreatSpringGameJam/Player.cs index f7ccf1f..2ed323a 100644 --- a/GreatSpringGameJam/Player.cs +++ b/GreatSpringGameJam/Player.cs @@ -1,56 +1,56 @@ using System; -using System.Collections.Generic; -using System.Linq; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Microsoft.Xna.Framework.Input; using MLEM.Animations; using MLEM.Extended.Extensions; -using MLEM.Extended.Tiled; using MLEM.Extensions; +using MLEM.Input; using MLEM.Startup; using MLEM.Textures; using MonoGame.Extended; -using MonoGame.Extended.Tiled; using RectangleF = MLEM.Misc.RectangleF; namespace GreatSpringGameJam { public class Player : Entity { - private static readonly UniformTextureAtlas Atlas = new(MlemGame.LoadContent("Textures/Player"), 4, 1); - private readonly SpriteAnimationGroup animations; + private static readonly UniformTextureAtlas PlayerTexture = new(MlemGame.LoadContent("Textures/Player"), 4, 1); public RectangleF Bounds => new(this.Position + new Vector2(4 / 16F, 0), new Vector2(9 / 16F, 1)); + private readonly SpriteAnimationGroup animations; private bool walking; private bool onGround; private Vector2 velocity; private TimeSpan jumpTime; private bool facingRight; + private HeldItem heldItem; public Player(Map map, Vector2 position) : base(map, position) { this.animations = new SpriteAnimationGroup(); - this.animations.Add(new SpriteAnimation(0.15F, Atlas[1], Atlas[2], Atlas[3], Atlas[0]), () => this.walking); - this.animations.Add(new SpriteAnimation(1, Atlas[0]), () => !this.walking); + this.animations.Add(new SpriteAnimation(0.15F, PlayerTexture[1], PlayerTexture[2], PlayerTexture[3], PlayerTexture[0]), () => this.walking); + this.animations.Add(new SpriteAnimation(1, PlayerTexture[0]), () => !this.walking); } public override void Update(GameTime time) { base.Update(time); // input - var lastVel = this.velocity; - if (MlemGame.Input.IsAnyDown(Keys.A, Keys.Left, Buttons.DPadLeft, Buttons.LeftThumbstickLeft)) { - this.velocity.X -= 0.04F; + var move = 0F; + if (MlemGame.Input.IsAnyDown(Keys.A, Keys.Left)) { + move -= 0.04F; this.facingRight = false; } - if (MlemGame.Input.IsAnyDown(Keys.D, Keys.Right, Buttons.DPadRight, Buttons.LeftThumbstickRight)) { - this.velocity.X += 0.04F; + if (MlemGame.Input.IsAnyDown(Keys.D, Keys.Right)) { + move += 0.04F; this.facingRight = true; } - this.walking = this.velocity != lastVel; - if (MlemGame.Input.IsAnyDown(Keys.Up, Buttons.B, Keys.Space)) { + this.walking = move != 0; + this.velocity.X += move; + + if (MlemGame.Input.IsAnyDown(Keys.Up, Keys.Space)) { // only start jumping if we just started pressing the buttons - if (this.onGround && MlemGame.Input.IsAnyPressed(Keys.Up, Buttons.B, Keys.Space)) + if (this.onGround && MlemGame.Input.IsAnyPressed(Keys.Up, Keys.Space)) this.jumpTime = TimeSpan.FromSeconds(0.3F); this.jumpTime -= time.ElapsedGameTime; if (this.jumpTime > TimeSpan.Zero) @@ -60,24 +60,63 @@ namespace GreatSpringGameJam { } // movement and collisions - this.onGround = false; this.Position += this.velocity; - foreach (var (normal, penetration) in this.Map.Collisions.GetPenetrations(() => this.Bounds.ToExtended())) { - this.Position -= normal * penetration; - this.velocity *= new Vector2(Math.Abs(normal.Y), Math.Abs(normal.X)); - if (normal.Y > 0) - this.onGround = true; - } + this.Collide(() => this.Bounds.ToExtended(), ref this.velocity, out this.onGround); this.velocity *= new Vector2(this.onGround ? 0.5F : 0.6F, 0.9F); this.velocity.Y += 0.02F; + // item usage + var rot = this.GetHeldRotation(); + var rotVec = new Vector2(MathF.Cos(rot), MathF.Sin(rot)); + if (MlemGame.Input.IsDown(MouseButton.Left)) { + this.heldItem = HeldItem.SnowBlower; + Random.NextUnitVector(out var vel); + vel = vel * 0.03F + rotVec * 0.13F; + this.Map.AddEntity(new SnowBlowerWind(this.Map, this.Position + Vector2.One / 2 + rotVec * 0.75F, vel)); + } else if (MlemGame.Input.IsDown(MouseButton.Right)) { + this.heldItem = HeldItem.WateringCan; + if (Random.NextSingle() <= 0.45F) { + Random.NextUnitVector(out var vel); + vel = vel * 0.015F + rotVec * 0.03F; + this.Map.AddEntity(new WaterDrop(this.Map, this.Position + Vector2.One / 2 + rotVec * 0.65F, vel)); + } + } + this.animations.Update(time); } public override void Draw(GameTime time, SpriteBatch batch) { base.Draw(time, batch); + + // draw self + var pos = this.Position * this.Map.TileSize; var effects = this.facingRight ? SpriteEffects.FlipHorizontally : SpriteEffects.None; - batch.Draw(this.animations.CurrentRegion, this.Position * this.Map.TileSize, Color.White, 0, Vector2.Zero, 1, effects, 0); + batch.Draw(this.animations.CurrentRegion, pos, Color.White, 0, Vector2.Zero, 1, effects, 0); + + // draw held item + var tex = this.heldItem switch { + HeldItem.SnowBlower => StuffTexture[0, 0], + HeldItem.WateringCan => StuffTexture[2, 0], + _ => null + }; + var origin = new Vector2(tex.Width * 0.25F, tex.Height / 2); + var rot = this.GetHeldRotation(); + var flip = rot >= MathHelper.PiOver2 && rot <= MathHelper.Pi * 1.5F ? SpriteEffects.FlipVertically : SpriteEffects.None; + batch.Draw(tex, pos + this.Map.TileSize / 2, Color.White, rot, origin, 1, flip, 0); + } + + private float GetHeldRotation() { + var myPos = GameImpl.Instance.Camera.ToCameraPos((this.Position + Vector2.One / 2) * this.Map.TileSize); + var mousePos = MlemGame.Input.MousePosition.ToVector2(); + var (x, y) = myPos - mousePos; + return MathF.Atan2(y, x) + MathHelper.Pi; + } + + private enum HeldItem { + + SnowBlower, + WateringCan + } } diff --git a/GreatSpringGameJam/SnowBlowerWind.cs b/GreatSpringGameJam/SnowBlowerWind.cs new file mode 100644 index 0000000..28722e5 --- /dev/null +++ b/GreatSpringGameJam/SnowBlowerWind.cs @@ -0,0 +1,45 @@ +using System; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using MLEM.Extended.Tiled; +using MLEM.Extensions; +using MLEM.Textures; + +namespace GreatSpringGameJam { + public class SnowBlowerWind : Entity { + + private readonly Vector2 velocity; + private TimeSpan timeToLive; + + public SnowBlowerWind(Map map, Vector2 position, Vector2 velocity) : base(map, position) { + this.velocity = velocity; + this.timeToLive = TimeSpan.FromSeconds(0.25F); + } + + public override void Update(GameTime time) { + base.Update(time); + this.Position += this.velocity; + this.timeToLive -= time.ElapsedGameTime; + if (this.timeToLive <= TimeSpan.Zero) { + this.Map.RemoveEntity(this); + } else { + 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.RemoveEntity(this); + } + } + } + + public override void Draw(GameTime time, SpriteBatch batch) { + base.Draw(time, batch); + var tex = StuffTexture[1, 0]; + batch.Draw(tex, this.Position * this.Map.TileSize - tex.Size.ToVector2() / 2, Color.White); + } + + } +} \ No newline at end of file diff --git a/GreatSpringGameJam/WaterDrop.cs b/GreatSpringGameJam/WaterDrop.cs new file mode 100644 index 0000000..8827349 --- /dev/null +++ b/GreatSpringGameJam/WaterDrop.cs @@ -0,0 +1,53 @@ +using System; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using MLEM.Extended.Tiled; +using MLEM.Textures; +using MonoGame.Extended; + +namespace GreatSpringGameJam { + public class WaterDrop : Entity { + + private readonly bool growsPlants; + private Vector2 velocity; + private TimeSpan timeToLive; + + public WaterDrop(Map map, Vector2 position, Vector2 velocity) : base(map, position) { + this.velocity = velocity; + this.timeToLive = TimeSpan.FromSeconds(0.5F); + this.growsPlants = Random.NextSingle() <= 0.25F; + } + + public override void Update(GameTime time) { + base.Update(time); + + this.Position += this.velocity; + this.Collide(() => new RectangleF(this.Position - new Vector2(1 / 16F), new Vector2(2 / 16F)), ref this.velocity, out var onGround); + if (onGround) + this.velocity = Vector2.Zero; + this.velocity.Y += 0.008F; + + this.timeToLive -= time.ElapsedGameTime; + if (this.timeToLive <= TimeSpan.Zero) { + if (this.growsPlants) { + var (x, y) = this.Position.ToPoint(); + var tile = this.Map.GetTile("Ground", x, y); + if (!tile.IsBlank) { + var tilesetTile = this.Map.GetTilesetTile(tile); + var grown = tilesetTile.Properties.GetInt("GrownVersion"); + if (grown != 0) + this.Map.SetTile("Ground", x, y, grown + 1); + } + } + this.Map.RemoveEntity(this); + } + } + + public override void Draw(GameTime time, SpriteBatch batch) { + base.Draw(time, batch); + var tex = StuffTexture[3, 0]; + batch.Draw(tex, this.Position * this.Map.TileSize - tex.Size.ToVector2() / 2, Color.White); + } + + } +} \ No newline at end of file