Skip to content

Commit

Permalink
Merge frustration
Browse files Browse the repository at this point in the history
  • Loading branch information
stasinos committed Jun 6, 2024
2 parents a9c4aaf + 33d44d1 commit dfc348d
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 2 deletions.
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Copyright (c) 2011, 2012, 2013, 2014, 2015, 2016 Jake Gordon and contributors
Copyright (c) 2017, Stasinos Konstantopoulos
Copyright (c) 2017, 2018 Stasinos Konstantopoulos

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
17 changes: 16 additions & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@
// game constants
//-------------------------------------------------------------------------

var KEY = { ESC: 27, SPACE: 32, LEFT: 37, UP: 38, RIGHT: 39, DOWN: 40, SHIFT: 16 },
var KEY = { ESC: 27, SPACE: 32, LEFT: 37, UP: 38, RIGHT: 39, DOWN: 40, SHIFT: 16, P: 80 },
// drop all the way to BOTTOM is an action
// IGNORE subsequent actions is also an action
// BUT: MAX=3 to avoid reaching these two pseudo-actions by rotation
Expand All @@ -80,6 +80,7 @@
ucanvas = get('upcoming'),
uctx = ucanvas.getContext('2d'),
speed = { start: 0.6, decrement: 0.005, min: 0.1 }, // how long before piece drops by 1 row (seconds)
paused = 0,
nx = 10, // width of tetris court (in blocks)
ny = 20, // height of tetris court (in blocks)
nu = 5, // width/height of upcoming preview (in blocks)
Expand Down Expand Up @@ -260,6 +261,16 @@
actions.push(DIR.BOTTOM); handled = true;
}
break;
case KEY.ESC: lose(); handled = true; break;
case KEY.P:
if( paused == 1 ) {
paused = 0;
}
else {
paused = 1;
}
handled = true;
break;
}
}
}
Expand Down Expand Up @@ -354,6 +365,9 @@
}

function drop() {
if( paused == 0 ) {
console.log( "0" );

if (!move(DIR.DOWN)) {
addScore(10);
dropPiece();
Expand All @@ -365,6 +379,7 @@
lose();
}
}
} // paused
}

function dropMany() {
Expand Down

0 comments on commit dfc348d

Please sign in to comment.