-
Notifications
You must be signed in to change notification settings - Fork 0
/
gameboybuttons.js
46 lines (46 loc) · 1.91 KB
/
gameboybuttons.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
// -------------------------------Reset-----------------------------------
document.getElementById("button1").addEventListener("click", function () {
location.reload();
}, false);
// -------------------------------Sound-----------------------------------
document.getElementById("button2").addEventListener("click", function() {
playSound();
});
// -------------------------------Pause-----------------------------------
document.getElementById("button3").addEventListener("click", function() {
document.getElementById("pause").innerHTML = "PAUSE";
clearInterval(gameInterval);
tetrisMusic.pause();
});
// -------------------------------Start-----------------------------------
document.getElementById("buttonstart").addEventListener("click", function() {
gameStart();
playSound();
document.getElementById("pause").innerHTML = "";
});
// -----------------------------Rotation-----------------------------------
document.getElementById("button4").addEventListener("click", function() {
rotateCurrentTetrimino();
});
// -------------------------------Drop------------------------------------
document.getElementById("button5").addEventListener("click", function() {
dropButton();
});
// --------------------------------Up-------------------------------------
document.getElementById("up").addEventListener("click", function() {
rotateCurrentTetrimino()
});
// -------------------------------Right------------------------------------
document.getElementById("left-right").addEventListener("click", function() {
currentTetrimino.moveRight();
drawGameBoard();
});
// -------------------------------Left-------------------------------------
document.getElementById("left").addEventListener("click", function() {
currentTetrimino.moveLeft();
drawGameBoard();
});
// ------------------------------Down--------------------------------------
document.getElementById("down").addEventListener("click", function() {
moveDownAndCheck();
});