From 2a3a15742b465fad3372143a58272d9fdf6c2470 Mon Sep 17 00:00:00 2001 From: Rain Clark Date: Fri, 7 Oct 2016 06:00:22 -0400 Subject: [PATCH] Gel's clock can now pause/unpause :alarm_clock: --- source/Clock.hx | 17 +++++++++++++++-- source/Gel.hx | 4 ++-- 2 files changed, 17 insertions(+), 4 deletions(-) diff --git a/source/Clock.hx b/source/Clock.hx index f184feb..77d0124 100644 --- a/source/Clock.hx +++ b/source/Clock.hx @@ -3,13 +3,14 @@ package; import flixel.FlxG; import flixel.util.FlxTimer; -class Clock { +class Clock +{ private var _timer:FlxTimer; public var HourPassed: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(); // Every 3 real-time minutes 1 in-game hour passes @@ -36,4 +37,16 @@ class Clock { _timer.reset(); DayPassed = true; } + + public function pause(isPaused:Bool = true):Void + { + if (isPaused) + { + _timer.active = false; + } + else + { + _timer.active = true; + } + } } \ No newline at end of file diff --git a/source/Gel.hx b/source/Gel.hx index 7d51ba2..c7f51a2 100644 --- a/source/Gel.hx +++ b/source/Gel.hx @@ -10,7 +10,7 @@ class Gel extends FlxSprite private var MAX_LEVEL(default, never):Int = 100; // 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; // Mood Modifiers @@ -40,7 +40,7 @@ class Gel extends FlxSprite // Gels internal clock - private var _clock:Clock; + public var _clock:Clock; public function new(?X:Float=0, ?Y:Float=0) {