diff --git a/GreatSpringGameJam/Content/Content.mgcb b/GreatSpringGameJam/Content/Content.mgcb index f28ae41..426665b 100644 --- a/GreatSpringGameJam/Content/Content.mgcb +++ b/GreatSpringGameJam/Content/Content.mgcb @@ -80,3 +80,28 @@ /processor:TiledMapProcessor /build:Maps/Level4.tmx +#begin Sounds/ButtonPress.ogg +/importer:OggImporter +/processor:SoundEffectProcessor +/build:Sounds/ButtonPress.ogg + +#begin Sounds/PlantGrow.ogg +/importer:OggImporter +/processor:SoundEffectProcessor +/build:Sounds/PlantGrow.ogg + +#begin Sounds/PlatformAppear.ogg +/importer:OggImporter +/processor:SoundEffectProcessor +/build:Sounds/PlatformAppear.ogg + +#begin Sounds/SnowBlower.ogg +/importer:OggImporter +/processor:SoundEffectProcessor +/build:Sounds/SnowBlower.ogg + +#begin Sounds/WateringCan.ogg +/importer:OggImporter +/processor:SoundEffectProcessor +/build:Sounds/WateringCan.ogg + diff --git a/GreatSpringGameJam/Content/Contentless.json b/GreatSpringGameJam/Content/Contentless.json index 805bbcc..2851e9c 100644 --- a/GreatSpringGameJam/Content/Contentless.json +++ b/GreatSpringGameJam/Content/Contentless.json @@ -4,5 +4,10 @@ "bin/", "Palettes/", "Tilesets/*.png" - ] + ], + "overrides": { + "Sounds/": { + "Processor": "SoundEffectProcessor" + } + } } \ No newline at end of file diff --git a/GreatSpringGameJam/Content/Sounds/ButtonPress.ogg b/GreatSpringGameJam/Content/Sounds/ButtonPress.ogg new file mode 100644 index 0000000..5c2334f Binary files /dev/null and b/GreatSpringGameJam/Content/Sounds/ButtonPress.ogg differ diff --git a/GreatSpringGameJam/Content/Sounds/PlantGrow.ogg b/GreatSpringGameJam/Content/Sounds/PlantGrow.ogg new file mode 100644 index 0000000..612935a Binary files /dev/null and b/GreatSpringGameJam/Content/Sounds/PlantGrow.ogg differ diff --git a/GreatSpringGameJam/Content/Sounds/PlatformAppear.ogg b/GreatSpringGameJam/Content/Sounds/PlatformAppear.ogg new file mode 100644 index 0000000..f3eb13f Binary files /dev/null and b/GreatSpringGameJam/Content/Sounds/PlatformAppear.ogg differ diff --git a/GreatSpringGameJam/Content/Sounds/SnowBlower.ogg b/GreatSpringGameJam/Content/Sounds/SnowBlower.ogg new file mode 100644 index 0000000..110fb14 Binary files /dev/null and b/GreatSpringGameJam/Content/Sounds/SnowBlower.ogg differ diff --git a/GreatSpringGameJam/Content/Sounds/Sounds.aup b/GreatSpringGameJam/Content/Sounds/Sounds.aup new file mode 100644 index 0000000..248a0e7 --- /dev/null +++ b/GreatSpringGameJam/Content/Sounds/Sounds.aup @@ -0,0 +1,59 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/GreatSpringGameJam/Content/Sounds/Sounds_data/e08/d08/e08087a6.au b/GreatSpringGameJam/Content/Sounds/Sounds_data/e08/d08/e08087a6.au new file mode 100644 index 0000000..d6979d1 Binary files /dev/null and b/GreatSpringGameJam/Content/Sounds/Sounds_data/e08/d08/e08087a6.au differ diff --git a/GreatSpringGameJam/Content/Sounds/Sounds_data/e08/d08/e08088fa.au b/GreatSpringGameJam/Content/Sounds/Sounds_data/e08/d08/e08088fa.au new file mode 100644 index 0000000..489594e Binary files /dev/null and b/GreatSpringGameJam/Content/Sounds/Sounds_data/e08/d08/e08088fa.au differ diff --git a/GreatSpringGameJam/Content/Sounds/Sounds_data/e08/d08/e0808a3d.au b/GreatSpringGameJam/Content/Sounds/Sounds_data/e08/d08/e0808a3d.au new file mode 100644 index 0000000..4b25c72 Binary files /dev/null and b/GreatSpringGameJam/Content/Sounds/Sounds_data/e08/d08/e0808a3d.au differ diff --git a/GreatSpringGameJam/Content/Sounds/Sounds_data/e08/d08/e0808d8c.au b/GreatSpringGameJam/Content/Sounds/Sounds_data/e08/d08/e0808d8c.au new file mode 100644 index 0000000..a890551 Binary files /dev/null and b/GreatSpringGameJam/Content/Sounds/Sounds_data/e08/d08/e0808d8c.au differ diff --git a/GreatSpringGameJam/Content/Sounds/Sounds_data/e08/d08/e0808f8a.au b/GreatSpringGameJam/Content/Sounds/Sounds_data/e08/d08/e0808f8a.au new file mode 100644 index 0000000..2e99931 Binary files /dev/null and b/GreatSpringGameJam/Content/Sounds/Sounds_data/e08/d08/e0808f8a.au differ diff --git a/GreatSpringGameJam/Content/Sounds/WateringCan.ogg b/GreatSpringGameJam/Content/Sounds/WateringCan.ogg new file mode 100644 index 0000000..4b2bed0 Binary files /dev/null and b/GreatSpringGameJam/Content/Sounds/WateringCan.ogg differ diff --git a/GreatSpringGameJam/GameImpl.cs b/GreatSpringGameJam/GameImpl.cs index 9a470f5..df473e0 100644 --- a/GreatSpringGameJam/GameImpl.cs +++ b/GreatSpringGameJam/GameImpl.cs @@ -6,6 +6,7 @@ using System.Linq; using System.Reflection; using Coroutine; using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Audio; using Microsoft.Xna.Framework.Content; using Microsoft.Xna.Framework.Graphics; using MLEM.Cameras; @@ -13,6 +14,7 @@ using MLEM.Extended.Extensions; using MLEM.Extensions; using MLEM.Font; using MLEM.Formatting.Codes; +using MLEM.Misc; using MLEM.Startup; using MLEM.Textures; using MLEM.Ui; @@ -50,6 +52,7 @@ namespace GreatSpringGameJam { this.UiSystem.Style.TextScale = 0.075F; this.UiSystem.Style.TextColor = ColorHelper.FromHexRgb(0xebd5bd); this.UiSystem.Style.ButtonTexture = new NinePatch(this.SpriteBatch.GenerateSquareTexture(ColorHelper.FromHexRgb(0x594e6f) * 0.35F), 0); + this.UiSystem.Style.ActionSound = new SoundEffectInfo(LoadContent("Sounds/ButtonPress")); this.UiSystem.AutoScaleWithScreen = true; this.UiSystem.Controls.HandleKeyboard = false; this.UiSystem.Controls.HandleGamepad = false; diff --git a/GreatSpringGameJam/GreatSpringGameJam.csproj b/GreatSpringGameJam/GreatSpringGameJam.csproj index a4ad4e4..0975540 100644 --- a/GreatSpringGameJam/GreatSpringGameJam.csproj +++ b/GreatSpringGameJam/GreatSpringGameJam.csproj @@ -10,9 +10,9 @@ - - - + + + diff --git a/GreatSpringGameJam/Map.cs b/GreatSpringGameJam/Map.cs index d1a9e2c..9fd8c67 100644 --- a/GreatSpringGameJam/Map.cs +++ b/GreatSpringGameJam/Map.cs @@ -2,6 +2,7 @@ using System; using System.Collections.Generic; using System.Linq; using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Audio; using Microsoft.Xna.Framework.Graphics; using MLEM.Cameras; using MLEM.Extended.Extensions; @@ -19,7 +20,9 @@ using RectangleF = MLEM.Misc.RectangleF; namespace GreatSpringGameJam { public class Map { + public static readonly SoundEffect ForgetMeNotPlatformSound = MlemGame.LoadContent("Sounds/PlatformAppear"); private static readonly UniformTextureAtlas BackgroundTexture = new(MlemGame.LoadContent("Textures/Backgrounds"), 8, 8); + public Point SizeInPixels => new(this.map.WidthInPixels, this.map.HeightInPixels); public Point SpawnPoint => new(this.map.Properties.GetInt("StartX"), this.map.Properties.GetInt("StartY")); public Point Size => new(this.map.Width, this.map.Height); @@ -76,8 +79,12 @@ namespace GreatSpringGameJam { this.renderer.UpdateAnimations(time); for (var i = this.entities.Count - 1; i >= 0; i--) this.entities[i].Update(time); - if (this.ForgetMeNotTime > TimeSpan.Zero) + if (this.ForgetMeNotTime > TimeSpan.Zero) { + // if the time is about to run out, we play the platform disappear sound + if (this.ForgetMeNotTime > ForgetMeNotPlatformSound.Duration && this.ForgetMeNotTime - time.ElapsedGameTime <= ForgetMeNotPlatformSound.Duration) + ForgetMeNotPlatformSound.Play(); this.ForgetMeNotTime -= time.ElapsedGameTime; + } } public TiledMapTile GetTile(string layer, int x, int y) { diff --git a/GreatSpringGameJam/Player.cs b/GreatSpringGameJam/Player.cs index 02c8258..52dc91a 100644 --- a/GreatSpringGameJam/Player.cs +++ b/GreatSpringGameJam/Player.cs @@ -2,6 +2,7 @@ using System; using System.Linq; using Coroutine; using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Audio; using Microsoft.Xna.Framework.Graphics; using Microsoft.Xna.Framework.Input; using MLEM.Animations; @@ -9,6 +10,7 @@ using MLEM.Extended.Extensions; using MLEM.Extended.Tiled; using MLEM.Extensions; using MLEM.Input; +using MLEM.Misc; using MLEM.Startup; using MLEM.Textures; using MonoGame.Extended; @@ -19,6 +21,7 @@ namespace GreatSpringGameJam { public class Player : Entity { private static readonly UniformTextureAtlas PlayerTexture = new(MlemGame.LoadContent("Textures/Player"), 4, 3); + private static readonly SoundEffectInstance[] HeldSounds = EnumHelper.GetValues().Select(h => MlemGame.LoadContent("Sounds/" + h).CreateInstance(isLooped: true)).ToArray(); public RectangleF Bounds => new(this.Position + new Vector2(4 / 16F, 0), new Vector2(9 / 16F, 1)); @@ -124,21 +127,29 @@ namespace GreatSpringGameJam { this.velocity.Y += 0.015F; // item usage + HeldItem? usingItem = null; var rot = this.GetHeldRotation(); var rotVec = new Vector2(MathF.Cos(rot), MathF.Sin(rot)); if (MlemGame.Input.IsDown(MouseButton.Left)) { - this.heldItem = HeldItem.SnowBlower; + usingItem = 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; + usingItem = 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)); } } + for (var i = 0; i < HeldSounds.Length; i++) { + if (usingItem == (HeldItem) i) { + HeldSounds[i].Play(); + } else { + HeldSounds[i].Pause(); + } + } this.animations.Update(time); } diff --git a/GreatSpringGameJam/WaterDrop.cs b/GreatSpringGameJam/WaterDrop.cs index 666e9a6..eb9bcf1 100644 --- a/GreatSpringGameJam/WaterDrop.cs +++ b/GreatSpringGameJam/WaterDrop.cs @@ -2,8 +2,10 @@ using System; using System.Collections.Generic; using Coroutine; using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Audio; using Microsoft.Xna.Framework.Graphics; using MLEM.Extended.Tiled; +using MLEM.Startup; using MLEM.Textures; using MonoGame.Extended; using RectangleF = MLEM.Misc.RectangleF; @@ -11,6 +13,7 @@ using RectangleF = MLEM.Misc.RectangleF; namespace GreatSpringGameJam { public class WaterDrop : Entity { + private static readonly SoundEffect PlantGrowSound = MlemGame.LoadContent("Sounds/PlantGrow"); private readonly bool growsPlants; private Vector2 velocity; private TimeSpan timeToLive; @@ -49,6 +52,7 @@ namespace GreatSpringGameJam { return; var grownTile = tileset.GetTilesetTile(grown); this.Map.SetTile("Ground", x, y, tileset, grownTile); + PlantGrowSound.Play(); // vines if (grownTile.Properties.GetBool("Vine")) { @@ -64,8 +68,10 @@ namespace GreatSpringGameJam { CoroutineHandler.Start(GrowVines()); } // forget me not - if (grownTile.Properties.GetBool("ForgetMeNot")) + if (grownTile.Properties.GetBool("ForgetMeNot")) { this.Map.ForgetMeNotTime = TimeSpan.FromSeconds(10); + Map.ForgetMeNotPlatformSound.Play(); + } } }