added a few sounds

This commit is contained in:
Ell 2021-03-17 22:57:20 +01:00
parent 7f4a55a372
commit 78aff1a518
18 changed files with 124 additions and 8 deletions

View file

@ -80,3 +80,28 @@
/processor:TiledMapProcessor /processor:TiledMapProcessor
/build:Maps/Level4.tmx /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

View file

@ -4,5 +4,10 @@
"bin/", "bin/",
"Palettes/", "Palettes/",
"Tilesets/*.png" "Tilesets/*.png"
] ],
"overrides": {
"Sounds/": {
"Processor": "SoundEffectProcessor"
}
}
} }

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View file

@ -0,0 +1,59 @@
<?xml version="1.0" standalone="no" ?>
<!DOCTYPE project PUBLIC "-//audacityproject-1.3.0//DTD//EN" "http://audacity.sourceforge.net/xml/audacityproject-1.3.0.dtd" >
<project xmlns="http://audacity.sourceforge.net/xml/" projname="Sounds_data" version="1.3.0" audacityversion="2.4.2" sel0="0.0000000000" sel1="0.0000000000" vpos="0" h="0.0000000000" zoom="37.2165538074" rate="44100.0" snapto="off" selectionformat="hh:mm:ss + milliseconds" frequencyformat="Hz" bandwidthformat="octaves">
<tags>
<tag name="ARTIST" value="Imphenzia"/>
<tag name="COMMENTS" value="www.universalsoundfx.com"/>
<tag name="Copyright" value="Imphenzia AB"/>
</tags>
<wavetrack name="ButtonPress" isSelected="0" height="150" minimized="0" channel="2" linked="0" mute="1" solo="0" rate="44100" gain="1.0" pan="0.0" colorindex="0">
<waveclip offset="0.00000000" colorindex="0">
<sequence maxsamples="262144" sampleformat="262159" numsamples="2137">
<waveblock start="0">
<simpleblockfile filename="e0808f8a.au" len="2137" min="-0.722725" max="1.0" rms="0.063428"/>
</waveblock>
</sequence>
<envelope numpoints="0"/>
</waveclip>
</wavetrack>
<wavetrack name="PlantGrow" isSelected="0" height="150" minimized="0" channel="2" linked="0" mute="1" solo="0" rate="44100" gain="1.0" pan="0.0" colorindex="0">
<waveclip offset="0.00000000" colorindex="0">
<sequence maxsamples="262144" sampleformat="262159" numsamples="47745">
<waveblock start="0">
<simpleblockfile filename="e08088fa.au" len="47745" min="-0.994931" max="1.0" rms="0.021839"/>
</waveblock>
</sequence>
<envelope numpoints="0"/>
</waveclip>
</wavetrack>
<wavetrack name="PlatformAppear" isSelected="0" height="150" minimized="0" channel="2" linked="0" mute="1" solo="0" rate="44100" gain="1.0" pan="0.0" colorindex="0">
<waveclip offset="0.00000000" colorindex="0">
<sequence maxsamples="262144" sampleformat="262159" numsamples="137624">
<waveblock start="0">
<simpleblockfile filename="e0808d8c.au" len="137624" min="-0.85468" max="1.0" rms="0.028974"/>
</waveblock>
</sequence>
<envelope numpoints="0"/>
</waveclip>
</wavetrack>
<wavetrack name="SnowBlower" isSelected="0" height="150" minimized="0" channel="2" linked="0" mute="1" solo="0" rate="44100" gain="1.0" pan="0.0" colorindex="0">
<waveclip offset="0.00000000" colorindex="0">
<sequence maxsamples="262144" sampleformat="262159" numsamples="137624">
<waveblock start="0">
<simpleblockfile filename="e08087a6.au" len="137624" min="-0.415495" max="0.460189" rms="0.107242"/>
</waveblock>
</sequence>
<envelope numpoints="0"/>
</waveclip>
</wavetrack>
<wavetrack name="WateringCan" isSelected="1" height="150" minimized="0" channel="2" linked="0" mute="0" solo="1" rate="44100" gain="1.0" pan="0.0" colorindex="0">
<waveclip offset="0.00000000" colorindex="0">
<sequence maxsamples="262144" sampleformat="262159" numsamples="137624">
<waveblock start="0">
<simpleblockfile filename="e0808a3d.au" len="137624" min="-0.90553" max="0.771975" rms="0.032794"/>
</waveblock>
</sequence>
<envelope numpoints="0"/>
</waveclip>
</wavetrack>
</project>

Binary file not shown.

View file

@ -6,6 +6,7 @@ using System.Linq;
using System.Reflection; using System.Reflection;
using Coroutine; using Coroutine;
using Microsoft.Xna.Framework; using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Audio;
using Microsoft.Xna.Framework.Content; using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.Graphics; using Microsoft.Xna.Framework.Graphics;
using MLEM.Cameras; using MLEM.Cameras;
@ -13,6 +14,7 @@ using MLEM.Extended.Extensions;
using MLEM.Extensions; using MLEM.Extensions;
using MLEM.Font; using MLEM.Font;
using MLEM.Formatting.Codes; using MLEM.Formatting.Codes;
using MLEM.Misc;
using MLEM.Startup; using MLEM.Startup;
using MLEM.Textures; using MLEM.Textures;
using MLEM.Ui; using MLEM.Ui;
@ -50,6 +52,7 @@ namespace GreatSpringGameJam {
this.UiSystem.Style.TextScale = 0.075F; this.UiSystem.Style.TextScale = 0.075F;
this.UiSystem.Style.TextColor = ColorHelper.FromHexRgb(0xebd5bd); 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.ButtonTexture = new NinePatch(this.SpriteBatch.GenerateSquareTexture(ColorHelper.FromHexRgb(0x594e6f) * 0.35F), 0);
this.UiSystem.Style.ActionSound = new SoundEffectInfo(LoadContent<SoundEffect>("Sounds/ButtonPress"));
this.UiSystem.AutoScaleWithScreen = true; this.UiSystem.AutoScaleWithScreen = true;
this.UiSystem.Controls.HandleKeyboard = false; this.UiSystem.Controls.HandleKeyboard = false;
this.UiSystem.Controls.HandleGamepad = false; this.UiSystem.Controls.HandleGamepad = false;

View file

@ -10,9 +10,9 @@
<ItemGroup> <ItemGroup>
<PackageReference Include="Contentless" Version="3.0.5" /> <PackageReference Include="Contentless" Version="3.0.5" />
<PackageReference Include="MLEM" Version="5.0.0-77" /> <PackageReference Include="MLEM" Version="5.0.0-82" />
<PackageReference Include="MLEM.Extended" Version="5.0.0-77" /> <PackageReference Include="MLEM.Extended" Version="5.0.0-82" />
<PackageReference Include="MLEM.Startup" Version="5.0.0-77" /> <PackageReference Include="MLEM.Startup" Version="5.0.0-82" />
<PackageReference Include="MonoGame.Content.Builder.Task" Version="3.8.0.1641" /> <PackageReference Include="MonoGame.Content.Builder.Task" Version="3.8.0.1641" />
<PackageReference Include="MonoGame.Extended.Content.Pipeline" Version="3.8.0" /> <PackageReference Include="MonoGame.Extended.Content.Pipeline" Version="3.8.0" />
<PackageReference Include="MonoGame.Extended.Tiled" Version="3.8.0" /> <PackageReference Include="MonoGame.Extended.Tiled" Version="3.8.0" />

View file

@ -2,6 +2,7 @@ using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using Microsoft.Xna.Framework; using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Audio;
using Microsoft.Xna.Framework.Graphics; using Microsoft.Xna.Framework.Graphics;
using MLEM.Cameras; using MLEM.Cameras;
using MLEM.Extended.Extensions; using MLEM.Extended.Extensions;
@ -19,7 +20,9 @@ using RectangleF = MLEM.Misc.RectangleF;
namespace GreatSpringGameJam { namespace GreatSpringGameJam {
public class Map { public class Map {
public static readonly SoundEffect ForgetMeNotPlatformSound = MlemGame.LoadContent<SoundEffect>("Sounds/PlatformAppear");
private static readonly UniformTextureAtlas BackgroundTexture = new(MlemGame.LoadContent<Texture2D>("Textures/Backgrounds"), 8, 8); private static readonly UniformTextureAtlas BackgroundTexture = new(MlemGame.LoadContent<Texture2D>("Textures/Backgrounds"), 8, 8);
public Point SizeInPixels => new(this.map.WidthInPixels, this.map.HeightInPixels); 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 SpawnPoint => new(this.map.Properties.GetInt("StartX"), this.map.Properties.GetInt("StartY"));
public Point Size => new(this.map.Width, this.map.Height); public Point Size => new(this.map.Width, this.map.Height);
@ -76,8 +79,12 @@ namespace GreatSpringGameJam {
this.renderer.UpdateAnimations(time); this.renderer.UpdateAnimations(time);
for (var i = this.entities.Count - 1; i >= 0; i--) for (var i = this.entities.Count - 1; i >= 0; i--)
this.entities[i].Update(time); 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; this.ForgetMeNotTime -= time.ElapsedGameTime;
}
} }
public TiledMapTile GetTile(string layer, int x, int y) { public TiledMapTile GetTile(string layer, int x, int y) {

View file

@ -2,6 +2,7 @@ using System;
using System.Linq; using System.Linq;
using Coroutine; using Coroutine;
using Microsoft.Xna.Framework; using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Audio;
using Microsoft.Xna.Framework.Graphics; using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input; using Microsoft.Xna.Framework.Input;
using MLEM.Animations; using MLEM.Animations;
@ -9,6 +10,7 @@ using MLEM.Extended.Extensions;
using MLEM.Extended.Tiled; using MLEM.Extended.Tiled;
using MLEM.Extensions; using MLEM.Extensions;
using MLEM.Input; using MLEM.Input;
using MLEM.Misc;
using MLEM.Startup; using MLEM.Startup;
using MLEM.Textures; using MLEM.Textures;
using MonoGame.Extended; using MonoGame.Extended;
@ -19,6 +21,7 @@ namespace GreatSpringGameJam {
public class Player : Entity { public class Player : Entity {
private static readonly UniformTextureAtlas PlayerTexture = new(MlemGame.LoadContent<Texture2D>("Textures/Player"), 4, 3); private static readonly UniformTextureAtlas PlayerTexture = new(MlemGame.LoadContent<Texture2D>("Textures/Player"), 4, 3);
private static readonly SoundEffectInstance[] HeldSounds = EnumHelper.GetValues<HeldItem>().Select(h => MlemGame.LoadContent<SoundEffect>("Sounds/" + h).CreateInstance(isLooped: true)).ToArray();
public RectangleF Bounds => new(this.Position + new Vector2(4 / 16F, 0), new Vector2(9 / 16F, 1)); 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; this.velocity.Y += 0.015F;
// item usage // item usage
HeldItem? usingItem = null;
var rot = this.GetHeldRotation(); var rot = this.GetHeldRotation();
var rotVec = new Vector2(MathF.Cos(rot), MathF.Sin(rot)); var rotVec = new Vector2(MathF.Cos(rot), MathF.Sin(rot));
if (MlemGame.Input.IsDown(MouseButton.Left)) { if (MlemGame.Input.IsDown(MouseButton.Left)) {
this.heldItem = HeldItem.SnowBlower; usingItem = this.heldItem = HeldItem.SnowBlower;
Random.NextUnitVector(out var vel); Random.NextUnitVector(out var vel);
vel = vel * 0.03F + rotVec * 0.13F; vel = vel * 0.03F + rotVec * 0.13F;
this.Map.AddEntity(new SnowBlowerWind(this.Map, this.Position + Vector2.One / 2 + rotVec * 0.75F, vel)); this.Map.AddEntity(new SnowBlowerWind(this.Map, this.Position + Vector2.One / 2 + rotVec * 0.75F, vel));
} else if (MlemGame.Input.IsDown(MouseButton.Right)) { } else if (MlemGame.Input.IsDown(MouseButton.Right)) {
this.heldItem = HeldItem.WateringCan; usingItem = this.heldItem = HeldItem.WateringCan;
if (Random.NextSingle() <= 0.45F) { if (Random.NextSingle() <= 0.45F) {
Random.NextUnitVector(out var vel); Random.NextUnitVector(out var vel);
vel = vel * 0.015F + rotVec * 0.03F; vel = vel * 0.015F + rotVec * 0.03F;
this.Map.AddEntity(new WaterDrop(this.Map, this.Position + Vector2.One / 2 + rotVec * 0.65F, vel)); 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); this.animations.Update(time);
} }

View file

@ -2,8 +2,10 @@ using System;
using System.Collections.Generic; using System.Collections.Generic;
using Coroutine; using Coroutine;
using Microsoft.Xna.Framework; using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Audio;
using Microsoft.Xna.Framework.Graphics; using Microsoft.Xna.Framework.Graphics;
using MLEM.Extended.Tiled; using MLEM.Extended.Tiled;
using MLEM.Startup;
using MLEM.Textures; using MLEM.Textures;
using MonoGame.Extended; using MonoGame.Extended;
using RectangleF = MLEM.Misc.RectangleF; using RectangleF = MLEM.Misc.RectangleF;
@ -11,6 +13,7 @@ using RectangleF = MLEM.Misc.RectangleF;
namespace GreatSpringGameJam { namespace GreatSpringGameJam {
public class WaterDrop : Entity { public class WaterDrop : Entity {
private static readonly SoundEffect PlantGrowSound = MlemGame.LoadContent<SoundEffect>("Sounds/PlantGrow");
private readonly bool growsPlants; private readonly bool growsPlants;
private Vector2 velocity; private Vector2 velocity;
private TimeSpan timeToLive; private TimeSpan timeToLive;
@ -49,6 +52,7 @@ namespace GreatSpringGameJam {
return; return;
var grownTile = tileset.GetTilesetTile(grown); var grownTile = tileset.GetTilesetTile(grown);
this.Map.SetTile("Ground", x, y, tileset, grownTile); this.Map.SetTile("Ground", x, y, tileset, grownTile);
PlantGrowSound.Play();
// vines // vines
if (grownTile.Properties.GetBool("Vine")) { if (grownTile.Properties.GetBool("Vine")) {
@ -64,8 +68,10 @@ namespace GreatSpringGameJam {
CoroutineHandler.Start(GrowVines()); CoroutineHandler.Start(GrowVines());
} }
// forget me not // forget me not
if (grownTile.Properties.GetBool("ForgetMeNot")) if (grownTile.Properties.GetBool("ForgetMeNot")) {
this.Map.ForgetMeNotTime = TimeSpan.FromSeconds(10); this.Map.ForgetMeNotTime = TimeSpan.FromSeconds(10);
Map.ForgetMeNotPlatformSound.Play();
}
} }
} }