Skip to content

Commit

Permalink
Add tick duration
Browse files Browse the repository at this point in the history
  • Loading branch information
Kiyotoko committed May 22, 2024
1 parent cae4659 commit 7657d4a
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/main/java/org/seekers/game/Game.java
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@ public static class Properties {
*/
public Properties(Ini ini) {
playtime = ini.fetch(SECTION, "playtime", int.class);
tickDuration = ini.fetch(SECTION, "tick-duration", double.class);
players = ini.fetch(SECTION, "players", int.class);
seekers = ini.fetch(SECTION, "seekers", int.class);
goals = ini.fetch(SECTION, "goals", int.class);
Expand All @@ -121,6 +122,7 @@ public Properties(Ini ini) {

// Global properties
final int playtime;
final double tickDuration;
final int players;
final int seekers;
final int goals;
Expand All @@ -138,7 +140,8 @@ public Properties(Ini ini) {
* @return the created timeline object
*/
private Timeline getTimeline() {
Timeline timeline = new Timeline(new KeyFrame(Duration.millis(10.0), e -> {
System.err.printf("time: %s, duration: %s%n", getGameProperties().playtime, getGameProperties().tickDuration);
Timeline timeline = new Timeline(new KeyFrame(Duration.millis(getGameProperties().tickDuration), e -> {
if (hasOpenSlots())
return;
if (tick > gameProperties.playtime) {
Expand Down
1 change: 1 addition & 0 deletions src/main/resources/org/seekers/config.ini
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
[global]
playtime=2000
tick-duration=10.0
players=2
seekers=5
goals=5
Expand Down

0 comments on commit 7657d4a

Please sign in to comment.