diff --git a/assets/sounds/Thought.ogg b/assets/sounds/Thought.ogg new file mode 100644 index 0000000..2327926 Binary files /dev/null and b/assets/sounds/Thought.ogg differ diff --git a/source/HUD.hx b/source/HUD.hx index 6dad727..8c3245c 100644 --- a/source/HUD.hx +++ b/source/HUD.hx @@ -45,6 +45,7 @@ class HUD extends FlxTypedGroup // Sounds private var _sndSelect:FlxSound; private var _sndNext:FlxSound; + private var _sndThought:FlxSound; // Time Display private var _txtTime:FlxText; @@ -135,6 +136,8 @@ class HUD extends FlxTypedGroup // Sound _sndSelect = FlxG.sound.load(AssetPaths.Select__ogg); _sndNext = FlxG.sound.load(AssetPaths.Next__ogg); + _sndThought = FlxG.sound.load(AssetPaths.Thought__ogg); + // Menu Selecter _sprSelect = new FlxSprite(0, 0, AssetPaths.tmpSelect__png); @@ -209,17 +212,17 @@ class HUD extends FlxTypedGroup // Need Bubble if (_gel.CurrentNeed == Gel.Need.NONE) - _sprThoughts.animation.play("none", false); + showThought("none"); else if (_gel.CurrentNeed == Gel.Need.HUNGRY) - _sprThoughts.animation.play("hungry", false); + showThought("hungry"); else if (_gel.CurrentNeed == Gel.Need.POOPY) { // The odds of the Gel willing to communicate its about to make Waste if (FlxG.random.bool((((_gel.Discipline * 3) + _gel.Intellect)) / 4)) - _sprThoughts.animation.play("poopy", false); + showThought("poopy"); } else if (_gel.CurrentNeed == Gel.Need.SLEEPY) - _sprThoughts.animation.play("sleepy", false); + showThought("sleepy"); // Update time display _txtTime.text = Std.string(_clock.CurrentHour) + ":00"; @@ -382,6 +385,18 @@ class HUD extends FlxTypedGroup // TODO: Make Config menu and call it here } + private function showThought(thought:String):Void + { + if (_sprThoughts.animation.name == thought) + return; + else + { + _sprThoughts.animation.play(thought, false); + if (thought != "none") + _sndThought.play(true); + } + } + private function itemJoin(animation:String):Void { _sprInteraction.visible = true;