update example code in README.md
This commit is contained in:
parent
ffb7cecc3a
commit
201af45caf
13
README.md
13
README.md
|
@ -40,6 +40,9 @@ public class ExampleBot {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onFrame() {
|
public void onFrame() {
|
||||||
|
// this object is ONLY valid while Mirror.startGame is running
|
||||||
|
// (which is fine 99% of the time, it just means you should only
|
||||||
|
// use it within code that is invoked from these listener methods)
|
||||||
Game game = mirror.getGame();
|
Game game = mirror.getGame();
|
||||||
Player self = game.self();
|
Player self = game.self();
|
||||||
|
|
||||||
|
@ -47,12 +50,16 @@ public class ExampleBot {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// blocks indefinitely
|
// if you pass true, blocks indefinitely and keeps Broodwar instance
|
||||||
mirror.startGame();
|
// connection to keep playing subsequent matches.
|
||||||
|
// if you pass false, startGame will return after a single match and
|
||||||
|
// disconnects from the Broodwar instance. you can call startGame as
|
||||||
|
// many times as you wish in this case.
|
||||||
|
mirror.startGame(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void main(String... args) {
|
public static void main(String... args) {
|
||||||
new TestBot().run();
|
new ExampleBot().run();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
Reference in a new issue