-
Notifications
You must be signed in to change notification settings - Fork 0
/
game.js
55 lines (49 loc) · 1.73 KB
/
game.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
45
46
47
48
49
50
51
52
53
54
55
if (player_color == "white") {
for (var i = 0; i < 8; i++) {
blackPawns.add(i * game.scale, 100);
whitePawns.add(i * game.scale, 600);
}
blackKnights.add(game.scale, 0);
blackKnights.add(game.scale * 6, 0);
whiteKnights.add(game.scale, game.scale * 7);
whiteKnights.add(game.scale * 6, game.scale * 7);
blackBishops.add(game.scale * 2, 0);
blackBishops.add(game.scale * 5, 0);
whiteBishops.add(game.scale * 2, game.scale * 7);
whiteBishops.add(game.scale * 5, game.scale * 7);
blackRooks.add(0, 0);
blackRooks.add(game.scale * 7, 0);
whiteRooks.add(0, game.scale * 7);
whiteRooks.add(game.scale * 7, game.scale * 7);
blackQueens.add(game.scale * 3, 0);
whiteQueens.add(game.scale * 3, game.scale * 7);
blackKings.add(game.scale * 4, 0);
whiteKings.add(game.scale * 4, game.scale * 7);
}
if (player_color == "black") {
for (var i = 0; i < 8; i++) {
blackPawns.add(i * game.scale, 600);
whitePawns.add(i * game.scale, 100);
}
whiteKnights.add(game.scale, 0);
whiteKnights.add(game.scale * 6, 0);
blackKnights.add(game.scale, game.scale * 7);
blackKnights.add(game.scale * 6, game.scale * 7);
whiteBishops.add(game.scale * 2, 0);
whiteBishops.add(game.scale * 5, 0);
blackBishops.add(game.scale * 2, game.scale * 7);
blackBishops.add(game.scale * 5, game.scale * 7);
whiteRooks.add(0, 0);
whiteRooks.add(game.scale * 7, 0);
blackRooks.add(0, game.scale * 7);
blackRooks.add(game.scale * 7, game.scale * 7);
whiteQueens.add(game.scale * 4, 0);
blackQueens.add(game.scale * 4, game.scale * 7);
whiteKings.add(game.scale * 3, 0);
blackKings.add(game.scale * 3, game.scale * 7);
}
window.onload = function() {
UpdateBoard();
UpdatePieces();
setInterval(update, 1000/60);
}