1
0
mirror of https://github.com/Melon-Bread/Pet.GB synced 2024-11-24 20:58:19 -05:00

Gel's clock can now pause/unpause

This commit is contained in:
Rain Clark 2016-10-07 06:00:22 -04:00
parent bef19795ca
commit 2a3a15742b
2 changed files with 17 additions and 4 deletions

View File

@ -3,13 +3,14 @@ package;
import flixel.FlxG; import flixel.FlxG;
import flixel.util.FlxTimer; import flixel.util.FlxTimer;
class Clock { class Clock
{
private var _timer:FlxTimer; private var _timer:FlxTimer;
public var HourPassed:Bool = false; public var HourPassed:Bool = false;
public var DayPassed:Bool = false; public var DayPassed:Bool = false;
public function new(RtG:Int = 20):Void //120 public function new(RtG:Int = 20) //120
{ {
_timer = new FlxTimer(); _timer = new FlxTimer();
// Every 3 real-time minutes 1 in-game hour passes // Every 3 real-time minutes 1 in-game hour passes
@ -36,4 +37,16 @@ class Clock {
_timer.reset(); _timer.reset();
DayPassed = true; DayPassed = true;
} }
public function pause(isPaused:Bool = true):Void
{
if (isPaused)
{
_timer.active = false;
}
else
{
_timer.active = true;
}
}
} }

View File

@ -10,7 +10,7 @@ class Gel extends FlxSprite
private var MAX_LEVEL(default, never):Int = 100; private var MAX_LEVEL(default, never):Int = 100;
// Usless Stats that have no pupose yet // Usless Stats that have no pupose yet
public var Intellect:Int = 1; // had to be somewhat smart to get out of the egg public var Intellect:Int = 1; // Had to be somewhat smart to get out of the egg
public var Age:Int = 1; public var Age:Int = 1;
// Mood Modifiers // Mood Modifiers
@ -40,7 +40,7 @@ class Gel extends FlxSprite
// Gels internal clock // Gels internal clock
private var _clock:Clock; public var _clock:Clock;
public function new(?X:Float=0, ?Y:Float=0) public function new(?X:Float=0, ?Y:Float=0)
{ {