-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.js
77 lines (63 loc) · 2.1 KB
/
main.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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
var game = new Game();
game.start();
// var tetrisBoard = new Board();
// var level = new Level();
// var score = new Score();
// var keyboardControl = new Keyboard();
// updateBoard();
// console.log(score);
// //game loop
// var nextBlock = level.getNextBlock();
// var blockInQueue = level.getNextBlock();
// tetrisBoard.addTetromino(nextBlock);
// keyboardControl.init(nextBlock);
// updateBoard();
// function gameLoop() {
// if(!nextBlock.down()) {
// onDown();
// if(!tetrisBoard.addTetromino(nextBlock)) {
// // game over
// gameOver();
// }
// updateBoard();
// blockInQueue = level.getNextBlock();
// }
// updateBoard();
// }
// // implement a way to update level,lockDelay because this setInterval will not change during the game.
// var downInterval = setInterval(function() {gameLoop()}, level.lockDelay);
// function onDown() {
// // check if row clear?
// // add appropriate score
// score.addScore(tetrisBoard.findFullLine());
// // stop current block
// // get next Block
// nextBlock = blockInQueue;
// keyboardControl.init(nextBlock);
// }
// function gameOver() {
// // stop down loop on current tertromino
// clearInterval(downInterval);
// nextBlock = 0;
// blockInQueue = 0;
// // deactivate keyboard
// keyboardControl.gameOver();
// // print appropriate message
// console.log("GAME OVER!");
// document.getElementById("game_over").style.zIndex = "150";
// }
// function updateBoard() {
// document.getElementById("score").innerHTML = score.print();
// document.getElementById("board_wrapper").innerHTML = tetrisBoard.print();
// }
//document.getElementById("board").innerHTML = tetrisBoard.print();
// var iblock2 = new IBlock();
// tetrisBoard.addTetromino(iblock2);
// document.getElementById("board").innerHTML = tetrisBoard.print();
// document.getElementById("board").innerHTML = tetrisBoard.print();
// var iblock3 = new IBlock();
// //iblock3.blockType = "G";
// tetrisBoard.addTetromino(iblock3);
// document.getElementById("board").innerHTML = tetrisBoard.print();
// iblock3.down();
// document.getElementById("board").innerHTML = tetrisBoard.print();