Skip to content

Commit dfc348d

Browse files
committed
Merge frustration
2 parents a9c4aaf + 33d44d1 commit dfc348d

File tree

2 files changed

+17
-2
lines changed

2 files changed

+17
-2
lines changed

LICENSE

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
Copyright (c) 2011, 2012, 2013, 2014, 2015, 2016 Jake Gordon and contributors
2-
Copyright (c) 2017, Stasinos Konstantopoulos
2+
Copyright (c) 2017, 2018 Stasinos Konstantopoulos
33

44
Permission is hereby granted, free of charge, to any person obtaining a copy
55
of this software and associated documentation files (the "Software"), to deal

index.html

+16-1
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@
6969
// game constants
7070
//-------------------------------------------------------------------------
7171

72-
var KEY = { ESC: 27, SPACE: 32, LEFT: 37, UP: 38, RIGHT: 39, DOWN: 40, SHIFT: 16 },
72+
var KEY = { ESC: 27, SPACE: 32, LEFT: 37, UP: 38, RIGHT: 39, DOWN: 40, SHIFT: 16, P: 80 },
7373
// drop all the way to BOTTOM is an action
7474
// IGNORE subsequent actions is also an action
7575
// BUT: MAX=3 to avoid reaching these two pseudo-actions by rotation
@@ -80,6 +80,7 @@
8080
ucanvas = get('upcoming'),
8181
uctx = ucanvas.getContext('2d'),
8282
speed = { start: 0.6, decrement: 0.005, min: 0.1 }, // how long before piece drops by 1 row (seconds)
83+
paused = 0,
8384
nx = 10, // width of tetris court (in blocks)
8485
ny = 20, // height of tetris court (in blocks)
8586
nu = 5, // width/height of upcoming preview (in blocks)
@@ -260,6 +261,16 @@
260261
actions.push(DIR.BOTTOM); handled = true;
261262
}
262263
break;
264+
case KEY.ESC: lose(); handled = true; break;
265+
case KEY.P:
266+
if( paused == 1 ) {
267+
paused = 0;
268+
}
269+
else {
270+
paused = 1;
271+
}
272+
handled = true;
273+
break;
263274
}
264275
}
265276
}
@@ -354,6 +365,9 @@
354365
}
355366

356367
function drop() {
368+
if( paused == 0 ) {
369+
console.log( "0" );
370+
357371
if (!move(DIR.DOWN)) {
358372
addScore(10);
359373
dropPiece();
@@ -365,6 +379,7 @@
365379
lose();
366380
}
367381
}
382+
} // paused
368383
}
369384

370385
function dropMany() {

0 commit comments

Comments
 (0)