2016-10-03 20:43:09 -04:00
|
|
|
package;
|
|
|
|
|
2016-10-08 01:13:57 -04:00
|
|
|
import Gel;
|
|
|
|
import Gel;
|
2016-10-03 20:43:09 -04:00
|
|
|
import flixel.FlxG;
|
|
|
|
import flixel.FlxSprite;
|
|
|
|
import flixel.group.FlxGroup;
|
|
|
|
import flixel.system.FlxSound;
|
|
|
|
import flixel.text.FlxText;
|
|
|
|
import flixel.util.FlxColor;
|
2016-10-11 00:26:52 -04:00
|
|
|
import flixel.util.FlxSave;
|
|
|
|
import haxe.xml.Parser;
|
2016-10-08 01:13:57 -04:00
|
|
|
|
2016-10-04 04:08:00 -04:00
|
|
|
using flixel.util.FlxSpriteUtil;
|
2016-10-03 20:43:09 -04:00
|
|
|
|
2016-10-05 03:02:06 -04:00
|
|
|
|
|
|
|
// TODO: Make sure the HUD is just displaying & triggering Gel stuff
|
2016-10-07 06:01:39 -04:00
|
|
|
// TODO: Save system that saves every menu choice
|
2016-10-03 20:43:09 -04:00
|
|
|
class HUD extends FlxTypedGroup<FlxSprite>
|
|
|
|
{
|
|
|
|
// Top
|
|
|
|
private var _sprTop:FlxSprite;
|
|
|
|
private var _txtInfo:FlxText;
|
|
|
|
private var _sprInfo:FlxSprite;
|
|
|
|
private var _txtFeed:FlxText;
|
|
|
|
private var _sprFeed:FlxSprite;
|
2016-10-04 04:08:00 -04:00
|
|
|
private var _txtStudy:FlxText;
|
|
|
|
private var _sprStudy:FlxSprite;
|
2016-10-03 20:43:09 -04:00
|
|
|
private var _txtRest:FlxText;
|
|
|
|
private var _sprRest:FlxSprite;
|
|
|
|
|
|
|
|
// Bottom
|
|
|
|
private var _sprBottom:FlxSprite;
|
|
|
|
private var _txtCheer:FlxText;
|
|
|
|
private var _sprCheer:FlxSprite;
|
|
|
|
private var _txtScold:FlxText;
|
|
|
|
private var _sprScold:FlxSprite;
|
|
|
|
private var _txtWipe:FlxText;
|
|
|
|
private var _sprWipe:FlxSprite;
|
|
|
|
private var _txtConfig:FlxText;
|
|
|
|
private var _sprConfig:FlxSprite;
|
|
|
|
|
2016-10-04 02:12:54 -04:00
|
|
|
// Gel Boxes
|
2016-10-05 03:02:06 -04:00
|
|
|
private var _sprThoughts:FlxSprite;
|
2016-10-04 02:12:54 -04:00
|
|
|
private var _sprInteraction:FlxSprite;
|
|
|
|
|
2016-10-03 20:43:09 -04:00
|
|
|
// Sounds
|
|
|
|
private var _sndSelect:FlxSound;
|
|
|
|
private var _sndNext:FlxSound;
|
2016-10-09 05:30:10 -04:00
|
|
|
private var _sndThought:FlxSound;
|
2016-10-03 20:43:09 -04:00
|
|
|
|
2016-10-08 01:13:57 -04:00
|
|
|
// Time Display
|
|
|
|
private var _txtTime:FlxText;
|
|
|
|
|
2016-10-07 06:01:39 -04:00
|
|
|
// Menus
|
|
|
|
private var _infoMenu:InfoMenu;
|
2016-10-11 00:26:52 -04:00
|
|
|
private var _configMenu:ConfigMenu;
|
2016-10-07 06:01:39 -04:00
|
|
|
|
2016-10-03 20:43:09 -04:00
|
|
|
// Misc
|
|
|
|
private var _menuOption:Int;
|
|
|
|
private var _sprSelect:FlxSprite;
|
|
|
|
private var _gel:Gel;
|
2016-10-08 01:13:57 -04:00
|
|
|
private var _clock:Clock;
|
2016-10-11 00:26:52 -04:00
|
|
|
private var _usingArrows:Bool = true;
|
2016-10-03 20:43:09 -04:00
|
|
|
|
2016-10-11 00:26:52 -04:00
|
|
|
public function new(gel:Gel, clock:Clock, infoMenu:InfoMenu, configMenu:ConfigMenu)
|
2016-10-03 20:43:09 -04:00
|
|
|
{
|
|
|
|
super();
|
|
|
|
|
2016-10-11 00:26:52 -04:00
|
|
|
loadSettings();
|
|
|
|
|
2016-10-04 02:12:54 -04:00
|
|
|
// Misc
|
|
|
|
_menuOption = 0;
|
2016-10-07 06:01:39 -04:00
|
|
|
_gel = gel;
|
2016-10-08 01:13:57 -04:00
|
|
|
_clock = clock;
|
2016-10-07 06:01:39 -04:00
|
|
|
_infoMenu = infoMenu;
|
2016-10-11 00:26:52 -04:00
|
|
|
_configMenu = configMenu;
|
|
|
|
|
|
|
|
|
2016-10-04 02:12:54 -04:00
|
|
|
|
2016-10-03 20:43:09 -04:00
|
|
|
// Top
|
|
|
|
_sprTop = new FlxSprite(0, 0, AssetPaths.HUD_Background__png);
|
|
|
|
add(_sprTop);
|
|
|
|
|
|
|
|
// Info
|
|
|
|
_txtInfo = new FlxText(1, (_sprTop.height - 13), 0, "Info", 8);
|
|
|
|
_txtInfo.setFormat(AssetPaths.EarlyGameBoy__ttf, 8, FlxColor.fromRGB(8, 24, 32, 0), CENTER);
|
|
|
|
add(_txtInfo);
|
|
|
|
_sprInfo = new FlxSprite((_txtInfo.x + 3), (_txtInfo.y - 17), AssetPaths.Info__png);
|
|
|
|
add(_sprInfo);
|
|
|
|
|
|
|
|
// Feed
|
|
|
|
_txtFeed = new FlxText((_txtInfo.x + _txtInfo.width + 4), (_sprTop.height - 13), 0, "Feed", 8);
|
|
|
|
_txtFeed.setFormat(AssetPaths.EarlyGameBoy__ttf, 8 , FlxColor.fromRGB(8, 24, 32, 0), CENTER);
|
|
|
|
add(_txtFeed);
|
|
|
|
_sprFeed = new FlxSprite((_txtFeed.x + 2), (_txtFeed.y - 17), AssetPaths.Feed__png);
|
|
|
|
add(_sprFeed);
|
|
|
|
|
2016-10-04 04:08:00 -04:00
|
|
|
// Study
|
|
|
|
_txtStudy = new FlxText((_txtFeed.x + _txtFeed.width - 1), (_sprTop.height - 13), 0, "Study", 8);
|
|
|
|
_txtStudy.setFormat(AssetPaths.EarlyGameBoy__ttf, 8, FlxColor.fromRGB(8, 24, 32, 0), CENTER);
|
|
|
|
add(_txtStudy);
|
|
|
|
_sprStudy = new FlxSprite((_txtStudy.x + 6), (_txtStudy.y - 17), AssetPaths.Study__png);
|
|
|
|
add(_sprStudy);
|
2016-10-03 20:43:09 -04:00
|
|
|
|
|
|
|
// Rest
|
2016-10-04 04:08:00 -04:00
|
|
|
_txtRest = new FlxText((_txtStudy.x + _txtStudy.width), (_sprTop.height - 13), 0, "Rest", 8);
|
2016-10-03 20:43:09 -04:00
|
|
|
_txtRest.setFormat(AssetPaths.EarlyGameBoy__ttf, 8, FlxColor.fromRGB(8, 24, 32, 0), CENTER);
|
|
|
|
add(_txtRest);
|
|
|
|
_sprRest = new FlxSprite((_txtRest.x + 2), (_txtRest.y - 17), AssetPaths.Rest__png);
|
|
|
|
add(_sprRest);
|
|
|
|
|
|
|
|
// Bottom
|
|
|
|
_sprBottom = new FlxSprite(0, (FlxG.height - _sprTop.height), AssetPaths.HUD_Background__png);
|
|
|
|
add(_sprBottom);
|
|
|
|
|
|
|
|
// Cheer
|
|
|
|
_txtCheer = new FlxText(-2, (FlxG.height - 13), 0, "Cheer", 8);
|
|
|
|
_txtCheer.setFormat(AssetPaths.EarlyGameBoy__ttf, 8, FlxColor.fromRGB(8, 24, 32, 0), CENTER);
|
|
|
|
add(_txtCheer);
|
|
|
|
_sprCheer = new FlxSprite((_txtCheer.x + 6), (_txtCheer.y - 17), AssetPaths.Cheer__png);
|
|
|
|
add (_sprCheer);
|
|
|
|
|
|
|
|
// Scold
|
|
|
|
_txtScold = new FlxText((_txtCheer.x + _txtCheer.width - 5), (FlxG.height - 13), 0, "Scold", 8);
|
|
|
|
_txtScold.setFormat(AssetPaths.EarlyGameBoy__ttf, 8, FlxColor.fromRGB(8, 24, 32, 0), CENTER);
|
|
|
|
add(_txtScold);
|
|
|
|
_sprScold = new FlxSprite((_txtScold.x + 6), (_txtScold.y - 17), AssetPaths.Scold__png);
|
|
|
|
add(_sprScold);
|
|
|
|
|
|
|
|
// Wipe
|
|
|
|
_txtWipe = new FlxText((_txtScold.x + _txtScold.width - 1), (FlxG.height - 13), 0, "Wipe", 8);
|
|
|
|
_txtWipe.setFormat(AssetPaths.EarlyGameBoy__ttf, 8, FlxColor.fromRGB(8, 24, 32, 0), CENTER);
|
|
|
|
add(_txtWipe);
|
|
|
|
_sprWipe = new FlxSprite((_txtWipe.x + 2), (_txtWipe.y - 17), AssetPaths.Wipe__png);
|
|
|
|
add(_sprWipe);
|
|
|
|
|
|
|
|
// Config
|
|
|
|
_txtConfig = new FlxText((_txtWipe.x + _txtWipe.width + 3), (FlxG.height - 13), 0, "Conf", 8);
|
|
|
|
_txtConfig.setFormat(AssetPaths.EarlyGameBoy__ttf, 8, FlxColor.fromRGB(8, 24, 32, 0), CENTER);
|
|
|
|
add(_txtConfig);
|
|
|
|
_sprConfig = new FlxSprite((_txtConfig.x + 2), (_txtConfig.y - 17), AssetPaths.Config__png);
|
|
|
|
add(_sprConfig);
|
|
|
|
|
|
|
|
// Sound
|
|
|
|
_sndSelect = FlxG.sound.load(AssetPaths.Select__ogg);
|
|
|
|
_sndNext = FlxG.sound.load(AssetPaths.Next__ogg);
|
2016-10-09 05:30:10 -04:00
|
|
|
_sndThought = FlxG.sound.load(AssetPaths.Thought__ogg);
|
|
|
|
|
2016-10-03 20:43:09 -04:00
|
|
|
|
2016-10-04 02:12:54 -04:00
|
|
|
// Menu Selecter
|
2016-10-03 20:43:09 -04:00
|
|
|
_sprSelect = new FlxSprite(0, 0, AssetPaths.tmpSelect__png);
|
|
|
|
add(_sprSelect);
|
|
|
|
|
2016-10-08 01:13:57 -04:00
|
|
|
// Interact Box
|
|
|
|
_sprInteraction = new FlxSprite(111, 78);
|
|
|
|
_sprInteraction.loadGraphic(AssetPaths.Interact__png, true, 24, 24);
|
|
|
|
_sprInteraction.animation.add ("none", [4], 1, true);
|
|
|
|
_sprInteraction.animation.add ("waste", [0], 1, true);
|
|
|
|
_sprInteraction.animation.add ("food", [1], 1, true);
|
|
|
|
_sprInteraction.animation.add ("wipe", [2], 1, true);
|
|
|
|
_sprInteraction.animation.add ("book", [3], 1, true);
|
2016-10-04 02:12:54 -04:00
|
|
|
_sprInteraction.visible = false;
|
|
|
|
add(_sprInteraction);
|
|
|
|
|
2016-10-05 03:02:06 -04:00
|
|
|
// Thought Box
|
|
|
|
_sprThoughts = new FlxSprite(26, 51);
|
|
|
|
_sprThoughts.loadGraphic(AssetPaths.Thoughts__png, true, 24, 24);
|
|
|
|
_sprThoughts.animation.add("none", [4], 1, false);
|
|
|
|
_sprThoughts.animation.add("hungry", [0, 1, 2, 3, 4], 3, true);
|
|
|
|
_sprThoughts.animation.add("poopy", [5, 6, 7, 8, 9], 3, true);
|
|
|
|
_sprThoughts.animation.add("sleepy", [10, 11, 12, 13, 14], 4, true);
|
|
|
|
add(_sprThoughts);
|
|
|
|
|
2016-10-08 01:13:57 -04:00
|
|
|
// Game Time
|
|
|
|
_txtTime = new FlxText(_sprTop.x, (_sprTop.height), 0, Std.string(_clock.CurrentHour) + ":00");
|
|
|
|
_txtTime.setFormat(AssetPaths.EarlyGameBoy__ttf, 8, FlxColor.fromRGB(8, 24, 32, 0), CENTER);
|
|
|
|
add(_txtTime);
|
2016-10-04 02:12:54 -04:00
|
|
|
|
2016-10-03 20:43:09 -04:00
|
|
|
// DEBUG
|
2016-10-07 06:01:39 -04:00
|
|
|
FlxG.watch.add(_infoMenu, "exists", "Info Menu Open");
|
2016-10-03 20:43:09 -04:00
|
|
|
FlxG.watch.add(this, "_menuOption", "Menu Index");
|
2016-10-04 04:08:00 -04:00
|
|
|
FlxG.watch.add(_sprInteraction, "alpha", "Interact Alpha");
|
|
|
|
FlxG.watch.add(_sprInteraction, "visible", "Interact Visible");
|
2016-10-08 01:13:57 -04:00
|
|
|
FlxG.watch.add(_sprInteraction.animation, "name", "Interaction");
|
2016-10-03 20:43:09 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
override public function update(elapsed:Float):Void
|
|
|
|
{
|
|
|
|
super.update(elapsed);
|
2016-10-11 00:26:52 -04:00
|
|
|
loadSettings();
|
2016-10-05 08:01:07 -04:00
|
|
|
|
2016-10-11 00:26:52 -04:00
|
|
|
if (_gel.ENDGAME)
|
|
|
|
{
|
|
|
|
FlxG.camera.fade(FlxColor.fromRGB(8, 24, 32, 0), 0.5, true, function()
|
|
|
|
{
|
|
|
|
FlxG.switchState(new EndState());
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (_usingArrows)
|
|
|
|
{
|
|
|
|
if (FlxG.keys.justPressed.UP || FlxG.gamepads.anyJustPressed(DPAD_UP))
|
|
|
|
nextOption(UP);
|
|
|
|
else if (FlxG.keys.justPressed.DOWN || FlxG.gamepads.anyJustPressed(DPAD_DOWN))
|
|
|
|
nextOption(DOWN);
|
|
|
|
else if (FlxG.keys.justPressed.LEFT || FlxG.gamepads.anyJustPressed(DPAD_LEFT))
|
|
|
|
nextOption(LEFT);
|
|
|
|
else if (FlxG.keys.justPressed.RIGHT || FlxG.gamepads.anyJustPressed(DPAD_RIGHT))
|
|
|
|
nextOption(RIGHT);
|
|
|
|
else if (FlxG.keys.justPressed.X || FlxG.gamepads.anyJustPressed(B))
|
|
|
|
makeOption(_menuOption);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (FlxG.keys.justPressed.W || FlxG.gamepads.anyJustPressed(DPAD_UP))
|
|
|
|
nextOption(UP);
|
|
|
|
else if (FlxG.keys.justPressed.S || FlxG.gamepads.anyJustPressed(DPAD_DOWN))
|
|
|
|
nextOption(DOWN);
|
|
|
|
else if (FlxG.keys.justPressed.A || FlxG.gamepads.anyJustPressed(DPAD_LEFT))
|
|
|
|
nextOption(LEFT);
|
|
|
|
else if (FlxG.keys.justPressed.D || FlxG.gamepads.anyJustPressed(DPAD_RIGHT))
|
|
|
|
nextOption(RIGHT);
|
|
|
|
else if (FlxG.keys.justPressed.X || FlxG.gamepads.anyJustPressed(B))
|
|
|
|
makeOption(_menuOption);
|
|
|
|
}
|
2016-10-05 03:02:06 -04:00
|
|
|
|
2016-10-08 01:13:57 -04:00
|
|
|
// Wasting Check
|
|
|
|
if (_gel._madeWaste == true)
|
|
|
|
{
|
|
|
|
_sprInteraction.visible = true;
|
|
|
|
_sprInteraction.animation.play("waste", true);
|
|
|
|
}
|
|
|
|
|
2016-10-07 00:59:34 -04:00
|
|
|
// Gel Animation
|
2016-10-05 03:02:06 -04:00
|
|
|
if (_gel.CurrentMood == Gel.Mood.NEUTRAL)
|
|
|
|
_gel.animation.play("neutral", false);
|
|
|
|
else if(_gel.CurrentMood == Gel.Mood.HAPPY)
|
|
|
|
_gel.animation.play("happy", false);
|
|
|
|
else if (_gel.CurrentMood == Gel.Mood.ANGRY)
|
|
|
|
_gel.animation.play("angry", false);
|
2016-10-06 01:18:02 -04:00
|
|
|
else if (_gel.CurrentMood == Gel.Mood.SLEEPING)
|
|
|
|
_gel.animation.play("sleeping", false);
|
2016-10-05 03:02:06 -04:00
|
|
|
|
2016-10-07 00:59:34 -04:00
|
|
|
// Need Bubble
|
2016-10-05 03:02:06 -04:00
|
|
|
if (_gel.CurrentNeed == Gel.Need.NONE)
|
2016-10-09 05:30:10 -04:00
|
|
|
showThought("none");
|
2016-10-05 03:02:06 -04:00
|
|
|
else if (_gel.CurrentNeed == Gel.Need.HUNGRY)
|
2016-10-09 05:30:10 -04:00
|
|
|
showThought("hungry");
|
2016-10-05 03:02:06 -04:00
|
|
|
else if (_gel.CurrentNeed == Gel.Need.POOPY)
|
2016-10-08 01:13:57 -04:00
|
|
|
{
|
|
|
|
// The odds of the Gel willing to communicate its about to make Waste
|
|
|
|
if (FlxG.random.bool((((_gel.Discipline * 3) + _gel.Intellect)) / 4))
|
2016-10-09 05:30:10 -04:00
|
|
|
showThought("poopy");
|
2016-10-08 01:13:57 -04:00
|
|
|
}
|
2016-10-05 03:02:06 -04:00
|
|
|
else if (_gel.CurrentNeed == Gel.Need.SLEEPY)
|
2016-10-09 05:30:10 -04:00
|
|
|
showThought("sleepy");
|
2016-10-08 01:13:57 -04:00
|
|
|
|
|
|
|
// Update time display
|
|
|
|
_txtTime.text = Std.string(_clock.CurrentHour) + ":00";
|
2016-10-03 20:43:09 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2016-10-07 07:19:05 -04:00
|
|
|
private function nextOption(direction:MenuDirection):Void
|
2016-10-03 20:43:09 -04:00
|
|
|
{
|
2016-10-07 07:19:05 -04:00
|
|
|
// TODO: Fix double tap in same vert direction
|
|
|
|
switch (direction)
|
2016-10-03 20:43:09 -04:00
|
|
|
{
|
2016-10-07 07:19:05 -04:00
|
|
|
case UP:
|
|
|
|
_menuOption -= 4;
|
|
|
|
if (_menuOption < 0)
|
|
|
|
_menuOption = 0;
|
2016-10-03 20:43:09 -04:00
|
|
|
_sprSelect.x = _menuOption * 40;
|
|
|
|
_sprSelect.y = 0;
|
|
|
|
|
2016-10-07 07:19:05 -04:00
|
|
|
case DOWN:
|
|
|
|
_menuOption += 4;
|
|
|
|
if (_menuOption > 7)
|
|
|
|
_menuOption = 7;
|
2016-10-03 20:43:09 -04:00
|
|
|
_sprSelect.x = (_menuOption - 4) * 40;
|
|
|
|
_sprSelect.y = _sprBottom.y;
|
|
|
|
|
2016-10-07 07:19:05 -04:00
|
|
|
case LEFT:
|
|
|
|
if (_menuOption <= 0)
|
|
|
|
_menuOption = 7;
|
|
|
|
else
|
|
|
|
_menuOption--;
|
|
|
|
|
|
|
|
if (_menuOption >= 4)
|
|
|
|
{
|
|
|
|
_sprSelect.x = (_menuOption - 4) * 40;
|
|
|
|
_sprSelect.y = _sprBottom.y;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
_sprSelect.x = _menuOption * 40;
|
|
|
|
_sprSelect.y = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
case RIGHT:
|
|
|
|
if (_menuOption >= 7)
|
|
|
|
_menuOption = 0;
|
|
|
|
else
|
|
|
|
_menuOption++;
|
|
|
|
|
|
|
|
if (_menuOption >= 4)
|
|
|
|
{
|
|
|
|
_sprSelect.x = (_menuOption - 4) * 40;
|
|
|
|
_sprSelect.y = _sprBottom.y;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
_sprSelect.x = _menuOption * 40;
|
|
|
|
_sprSelect.y = 0;
|
|
|
|
}
|
2016-10-11 00:26:52 -04:00
|
|
|
}
|
|
|
|
_sndNext.play(true);
|
2016-10-03 20:43:09 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
private function makeOption(option:Int):Void
|
|
|
|
{
|
2016-10-04 04:08:00 -04:00
|
|
|
if(!_gel.Wait)
|
2016-10-03 20:43:09 -04:00
|
|
|
{
|
2016-10-04 04:08:00 -04:00
|
|
|
switch(option)
|
|
|
|
{
|
2016-10-04 07:11:27 -04:00
|
|
|
// INFO
|
2016-10-04 04:08:00 -04:00
|
|
|
case 0:
|
2016-10-07 06:01:39 -04:00
|
|
|
showInfo();
|
2016-10-03 20:43:09 -04:00
|
|
|
|
2016-10-04 04:08:00 -04:00
|
|
|
// FEED
|
|
|
|
case 1:
|
2016-10-06 01:18:02 -04:00
|
|
|
if (!_gel._isAsleep)
|
|
|
|
feedGel();
|
2016-10-03 20:43:09 -04:00
|
|
|
|
2016-10-06 01:18:02 -04:00
|
|
|
// Study
|
2016-10-04 04:08:00 -04:00
|
|
|
case 2:
|
2016-10-06 01:18:02 -04:00
|
|
|
if (!_gel._isAsleep)
|
|
|
|
studyGel();
|
2016-10-03 20:43:09 -04:00
|
|
|
|
2016-10-04 07:11:27 -04:00
|
|
|
// REST
|
2016-10-04 04:08:00 -04:00
|
|
|
case 3:
|
2016-10-06 01:18:02 -04:00
|
|
|
if (!_gel._isAsleep)
|
|
|
|
sleepGel();
|
2016-10-03 20:43:09 -04:00
|
|
|
|
2016-10-04 07:11:27 -04:00
|
|
|
// CHEER
|
2016-10-04 04:08:00 -04:00
|
|
|
case 4:
|
2016-10-06 01:18:02 -04:00
|
|
|
if (!_gel._isAsleep)
|
|
|
|
praiseGel();
|
2016-10-03 20:43:09 -04:00
|
|
|
|
2016-10-04 07:11:27 -04:00
|
|
|
// SCOLD
|
2016-10-04 04:08:00 -04:00
|
|
|
case 5:
|
2016-10-06 01:18:02 -04:00
|
|
|
if (!_gel._isAsleep)
|
|
|
|
scoldGel();
|
2016-10-03 20:43:09 -04:00
|
|
|
|
2016-10-04 07:11:27 -04:00
|
|
|
// WIPE
|
2016-10-04 04:08:00 -04:00
|
|
|
case 6:
|
2016-10-06 01:18:02 -04:00
|
|
|
if (!_gel._isAsleep)
|
|
|
|
wipeGel();
|
2016-10-03 20:43:09 -04:00
|
|
|
|
2016-10-04 07:11:27 -04:00
|
|
|
// CONFIG
|
2016-10-04 04:08:00 -04:00
|
|
|
case 7:
|
2016-10-07 06:01:39 -04:00
|
|
|
showConfig();
|
2016-10-04 04:08:00 -04:00
|
|
|
}
|
|
|
|
_sndSelect.play(true);
|
2016-10-03 20:43:09 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-10-07 06:01:39 -04:00
|
|
|
private function showInfo():Void
|
|
|
|
{
|
|
|
|
_infoMenu.OpenMenu();
|
|
|
|
}
|
|
|
|
|
2016-10-03 20:43:09 -04:00
|
|
|
private function feedGel():Void
|
|
|
|
{
|
2016-10-08 01:13:57 -04:00
|
|
|
itemJoin("food");
|
2016-10-03 20:43:09 -04:00
|
|
|
_gel.EatFood();
|
2016-10-04 04:08:00 -04:00
|
|
|
_sprInteraction.fadeOut(2, itemLeave);
|
|
|
|
}
|
|
|
|
|
2016-10-05 23:36:42 -04:00
|
|
|
private function studyGel():Void
|
|
|
|
{
|
2016-10-08 01:13:57 -04:00
|
|
|
itemJoin("book");
|
2016-10-05 23:36:42 -04:00
|
|
|
_gel.Study();
|
|
|
|
_sprInteraction.fadeOut(2, itemLeave);
|
|
|
|
}
|
|
|
|
|
|
|
|
private function sleepGel():Void
|
|
|
|
{
|
2016-10-08 01:13:57 -04:00
|
|
|
itemJoin("none");
|
2016-10-05 23:36:42 -04:00
|
|
|
_gel.Sleep();
|
|
|
|
_sprInteraction.fadeOut(2, itemLeave);
|
|
|
|
}
|
|
|
|
|
2016-10-04 07:11:27 -04:00
|
|
|
private function praiseGel():Void
|
|
|
|
{
|
2016-10-08 01:13:57 -04:00
|
|
|
itemJoin("none");
|
2016-10-04 07:11:27 -04:00
|
|
|
_gel.Praise();
|
|
|
|
_sprInteraction.fadeOut(2, itemLeave);
|
|
|
|
}
|
|
|
|
|
|
|
|
private function scoldGel():Void
|
|
|
|
{
|
2016-10-08 01:13:57 -04:00
|
|
|
itemJoin("none");
|
2016-10-04 07:11:27 -04:00
|
|
|
_gel.Scold();
|
|
|
|
_sprInteraction.fadeOut(2, itemLeave);
|
|
|
|
}
|
|
|
|
|
2016-10-05 07:24:24 -04:00
|
|
|
private function wipeGel():Void
|
|
|
|
{
|
2016-10-08 01:13:57 -04:00
|
|
|
itemJoin("wipe");
|
2016-10-05 07:24:24 -04:00
|
|
|
_gel.Wipe();
|
|
|
|
_sprInteraction.fadeOut(2, itemLeave);
|
|
|
|
}
|
|
|
|
|
2016-10-07 06:01:39 -04:00
|
|
|
private function showConfig():Void
|
|
|
|
{
|
2016-10-11 00:26:52 -04:00
|
|
|
_configMenu.OpenMenu();
|
2016-10-07 06:01:39 -04:00
|
|
|
}
|
|
|
|
|
2016-10-09 05:30:10 -04:00
|
|
|
private function showThought(thought:String):Void
|
|
|
|
{
|
|
|
|
if (_sprThoughts.animation.name == thought)
|
|
|
|
return;
|
|
|
|
else
|
|
|
|
{
|
|
|
|
_sprThoughts.animation.play(thought, false);
|
|
|
|
if (thought != "none")
|
|
|
|
_sndThought.play(true);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-10-08 01:13:57 -04:00
|
|
|
private function itemJoin(animation:String):Void
|
2016-10-04 04:08:00 -04:00
|
|
|
{
|
|
|
|
_sprInteraction.visible = true;
|
2016-10-08 01:13:57 -04:00
|
|
|
_sprInteraction.animation.play(animation);
|
2016-10-04 04:08:00 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
private function itemLeave(_):Void
|
|
|
|
{
|
|
|
|
_sprInteraction.visible = false;
|
|
|
|
_sprInteraction.alpha = 1;
|
2016-10-08 01:13:57 -04:00
|
|
|
_sprInteraction.animation.play("none");
|
2016-10-04 04:08:00 -04:00
|
|
|
_gel.Wait = false;
|
2016-10-03 20:43:09 -04:00
|
|
|
}
|
2016-10-11 00:26:52 -04:00
|
|
|
|
|
|
|
private function loadSettings():Void
|
|
|
|
{
|
|
|
|
var _save = new FlxSave();
|
|
|
|
_save.bind("Pet.GB");
|
|
|
|
|
|
|
|
_usingArrows = _save.data.arrowInput;
|
|
|
|
FlxG.sound.muted = _save.data.muted;
|
|
|
|
|
|
|
|
_save.close();
|
|
|
|
}
|
|
|
|
|
2016-10-07 07:19:05 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
private enum MenuDirection
|
|
|
|
{
|
|
|
|
UP;
|
|
|
|
DOWN;
|
|
|
|
LEFT;
|
|
|
|
RIGHT;
|
2016-10-03 20:43:09 -04:00
|
|
|
}
|