Last change
on this file since a5b4186 was a5b4186, checked in by dportnoy <dmp1488@…>, 18 years ago |
[svn r36] Renamed remotely
|
-
Property mode
set to
100644
|
File size:
557 bytes
|
Line | |
---|
1 |
|
---|
2 | public class SpawnPoint {
|
---|
3 | Point loc;
|
---|
4 | long lastSpawned;
|
---|
5 | long interval;
|
---|
6 | Creature creature;
|
---|
7 |
|
---|
8 | public SpawnPoint(Point loc, long interval, Creature creature) {
|
---|
9 | this.loc = loc;
|
---|
10 | this.interval = interval;
|
---|
11 | this.creature = creature;
|
---|
12 | lastSpawned = 0;
|
---|
13 | }
|
---|
14 |
|
---|
15 | //calling class handles the actual spawning of the creature if this method returns true
|
---|
16 | public boolean spawn() {
|
---|
17 | if((System.currentTimeMillis()-lastSpawned) >= interval) {
|
---|
18 | lastSpawned = System.currentTimeMillis();
|
---|
19 | return true;
|
---|
20 | }else {
|
---|
21 | return false;
|
---|
22 | }
|
---|
23 | }
|
---|
24 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.