source:
lost-haven/main/SpawnPoint.java@
155577b
Last change on this file since 155577b was 0870468, checked in by , 5 years ago | |
---|---|
|
|
File size: 572 bytes |
Rev | Line | |
---|---|---|
[0870468] | 1 | package main; |
[a5b4186] | 2 | |
3 | public 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.