source: lost-haven/main/SpawnPoint.java@ 155577b

Last change on this file since 155577b was 0870468, checked in by Dmitry Portnoy <dmitry.portnoy@…>, 5 years ago

Move all global classes into the main package

  • Property mode set to 100644
File size: 572 bytes
Line 
1package main;
2
3public class SpawnPoint {
4 Point loc;
5 long lastSpawned;
6 long interval;
7 Creature creature;
8
9 public SpawnPoint(Point loc, long interval, Creature creature) {
10 this.loc = loc;
11 this.interval = interval;
12 this.creature = creature;
13 lastSpawned = 0;
14 }
15
16 //calling class handles the actual spawning of the creature if this method returns true
17 public boolean spawn() {
18 if((System.currentTimeMillis()-lastSpawned) >= interval) {
19 lastSpawned = System.currentTimeMillis();
20 return true;
21 }else {
22 return false;
23 }
24 }
25}
Note: See TracBrowser for help on using the repository browser.