From ee2229339429d50afa33e2f8b9c0ee0939766290 Mon Sep 17 00:00:00 2001 From: sowgro Date: Mon, 8 Jul 2024 02:41:31 -0400 Subject: Change project structure, embed resources into jar and remove libraries from source control --- .../java/net/sowgro/npehero/gameplay/Timer.java | 28 ++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100755 src/main/java/net/sowgro/npehero/gameplay/Timer.java (limited to 'src/main/java/net/sowgro/npehero/gameplay/Timer.java') diff --git a/src/main/java/net/sowgro/npehero/gameplay/Timer.java b/src/main/java/net/sowgro/npehero/gameplay/Timer.java new file mode 100755 index 0000000..eada237 --- /dev/null +++ b/src/main/java/net/sowgro/npehero/gameplay/Timer.java @@ -0,0 +1,28 @@ +/*Name: Guitar Hero Project + *Description: Contains the method used to determine how long the user has been playing, + * used to determine when to send notes + */ +package net.sowgro.npehero.gameplay; + + +public class Timer +{ + private long timeStart = System.currentTimeMillis(); + private double bpm; + + public Timer(double newBpm) { + bpm = newBpm; + } + + public Timer() { + bpm = 60000; + } + + public double time() { + return ((double)(System.currentTimeMillis()-timeStart)-2000)*(bpm/60000.0); + } + + public String toString() { + return ""+((Math.round(10*(((double)(System.currentTimeMillis()-timeStart))*(bpm/60000.0))))/10.0); + } +} -- cgit v1.2.3