-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
44 lines (32 loc) · 975 Bytes
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
// this is how we will require our module
const sc2 = require('./binding.js')
const coordinator = new sc2.SC2Coordinator();
var settings={
path_exe: "D:\\StarCraft II\\Versions\\Base60321\\SC2.exe",
realtime: true,
map: "D:\\Projects\\SC2API\\maps\\Ladder\\(2)Bel'ShirVestigeLE (Void).SC2Map"
}
coordinator.loadSettings(settings);
function onGameStart(){
console.log("the game is started");
}
var agent_test = new sc2.SC2Agent();
agent_test.onGameStart = onGameStart;
var player = {
type: "Participant",
race: "Protoss",
difficulty: "Easy"
}
var player_setup = new sc2.SC2PlayerSetup(player);
player_setup.setAgent(agent_test);
var player_setup2 = new sc2.SC2PlayerSetup({
type: "Computer",
race: "Zerg",
difficulty: "Easy"
});
coordinator.participants = [player_setup, player_setup2];
coordinator.launchStarcraft();
function loopGame(error, result){
return coordinator.update(loopGame);
}
coordinator.update(loopGame);