First Commit
This commit is contained in:
commit
0c325e3f11
12 changed files with 108303 additions and 0 deletions
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
|
|
@ -0,0 +1 @@
|
|||
original.js
|
||||
1
README.md
Normal file
1
README.md
Normal file
|
|
@ -0,0 +1 @@
|
|||
# SANDTRIS
|
||||
1
colorHelpers.js
Normal file
1
colorHelpers.js
Normal file
|
|
@ -0,0 +1 @@
|
|||
|
||||
BIN
favicon.png
Normal file
BIN
favicon.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 581 B |
BIN
fonts/retroFont.ttf
Normal file
BIN
fonts/retroFont.ttf
Normal file
Binary file not shown.
121
index.html
Normal file
121
index.html
Normal file
|
|
@ -0,0 +1,121 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<title>SANDTRIS</title>
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/p5.js/1.6.0/p5.js"></script>
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/p5.js/1.6.0/addons/p5.sound.min.js"></script>
|
||||
<link rel="icon" type="image/x-icon" href="favicon.png">
|
||||
<link rel="stylesheet" type="text/css" href="style.css">
|
||||
<meta charset="utf-8" />
|
||||
|
||||
</head>
|
||||
<body>
|
||||
<main>
|
||||
</main>
|
||||
<script src="sketch.js"></script>
|
||||
<center>
|
||||
<br/>
|
||||
<h1>SANDTRIS</h1>
|
||||
<div>
|
||||
|
||||
<dialog id = "aboutpage" class="page" close>
|
||||
<div class="box">
|
||||
<br/>
|
||||
<div class="logo is-animation">
|
||||
<span>S</span>
|
||||
<span>A</span>
|
||||
<span>N</span>
|
||||
<span>D</span>
|
||||
<span>T</span>
|
||||
<span>R</span>
|
||||
<span>I</span>
|
||||
<span>S</span>
|
||||
</div>
|
||||
<p>MADE BY <a href="https://francomiranda.com/" target="_blank">FRANCO MIRANDA</a> USING P5.JS</p>
|
||||
|
||||
<p>INSPIRED BY SETRIS BY
|
||||
<a href="https://itch.io/profile/mslivo" target="_blank">MSLIVO</a></p>
|
||||
<br/>
|
||||
<p>NOT AFFILIATED WITH Tetris®</p>
|
||||
<br/>
|
||||
<button type="button" class="aboutbutton" onClick="toggleAbout()">X</button>
|
||||
</div>
|
||||
</dialog>
|
||||
|
||||
<dialog id = "startpage" class="page" open>
|
||||
<div class="box">
|
||||
<br/>
|
||||
Welcome to
|
||||
<div class="logo is-animation">
|
||||
<span>S</span>
|
||||
<span>A</span>
|
||||
<span>N</span>
|
||||
<span>D</span>
|
||||
<span>T</span>
|
||||
<span>R</span>
|
||||
<span>I</span>
|
||||
<span>S</span>
|
||||
</div>
|
||||
|
||||
<br/>
|
||||
<button type="button" onClick="startGame()" >START</button>
|
||||
<br/><br/>
|
||||
<p id="levelText" style="margin:0px; padding:0px;">Level: </p>
|
||||
<input type="range" min="1" max="10" value="1" class="slider"
|
||||
id="lvlSlider" onchange="adjustDifficulty(this.value)"/>
|
||||
|
||||
<br/><br/>
|
||||
MUS
|
||||
<input style="width:80px" type="range" min="0" max="10" value="0.5"
|
||||
class="slider" id="mus1Slider"/>
|
||||
|
||||
<br/>
|
||||
SFX
|
||||
|
||||
<input style="width:80px" type="range" min="0" max="10" value="0.5"
|
||||
class="slider" id="sfx1Slider" onchange="SFXvolume(this.value)"/>
|
||||
<br/><br/>
|
||||
<button type="button" class="aboutbutton" onClick="toggleAbout()">?</button>
|
||||
</div>
|
||||
|
||||
|
||||
</dialog>
|
||||
|
||||
<dialog id = "pausepage" class="page" close>
|
||||
<div class="box">
|
||||
<br/>
|
||||
PAUSED
|
||||
<br/><br/>
|
||||
<button type="button" onClick="unpauseGame()">RESUME</button>
|
||||
<br/><br/>
|
||||
<button type="button" class="smallbutton" onClick="newGame()">NEW GAME</button>
|
||||
<br/><br/>
|
||||
MUS
|
||||
<input style="width:80px" type="range" min="0" max="10" value="1"
|
||||
class="slider" id="mus2Slider"/>
|
||||
<br/>
|
||||
SFX
|
||||
<input style="width:80px" type="range" min="0" max="10" value="0.5"
|
||||
class="slider" id="sfx2Slider" onchange="SFXvolume(this.value)"/>
|
||||
</div>
|
||||
</dialog>
|
||||
|
||||
<dialog id = "gameoverpage" class="page" close>
|
||||
<div class="box">
|
||||
<br/>
|
||||
GAME OVER
|
||||
<br/>
|
||||
<p id="gameoverText"></p>
|
||||
|
||||
|
||||
<button type="button" onClick="newGame()">NEW GAME</button>
|
||||
<br/><br/>
|
||||
<button type="button" class="sharebutton" onClick="shareText()">share</button>
|
||||
</div>
|
||||
</dialog>
|
||||
|
||||
<div id="cnv"></div>
|
||||
</div>
|
||||
</center>
|
||||
</body>
|
||||
</html>
|
||||
107125
p5.js
Normal file
107125
p5.js
Normal file
File diff suppressed because one or more lines are too long
3
p5.sound.min.js
vendored
Normal file
3
p5.sound.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
786
sketch.js
Normal file
786
sketch.js
Normal file
|
|
@ -0,0 +1,786 @@
|
|||
function _0x5d34(_0x4b68a3, _0x3b90df) {
|
||||
var _0x30aa1f = _0x30aa();
|
||||
return (
|
||||
(_0x5d34 = function (_0x5d34bf, _0x485476) {
|
||||
_0x5d34bf = _0x5d34bf - 0x171;
|
||||
var _0x50f17c = _0x30aa1f[_0x5d34bf];
|
||||
return _0x50f17c;
|
||||
}),
|
||||
_0x5d34(_0x4b68a3, _0x3b90df)
|
||||
);
|
||||
}
|
||||
var _0x3887b9 = _0x5d34;
|
||||
(function (_0xf469a7, _0x5cbaa2) {
|
||||
var _0x18175f = _0x5d34,
|
||||
_0x3e586e = _0xf469a7();
|
||||
while (!![]) {
|
||||
try {
|
||||
var _0x87b80 =
|
||||
parseInt(_0x18175f(0x19d)) / 0x1 +
|
||||
(parseInt(_0x18175f(0x176)) / 0x2) *
|
||||
(parseInt(_0x18175f(0x196)) / 0x3) +
|
||||
-parseInt(_0x18175f(0x1a8)) / 0x4 +
|
||||
(-parseInt(_0x18175f(0x197)) / 0x5) *
|
||||
(parseInt(_0x18175f(0x193)) / 0x6) +
|
||||
-parseInt(_0x18175f(0x181)) / 0x7 +
|
||||
parseInt(_0x18175f(0x194)) / 0x8 +
|
||||
-parseInt(_0x18175f(0x171)) / 0x9;
|
||||
if (_0x87b80 === _0x5cbaa2) break;
|
||||
else _0x3e586e["push"](_0x3e586e["shift"]());
|
||||
} catch (_0x5e090c) {
|
||||
_0x3e586e["push"](_0x3e586e["shift"]());
|
||||
}
|
||||
}
|
||||
})(_0x30aa, 0xcbf5b);
|
||||
function HSVtoRGB(_0x51ed68, _0x4e0751, _0x539e7) {
|
||||
var _0x434db1 = _0x5d34,
|
||||
_0x32a2f6,
|
||||
_0x305341,
|
||||
_0x5b7e8b,
|
||||
_0x1f5b76,
|
||||
_0x2afcc4,
|
||||
_0x27a234,
|
||||
_0x531435,
|
||||
_0x4650f;
|
||||
arguments[_0x434db1(0x1b4)] === 0x1 &&
|
||||
((_0x4e0751 = _0x51ed68["s"]),
|
||||
(_0x539e7 = _0x51ed68["v"]),
|
||||
(_0x51ed68 = _0x51ed68["h"]));
|
||||
(_0x1f5b76 = Math[_0x434db1(0x18c)](_0x51ed68 * 0x6)),
|
||||
(_0x2afcc4 = _0x51ed68 * 0x6 - _0x1f5b76),
|
||||
(_0x27a234 = _0x539e7 * (0x1 - _0x4e0751)),
|
||||
(_0x531435 = _0x539e7 * (0x1 - _0x2afcc4 * _0x4e0751)),
|
||||
(_0x4650f = _0x539e7 * (0x1 - (0x1 - _0x2afcc4) * _0x4e0751));
|
||||
switch (_0x1f5b76 % 0x6) {
|
||||
case 0x0:
|
||||
(_0x32a2f6 = _0x539e7), (_0x305341 = _0x4650f), (_0x5b7e8b = _0x27a234);
|
||||
break;
|
||||
case 0x1:
|
||||
(_0x32a2f6 = _0x531435), (_0x305341 = _0x539e7), (_0x5b7e8b = _0x27a234);
|
||||
break;
|
||||
case 0x2:
|
||||
(_0x32a2f6 = _0x27a234), (_0x305341 = _0x539e7), (_0x5b7e8b = _0x4650f);
|
||||
break;
|
||||
case 0x3:
|
||||
(_0x32a2f6 = _0x27a234), (_0x305341 = _0x531435), (_0x5b7e8b = _0x539e7);
|
||||
break;
|
||||
case 0x4:
|
||||
(_0x32a2f6 = _0x4650f), (_0x305341 = _0x27a234), (_0x5b7e8b = _0x539e7);
|
||||
break;
|
||||
case 0x5:
|
||||
(_0x32a2f6 = _0x539e7), (_0x305341 = _0x27a234), (_0x5b7e8b = _0x531435);
|
||||
break;
|
||||
}
|
||||
return {
|
||||
r: Math[_0x434db1(0x190)](_0x32a2f6 * 0xff),
|
||||
g: Math[_0x434db1(0x190)](_0x305341 * 0xff),
|
||||
b: Math[_0x434db1(0x190)](_0x5b7e8b * 0xff),
|
||||
};
|
||||
}
|
||||
var grid = [],
|
||||
scl = 0x4,
|
||||
padding = 0x4,
|
||||
columns = 0x50,
|
||||
rows = 0xa0,
|
||||
buff,
|
||||
t = 0x0,
|
||||
playerBlock,
|
||||
nextBlock,
|
||||
vis,
|
||||
fullLine,
|
||||
cleartime = 0x0,
|
||||
placed = ![],
|
||||
staticCount = 0x0,
|
||||
linesCleared = 0x0,
|
||||
score = 0x0,
|
||||
gameOffset = 0x4 * scl,
|
||||
nextOffset,
|
||||
gameRes,
|
||||
placeSound,
|
||||
lineSound,
|
||||
pixelFont,
|
||||
gameOver = !![],
|
||||
paused = !![],
|
||||
startScreen,
|
||||
pauseScreen,
|
||||
aboutScreen,
|
||||
gameoverScreen,
|
||||
gameoverText,
|
||||
timeText = _0x3887b9(0x19e),
|
||||
levelSlider,
|
||||
levelText,
|
||||
difficulty = 0x1,
|
||||
sfxSlider1,
|
||||
sfxSlider2,
|
||||
musSlider1,
|
||||
musSlider2,
|
||||
speed = 0.5,
|
||||
staticChance = 0x8,
|
||||
dupChance = 0.5,
|
||||
brick = [
|
||||
[0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0],
|
||||
[0x0, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x0],
|
||||
[0x0, 0x1, 0x0, 0x0, 0x0, 0x0, 0x1, 0x0],
|
||||
[0x0, 0x1, 0x0, 0x2, 0x2, 0x0, 0x1, 0x0],
|
||||
[0x0, 0x1, 0x0, 0x2, 0x2, 0x0, 0x1, 0x0],
|
||||
[0x0, 0x1, 0x0, 0x0, 0x0, 0x0, 0x1, 0x0],
|
||||
[0x0, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x0],
|
||||
[0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0],
|
||||
],
|
||||
staticbrick = [
|
||||
[0x2, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x2],
|
||||
[0x0, 0x1, 0x2, 0x1, 0x1, 0x2, 0x1, 0x0],
|
||||
[0x0, 0x2, 0x1, 0x1, 0x1, 0x1, 0x2, 0x0],
|
||||
[0x0, 0x1, 0x1, 0x0, 0x0, 0x1, 0x1, 0x0],
|
||||
[0x0, 0x1, 0x1, 0x0, 0x0, 0x1, 0x1, 0x0],
|
||||
[0x0, 0x2, 0x1, 0x1, 0x1, 0x1, 0x2, 0x0],
|
||||
[0x0, 0x1, 0x2, 0x1, 0x1, 0x2, 0x1, 0x0],
|
||||
[0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x2],
|
||||
],
|
||||
cols = [
|
||||
[0xff, 0x0, 0x0],
|
||||
[0x0, 0xff, 0x0],
|
||||
[0x0, 0x0, 0xff],
|
||||
[0xff, 0xff, 0x0],
|
||||
[0xff, 0xff, 0xff],
|
||||
],
|
||||
blockType = [
|
||||
[
|
||||
[0x0, 0x0, 0x0, 0x1, 0x1, 0x0, 0x1, 0x1],
|
||||
[0x0, 0x0, 0x0, 0x1, 0x1, 0x0, 0x1, 0x1],
|
||||
[0x0, 0x0, 0x0, 0x1, 0x1, 0x0, 0x1, 0x1],
|
||||
[0x0, 0x0, 0x0, 0x1, 0x1, 0x0, 0x1, 0x1],
|
||||
],
|
||||
[
|
||||
[0x0, 0x0, 0x0, 0x1, 0x1, 0x0, 0x0, 0x2],
|
||||
[0x0, 0x0, 0x1, 0x0, 0x2, 0x0, 0x2, 0x1],
|
||||
[0x0, 0x2, 0x1, 0x2, 0x1, 0x1, 0x1, 0x0],
|
||||
[0x0, 0x0, 0x0, 0x1, 0x1, 0x1, 0x2, 0x1],
|
||||
],
|
||||
[
|
||||
[0x0, 0x0, 0x1, 0x0, 0x1, 0x1, 0x1, 0x2],
|
||||
[0x0, 0x1, 0x1, 0x1, 0x2, 0x1, 0x2, 0x0],
|
||||
[0x0, 0x0, 0x0, 0x1, 0x0, 0x2, 0x1, 0x2],
|
||||
[0x0, 0x0, 0x0, 0x1, 0x1, 0x0, 0x2, 0x0],
|
||||
],
|
||||
[
|
||||
[0x0, 0x0, 0x1, 0x0, 0x1, 0x1, 0x2, 0x1],
|
||||
[0x0, 0x1, 0x0, 0x2, 0x1, 0x1, 0x1, 0x0],
|
||||
[0x0, 0x0, 0x1, 0x0, 0x1, 0x1, 0x2, 0x1],
|
||||
[0x0, 0x1, 0x0, 0x2, 0x1, 0x1, 0x1, 0x0],
|
||||
],
|
||||
[
|
||||
[0x0, 0x1, 0x1, 0x1, 0x1, 0x0, 0x2, 0x0],
|
||||
[0x0, 0x0, 0x0, 0x1, 0x1, 0x1, 0x1, 0x2],
|
||||
[0x0, 0x1, 0x1, 0x1, 0x1, 0x0, 0x2, 0x0],
|
||||
[0x0, 0x0, 0x0, 0x1, 0x1, 0x1, 0x1, 0x2],
|
||||
],
|
||||
[
|
||||
[0x0, 0x0, 0x1, 0x0, 0x2, 0x0, 0x1, 0x1],
|
||||
[0x0, 0x1, 0x1, 0x0, 0x1, 0x1, 0x1, 0x2],
|
||||
[0x1, 0x0, 0x0, 0x1, 0x1, 0x1, 0x2, 0x1],
|
||||
[0x0, 0x0, 0x0, 0x1, 0x0, 0x2, 0x1, 0x1],
|
||||
],
|
||||
[
|
||||
[0x0, 0x0, 0x1, 0x0, 0x2, 0x0, 0x3, 0x0],
|
||||
[0x0, 0x0, 0x0, 0x1, 0x0, 0x2, 0x0, 0x3],
|
||||
[0x0, 0x0, 0x1, 0x0, 0x2, 0x0, 0x3, 0x0],
|
||||
[0x0, 0x0, 0x0, 0x1, 0x0, 0x2, 0x0, 0x3],
|
||||
],
|
||||
],
|
||||
blockWidth = [
|
||||
[0x1, 0x1, 0x1, 0x1],
|
||||
[0x1, 0x2, 0x1, 0x2],
|
||||
[0x1, 0x2, 0x1, 0x2],
|
||||
[0x2, 0x1, 0x2, 0x1],
|
||||
[0x2, 0x1, 0x2, 0x1],
|
||||
[0x2, 0x1, 0x2, 0x1],
|
||||
[0x3, 0x0, 0x3, 0x0],
|
||||
],
|
||||
blockHeight = [
|
||||
[0x1, 0x1, 0x1, 0x1],
|
||||
[0x2, 0x1, 0x2, 0x1],
|
||||
[0x2, 0x1, 0x2, 0x1],
|
||||
[0x1, 0x2, 0x1, 0x2],
|
||||
[0x1, 0x2, 0x1, 0x2],
|
||||
[0x1, 0x2, 0x1, 0x2],
|
||||
[0x0, 0x3, 0x0, 0x3],
|
||||
];
|
||||
function preload() {
|
||||
var _0x18c020 = _0x3887b9;
|
||||
soundFormats(_0x18c020(0x17f), _0x18c020(0x19c)),
|
||||
(placeSound = loadSound("sounds/place")),
|
||||
(lineSound = loadSound(_0x18c020(0x184))),
|
||||
(pixelFont = loadFont(_0x18c020(0x1a5)));
|
||||
}
|
||||
function Block(_0x53bfe0, _0x25dbda) {
|
||||
var _0x255afd = _0x3887b9;
|
||||
(this[_0x255afd(0x1b2)] = createVector(0x0, 0x0)),
|
||||
(this["grav"] = speed),
|
||||
(this["sprite"] = null),
|
||||
(this[_0x255afd(0x17e)] = []),
|
||||
(this[_0x255afd(0x1a1)] = 0x0),
|
||||
(this[_0x255afd(0x19f)] = 0x0),
|
||||
(this[_0x255afd(0x1b0)] = ![]),
|
||||
(this[_0x255afd(0x178)] = 0x0),
|
||||
(this[_0x255afd(0x1ae)] = !![]),
|
||||
(this[_0x255afd(0x199)] = function () {
|
||||
var _0x3c7d8d = _0x255afd;
|
||||
this[_0x3c7d8d(0x17e)] = [];
|
||||
for (let _0x3495b8 = 0x0; _0x3495b8 < 0x20; _0x3495b8++) {
|
||||
this["grid"][_0x3c7d8d(0x186)](new Array(0x20)["fill"](null));
|
||||
}
|
||||
}),
|
||||
(this["renderBlock"] = function () {
|
||||
var _0x3d4f22 = _0x255afd;
|
||||
this[_0x3d4f22(0x199)](),
|
||||
AddBlock(
|
||||
this["grid"],
|
||||
0x0,
|
||||
0x1f,
|
||||
blockType[this[_0x3d4f22(0x1a1)]][this[_0x3d4f22(0x178)]],
|
||||
this[_0x3d4f22(0x19f)],
|
||||
this[_0x3d4f22(0x1b0)]
|
||||
),
|
||||
renderFromArray(this[_0x3d4f22(0x17e)], this[_0x3d4f22(0x18b)]);
|
||||
}),
|
||||
(this[_0x255afd(0x198)] = function () {
|
||||
var _0x3bef7b = _0x255afd;
|
||||
(this["static"] = ![]),
|
||||
(this["sprite"] = createImage(0x20, 0x20)),
|
||||
(this[_0x3bef7b(0x1a1)] = int(random(blockType[_0x3bef7b(0x1b4)]))),
|
||||
(this[_0x3bef7b(0x19f)] = int(random(0x4))),
|
||||
(this[_0x3bef7b(0x1b2)] = createVector(
|
||||
int(columns / 0x2 - (blockWidth[this[_0x3bef7b(0x1a1)]][0x0] + 0x1)),
|
||||
0x0
|
||||
)),
|
||||
(staticCount += 0x1),
|
||||
staticCount == staticChance &&
|
||||
((this["static"] = !![]), (staticCount = 0x0)),
|
||||
this[_0x3bef7b(0x18e)]();
|
||||
}),
|
||||
(this[_0x255afd(0x192)] = function () {
|
||||
var _0x1ae735 = _0x255afd;
|
||||
image(
|
||||
this[_0x1ae735(0x18b)],
|
||||
this[_0x1ae735(0x1b2)]["x"] * scl + gameOffset,
|
||||
(this["pos"]["y"] - 0x20) * scl,
|
||||
0x20 * scl,
|
||||
0x20 * scl
|
||||
);
|
||||
}),
|
||||
(this[_0x255afd(0x195)] = function () {
|
||||
var _0xd2f97a = _0x255afd;
|
||||
let _0x38c6ad = Math[_0xd2f97a(0x18c)](this[_0xd2f97a(0x1b2)]["x"]),
|
||||
_0x599cf6 = Math["floor"](this[_0xd2f97a(0x1b2)]["y"]);
|
||||
if (_0x599cf6 + 0x1 >= rows) placed = !![];
|
||||
else
|
||||
for (let _0x541317 = 0x0; _0x541317 < 0x4; _0x541317++) {
|
||||
let _0x31ee7f = _0x541317 * 0x2,
|
||||
_0x50efd0 =
|
||||
blockType[this["type"]][this[_0xd2f97a(0x178)]][_0x31ee7f],
|
||||
_0x60b19e = blockType[this["type"]][this["rot"]][_0x31ee7f + 0x1],
|
||||
_0x260aa0 = int(_0x38c6ad + _0x50efd0 * 0x8),
|
||||
_0x1e4b3a = int(_0x599cf6 - _0x60b19e * 0x8);
|
||||
if (_0x1e4b3a <= 0x0) continue;
|
||||
for (let _0x3e994e = 0x0; _0x3e994e < 0x8; _0x3e994e++) {
|
||||
grid[_0x1e4b3a + 0x1][_0x260aa0 + _0x3e994e] != null &&
|
||||
(grid[_0x1e4b3a][_0x260aa0 + _0x3e994e] &&
|
||||
(this[_0xd2f97a(0x1b2)]["y"] -= 0x1),
|
||||
(placed = !![]));
|
||||
}
|
||||
}
|
||||
if (placed) {
|
||||
this[_0xd2f97a(0x1b2)]["y"] -
|
||||
0x8 *
|
||||
(blockHeight[this[_0xd2f97a(0x1a1)]][this[_0xd2f97a(0x178)]] +
|
||||
0x1) <
|
||||
0x0 &&
|
||||
((gameOver = !![]),
|
||||
gameOverScore(),
|
||||
(gameoverScreen[_0xd2f97a(0x179)] = !![]));
|
||||
AddBlock(
|
||||
grid,
|
||||
_0x38c6ad,
|
||||
min(_0x599cf6, rows - 0x1),
|
||||
blockType[this[_0xd2f97a(0x1a1)]][this[_0xd2f97a(0x178)]],
|
||||
this[_0xd2f97a(0x19f)],
|
||||
this["static"]
|
||||
),
|
||||
placeSound["play"]();
|
||||
return;
|
||||
}
|
||||
this["pos"]["y"] += this[_0xd2f97a(0x182)];
|
||||
}),
|
||||
(this[_0x255afd(0x1ad)] = function () {
|
||||
var _0x134818 = _0x255afd;
|
||||
(this["rot"] = (this[_0x134818(0x178)] + 0x1) % 0x4),
|
||||
this["clearGrid"](),
|
||||
(this["sprite"] = createImage(0x20, 0x20)),
|
||||
AddBlock(
|
||||
this["grid"],
|
||||
0x0,
|
||||
0x1f,
|
||||
blockType[this[_0x134818(0x1a1)]][this[_0x134818(0x178)]],
|
||||
this["col"],
|
||||
this[_0x134818(0x1b0)]
|
||||
),
|
||||
renderFromArray(this[_0x134818(0x17e)], this[_0x134818(0x18b)]);
|
||||
}),
|
||||
(this[_0x255afd(0x1b1)] = function () {
|
||||
var _0x199b9d = _0x255afd;
|
||||
keyIsDown(UP_ARROW)
|
||||
? this["rotReset"] &&
|
||||
(this[_0x199b9d(0x1ad)](), (this[_0x199b9d(0x1ae)] = ![]))
|
||||
: (this[_0x199b9d(0x1ae)] = !![]);
|
||||
keyIsDown(LEFT_ARROW) &&
|
||||
((this[_0x199b9d(0x1b2)]["x"] -= 0x1),
|
||||
this["pos"]["x"] < 0x0 && (this[_0x199b9d(0x1b2)]["x"] = 0x0));
|
||||
if (keyIsDown(RIGHT_ARROW)) {
|
||||
this["pos"]["x"] += 0x1;
|
||||
let _0x308c0d = blockWidth[this["type"]][this[_0x199b9d(0x178)]] + 0x1;
|
||||
this[_0x199b9d(0x1b2)]["x"] > columns - _0x308c0d * 0x8 &&
|
||||
(this[_0x199b9d(0x1b2)]["x"] = columns - _0x308c0d * 0x8);
|
||||
}
|
||||
keyIsDown(DOWN_ARROW) &&
|
||||
((this[_0x199b9d(0x1b2)]["y"] += 0x1), (score += 0x1));
|
||||
});
|
||||
}
|
||||
function resetGame() {
|
||||
var _0x3e1ba8 = _0x3887b9;
|
||||
(score = 0x0),
|
||||
(linesCleared = 0x0),
|
||||
(staticCount = 0x0),
|
||||
(t = 0x0),
|
||||
(buff = createImage(columns, rows)),
|
||||
(grid = []);
|
||||
for (let _0x1e71f1 = 0x0; _0x1e71f1 < rows; _0x1e71f1++) {
|
||||
grid[_0x1e71f1] = [];
|
||||
for (let _0x5c3d48 = 0x0; _0x5c3d48 < columns; _0x5c3d48++) {
|
||||
grid[_0x1e71f1][_0x3e1ba8(0x186)](null);
|
||||
}
|
||||
}
|
||||
(playerBlock = new Block(width / 0x2 - gameOffset, 0x0)),
|
||||
playerBlock[_0x3e1ba8(0x198)](),
|
||||
(nextBlock = new Block(width / 0x2 - gameOffset, 0x0)),
|
||||
nextBlock[_0x3e1ba8(0x198)]();
|
||||
}
|
||||
function startGame() {
|
||||
var _0x4b2eea = _0x3887b9;
|
||||
resetGame(),
|
||||
(paused = ![]),
|
||||
(gameOver = ![]),
|
||||
(startScreen[_0x4b2eea(0x179)] = ![]);
|
||||
}
|
||||
function unpauseGame() {
|
||||
var _0x294451 = _0x3887b9;
|
||||
(paused = ![]), (pauseScreen[_0x294451(0x179)] = ![]);
|
||||
}
|
||||
function newGame() {
|
||||
var _0x36b942 = _0x3887b9;
|
||||
(pauseScreen["open"] = ![]),
|
||||
(gameoverScreen[_0x36b942(0x179)] = ![]),
|
||||
(startScreen[_0x36b942(0x179)] = !![]);
|
||||
}
|
||||
function SFXvolume(_0x4990e8) {
|
||||
var _0x5bc95b = _0x3887b9;
|
||||
let _0x2b1627 = _0x4990e8 / 0xa;
|
||||
placeSound[_0x5bc95b(0x1a7)](_0x2b1627),
|
||||
lineSound[_0x5bc95b(0x1a7)](_0x2b1627),
|
||||
(sfxSlider1[_0x5bc95b(0x1ac)] = _0x4990e8),
|
||||
(sfxSlider2[_0x5bc95b(0x1ac)] = _0x4990e8);
|
||||
}
|
||||
function toggleAbout() {
|
||||
var _0x7eaa53 = _0x3887b9;
|
||||
(aboutScreen[_0x7eaa53(0x179)] = !aboutScreen[_0x7eaa53(0x179)]),
|
||||
(startScreen["open"] = !startScreen[_0x7eaa53(0x179)]);
|
||||
}
|
||||
function adjustDifficulty() {
|
||||
var _0x4683d8 = _0x3887b9;
|
||||
(difficulty = levelSlider[_0x4683d8(0x1ac)]),
|
||||
(speed = 0.5 + map(difficulty, 0x1, 0xa, 0x0, 0x3) / 0x2),
|
||||
(staticChance = Math["floor"](map(difficulty, 0x1, 0xa, 0x10, 0x4))),
|
||||
(dupChance = map(difficulty, 0x0, 0x1, 0x1, 0.1));
|
||||
}
|
||||
function _0x30aa() {
|
||||
var _0x26bbc7 = [
|
||||
"rotReset",
|
||||
"aboutpage",
|
||||
"static",
|
||||
"controls",
|
||||
"pos",
|
||||
"Deleting",
|
||||
"length",
|
||||
"innerHTML",
|
||||
"5588397BLDmBX",
|
||||
"getElementById",
|
||||
"SCORE:<br/>",
|
||||
"levelText",
|
||||
"pausepage",
|
||||
"110KWaQsT",
|
||||
"SCORE:\x20",
|
||||
"rot",
|
||||
"open",
|
||||
"lvlSlider",
|
||||
"SCORE:",
|
||||
"LINE\x20AT\x20",
|
||||
"clipboard",
|
||||
"grid",
|
||||
"mp3",
|
||||
"Share\x20Text\x20Copied\x20to\x20Clipboard!",
|
||||
"8211735jtYqOg",
|
||||
"grav",
|
||||
"loadPixels",
|
||||
"sounds/line",
|
||||
"repeat",
|
||||
"push",
|
||||
"Play\x20now\x20at\x20SANDTRIS.COM",
|
||||
"pixels",
|
||||
"textSize",
|
||||
"\x0a█▀\u2003▄▀█\u2003█▄░█\u2003█▀▄\u2003▀█▀\u2003█▀█\u2003█\u2003█▀\x0a▄█\u2003█▀█\u2003█░▀█\u2003█▄▀\u2003░█░\u2003█▀▄\u2003█\u2003▄█\x0a",
|
||||
"sprite",
|
||||
"floor",
|
||||
"strokeWeight",
|
||||
"renderBlock",
|
||||
"log",
|
||||
"round",
|
||||
"startpage",
|
||||
"show",
|
||||
"288DsoDuN",
|
||||
"6840624iCuttA",
|
||||
"update",
|
||||
"47100eykVvL",
|
||||
"3610vIYXTd",
|
||||
"newBlock",
|
||||
"clearGrid",
|
||||
"LINES:",
|
||||
"sfx1Slider",
|
||||
"ogg",
|
||||
"1501394IetbOS",
|
||||
"00:00",
|
||||
"col",
|
||||
"TIME:\x20",
|
||||
"type",
|
||||
"gameoverText",
|
||||
"LEVEL:\x20",
|
||||
"parent",
|
||||
"fonts/retroFont.ttf",
|
||||
"play",
|
||||
"setVolume",
|
||||
"2223436whKHFt",
|
||||
"LEVEL:",
|
||||
"toString",
|
||||
"updatePixels",
|
||||
"value",
|
||||
"rotate",
|
||||
];
|
||||
_0x30aa = function () {
|
||||
return _0x26bbc7;
|
||||
};
|
||||
return _0x30aa();
|
||||
}
|
||||
function gameOverScore() {
|
||||
var _0x4f91f9 = _0x3887b9;
|
||||
(gameoverText[_0x4f91f9(0x1b5)] = ""),
|
||||
(gameoverText[_0x4f91f9(0x1b5)] += _0x4f91f9(0x173) + score),
|
||||
(gameoverText["innerHTML"] += "<br/>LINES:<br/>" + linesCleared);
|
||||
}
|
||||
function shareText() {
|
||||
var _0x38809a = _0x3887b9;
|
||||
let _0x3741a1 = _0x38809a(0x18a),
|
||||
_0x54c950 = difficulty[_0x38809a(0x1aa)](),
|
||||
_0x1bc804 = linesCleared["toString"](),
|
||||
_0x3512fd = score[_0x38809a(0x1aa)]();
|
||||
(_0x3741a1 +=
|
||||
_0x38809a(0x1a3) +
|
||||
_0x54c950 +
|
||||
"\x20"[_0x38809a(0x185)](0x6 - _0x54c950["length"]) +
|
||||
"|\x20"),
|
||||
(_0x3741a1 +=
|
||||
"LINES:\x20" +
|
||||
_0x1bc804 +
|
||||
"\x20"[_0x38809a(0x185)](0x6 - _0x1bc804["length"]) +
|
||||
"\x0a"),
|
||||
(_0x3741a1 +=
|
||||
_0x38809a(0x177) +
|
||||
_0x3512fd +
|
||||
"\x20"["repeat"](0x9 - _0x3512fd[_0x38809a(0x1b4)]) +
|
||||
"|\x20"),
|
||||
(_0x3741a1 +=
|
||||
_0x38809a(0x1a0) +
|
||||
timeText +
|
||||
"\x20"[_0x38809a(0x185)](0x7 - timeText[_0x38809a(0x1b4)]) +
|
||||
"\x0a"),
|
||||
(_0x3741a1 += _0x38809a(0x187)),
|
||||
(_0x3741a1 += navigator[_0x38809a(0x17d)]["writeText"](_0x3741a1)),
|
||||
alert(_0x38809a(0x180));
|
||||
}
|
||||
function setup() {
|
||||
var _0x1b78e0 = _0x3887b9;
|
||||
(startScreen = document[_0x1b78e0(0x172)](_0x1b78e0(0x191))),
|
||||
(pauseScreen = document[_0x1b78e0(0x172)](_0x1b78e0(0x175))),
|
||||
(gameoverScreen = document[_0x1b78e0(0x172)]("gameoverpage")),
|
||||
(aboutScreen = document["getElementById"](_0x1b78e0(0x1af))),
|
||||
(levelSlider = document[_0x1b78e0(0x172)](_0x1b78e0(0x17a))),
|
||||
(levelSlider[_0x1b78e0(0x1ac)] = 0x1),
|
||||
(levelText = document[_0x1b78e0(0x172)](_0x1b78e0(0x174))),
|
||||
(sfxSlider1 = document[_0x1b78e0(0x172)](_0x1b78e0(0x19b))),
|
||||
(sfxSlider2 = document[_0x1b78e0(0x172)]("sfx2Slider")),
|
||||
(sfxSlider1[_0x1b78e0(0x1ac)] = 0xa),
|
||||
(sfxSlider2[_0x1b78e0(0x1ac)] = 0xa),
|
||||
(musSlider1 = document[_0x1b78e0(0x172)]("mus1Slider")),
|
||||
(musSlider2 = document["getElementById"]("mus2Slider")),
|
||||
(musSlider1["value"] = 0xa),
|
||||
(musSlider2[_0x1b78e0(0x1ac)] = 0xa),
|
||||
(gameoverText = document[_0x1b78e0(0x172)](_0x1b78e0(0x1a2))),
|
||||
(gameRes = createVector(columns * scl, rows * scl)),
|
||||
(nextOffset = gameRes["x"] + gameOffset * 0x4),
|
||||
(cnv = createCanvas(gameRes["x"] + gameOffset * 0x11, gameRes["y"])),
|
||||
cnv[_0x1b78e0(0x1a4)]("cnv"),
|
||||
textFont(pixelFont),
|
||||
frameRate(0x3c),
|
||||
noSmooth(),
|
||||
resetGame();
|
||||
}
|
||||
function AddBlock(
|
||||
_0x1b0852,
|
||||
_0x177a23,
|
||||
_0x58632c,
|
||||
_0x4f09a3,
|
||||
_0x36c414,
|
||||
_0x398fa2
|
||||
) {
|
||||
for (let _0x47255b = 0x0; _0x47255b < 0x4; _0x47255b++) {
|
||||
AddSingleBrick(
|
||||
_0x1b0852,
|
||||
_0x177a23 + _0x4f09a3[_0x47255b * 0x2] * 0x8,
|
||||
_0x58632c - _0x4f09a3[_0x47255b * 0x2 + 0x1] * 0x8,
|
||||
_0x36c414,
|
||||
_0x398fa2
|
||||
);
|
||||
}
|
||||
}
|
||||
function AddSingleBrick(_0x3c2ecf, _0x93f084, _0x3e1c7e, _0x25683b, _0x50c9de) {
|
||||
let _0x3e0da9 = brick;
|
||||
_0x50c9de && (_0x3e0da9 = staticbrick);
|
||||
for (let _0x390455 = 0x0; _0x390455 < 0x8; _0x390455++) {
|
||||
for (let _0xab571c = 0x0; _0xab571c < 0x8; _0xab571c++) {
|
||||
if (_0x3e1c7e - _0x390455 < 0x0) continue;
|
||||
let _0x161a1b = HSVtoRGB(
|
||||
_0x25683b / 0x5,
|
||||
0.8,
|
||||
map(_0x3e0da9[_0x390455][_0xab571c], 0x0, 0x1, 0.2, 0.7)
|
||||
);
|
||||
_0x3c2ecf[_0x3e1c7e - _0x390455][_0x93f084 + _0xab571c] = [
|
||||
_0x25683b,
|
||||
_0x161a1b["r"],
|
||||
_0x161a1b["g"],
|
||||
_0x161a1b["b"],
|
||||
0x0,
|
||||
_0x50c9de,
|
||||
];
|
||||
}
|
||||
}
|
||||
}
|
||||
function renderFromArray(_0x4c7e1d, _0xd91d85) {
|
||||
var _0x3213e5 = _0x3887b9;
|
||||
let _0x3ce2f8 = _0x4c7e1d[_0x3213e5(0x1b4)],
|
||||
_0x47b62d = _0x4c7e1d[0x0][_0x3213e5(0x1b4)];
|
||||
_0xd91d85[_0x3213e5(0x183)]();
|
||||
for (let _0x17d22c = 0x0; _0x17d22c < _0x3ce2f8; _0x17d22c++) {
|
||||
for (let _0x590a5c = 0x0; _0x590a5c < _0x47b62d; _0x590a5c++) {
|
||||
let _0x581bb9 = (_0x17d22c * _0x47b62d + _0x590a5c) * 0x4;
|
||||
if (_0x4c7e1d[_0x17d22c][_0x590a5c] == null) {
|
||||
(_0xd91d85["pixels"][_0x581bb9] = 0x0),
|
||||
(_0xd91d85["pixels"][_0x581bb9 + 0x1] = 0x0),
|
||||
(_0xd91d85["pixels"][_0x581bb9 + 0x2] = 0x0),
|
||||
(_0xd91d85[_0x3213e5(0x188)][_0x581bb9 + 0x3] = 0x0);
|
||||
continue;
|
||||
}
|
||||
(_0xd91d85[_0x3213e5(0x188)][_0x581bb9] =
|
||||
_0x4c7e1d[_0x17d22c][_0x590a5c][0x1]),
|
||||
(_0xd91d85[_0x3213e5(0x188)][_0x581bb9 + 0x1] =
|
||||
_0x4c7e1d[_0x17d22c][_0x590a5c][0x2]),
|
||||
(_0xd91d85["pixels"][_0x581bb9 + 0x2] =
|
||||
_0x4c7e1d[_0x17d22c][_0x590a5c][0x3]),
|
||||
(_0xd91d85[_0x3213e5(0x188)][_0x581bb9 + 0x3] = 0xff);
|
||||
}
|
||||
}
|
||||
_0xd91d85[_0x3213e5(0x1ab)]();
|
||||
}
|
||||
function updateLogic(_0x43aa3b, _0x475149) {
|
||||
if (grid[_0x475149][_0x43aa3b] == null) return;
|
||||
grid[_0x475149][_0x43aa3b][0x4] = 0x0;
|
||||
if (_0x475149 >= rows - 0x1) return;
|
||||
if (grid[_0x475149 + 0x1][_0x43aa3b] == null) {
|
||||
(grid[_0x475149 + 0x1][_0x43aa3b] = grid[_0x475149][_0x43aa3b]),
|
||||
(grid[_0x475149][_0x43aa3b] = null);
|
||||
return;
|
||||
}
|
||||
if (grid[_0x475149][_0x43aa3b][0x5]) return;
|
||||
let _0x129fa2 =
|
||||
_0x43aa3b > 0x0 && grid[_0x475149 + 0x1][_0x43aa3b - 0x1] == null,
|
||||
_0x12d6ba =
|
||||
_0x43aa3b < columns - 0x1 &&
|
||||
grid[_0x475149 + 0x1][_0x43aa3b + 0x1] == null;
|
||||
if (_0x129fa2 && _0x12d6ba) {
|
||||
if (random() < 0.5) {
|
||||
(grid[_0x475149 + 0x1][_0x43aa3b - 0x1] = grid[_0x475149][_0x43aa3b]),
|
||||
(grid[_0x475149][_0x43aa3b] = null);
|
||||
return;
|
||||
}
|
||||
(grid[_0x475149 + 0x1][_0x43aa3b + 0x1] = grid[_0x475149][_0x43aa3b]),
|
||||
(grid[_0x475149][_0x43aa3b] = null);
|
||||
return;
|
||||
}
|
||||
if (_0x129fa2) {
|
||||
(grid[_0x475149 + 0x1][_0x43aa3b - 0x1] = grid[_0x475149][_0x43aa3b]),
|
||||
(grid[_0x475149][_0x43aa3b] = null);
|
||||
return;
|
||||
}
|
||||
if (_0x12d6ba) {
|
||||
(grid[_0x475149 + 0x1][_0x43aa3b + 0x1] = grid[_0x475149][_0x43aa3b]),
|
||||
(grid[_0x475149][_0x43aa3b] = null);
|
||||
return;
|
||||
}
|
||||
}
|
||||
function updateGrid() {
|
||||
if (t % 0x4 == 0x0) {
|
||||
for (let _0x14bf98 = rows - 0x1; _0x14bf98 >= 0x0; _0x14bf98--) {
|
||||
for (let _0x39a870 = 0x0; _0x39a870 < columns; _0x39a870++) {
|
||||
updateLogic(_0x39a870, _0x14bf98);
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
if (t % 0x4 == 0x2)
|
||||
for (let _0x194eed = rows - 0x1; _0x194eed >= 0x0; _0x194eed--) {
|
||||
for (let _0x26f74c = columns - 0x1; _0x26f74c >= 0x0; _0x26f74c--) {
|
||||
updateLogic(_0x26f74c, _0x194eed);
|
||||
}
|
||||
}
|
||||
}
|
||||
function checkLine() {
|
||||
var _0x2a8afe = _0x3887b9;
|
||||
vis = [];
|
||||
for (let _0x1f620a = 0x0; _0x1f620a < rows; _0x1f620a++) {
|
||||
(vis = []), (fullLine = ![]);
|
||||
if (grid[_0x1f620a][0x0] == null || grid[_0x1f620a][0x0][0x4] == 0x1)
|
||||
continue;
|
||||
floodFill(0x0, _0x1f620a, grid[_0x1f620a][0x0][0x0]);
|
||||
if (!fullLine) continue;
|
||||
console[_0x2a8afe(0x18f)](_0x2a8afe(0x17c), _0x1f620a);
|
||||
return;
|
||||
}
|
||||
}
|
||||
function floodFill(_0x58e935, _0x434257, _0x5a1a42) {
|
||||
var _0x1e291a = _0x3887b9;
|
||||
if (
|
||||
_0x58e935 < 0x0 ||
|
||||
_0x58e935 >= columns ||
|
||||
_0x434257 < 0x0 ||
|
||||
_0x434257 >= rows ||
|
||||
grid[_0x434257][_0x58e935] == null ||
|
||||
grid[_0x434257][_0x58e935][0x4] == 0x1 ||
|
||||
grid[_0x434257][_0x58e935][0x0] != _0x5a1a42
|
||||
)
|
||||
return;
|
||||
_0x58e935 == columns - 0x1 && (fullLine = !![]),
|
||||
(grid[_0x434257][_0x58e935][0x4] = 0x1),
|
||||
vis[_0x1e291a(0x186)]([_0x58e935, _0x434257]),
|
||||
floodFill(_0x58e935 + 0x1, _0x434257, _0x5a1a42),
|
||||
floodFill(_0x58e935 - 0x1, _0x434257, _0x5a1a42),
|
||||
floodFill(_0x58e935, _0x434257 + 0x1, _0x5a1a42),
|
||||
floodFill(_0x58e935, _0x434257 - 0x1, _0x5a1a42);
|
||||
}
|
||||
function setLineColor(_0x2e9d4c) {
|
||||
let _0xcc7e2f = 0xff;
|
||||
_0x2e9d4c % 0xa < 0x5 && (_0xcc7e2f = 0x0);
|
||||
for (let _0xf0b801 of vis) {
|
||||
(grid[_0xf0b801[0x1]][_0xf0b801[0x0]][0x1] = _0xcc7e2f),
|
||||
(grid[_0xf0b801[0x1]][_0xf0b801[0x0]][0x2] = _0xcc7e2f),
|
||||
(grid[_0xf0b801[0x1]][_0xf0b801[0x0]][0x3] = _0xcc7e2f);
|
||||
}
|
||||
}
|
||||
function deleteLine(_0x4b1de6) {
|
||||
var _0x1541d4 = _0x3887b9;
|
||||
for (let _0xc87d37 of vis) {
|
||||
grid[_0xc87d37[0x1]][_0xc87d37[0x0]] = null;
|
||||
}
|
||||
(score += vis[_0x1541d4(0x1b4)]), (vis = []);
|
||||
}
|
||||
function UI() {
|
||||
var _0x3fcb48 = _0x3887b9;
|
||||
renderFromArray(grid, buff),
|
||||
background(0xce, 0xae, 0x7f),
|
||||
fill(0xa),
|
||||
rect(gameOffset, 0x0, columns * scl, rows * scl),
|
||||
image(buff, gameOffset, 0x0, columns * scl, rows * scl);
|
||||
!gameOver && !placed && playerBlock["show"]();
|
||||
fill(0xa),
|
||||
rect(nextOffset, gameOffset * 0x2, gameOffset * 0xa, gameOffset * 0xa),
|
||||
image(
|
||||
nextBlock[_0x3fcb48(0x18b)],
|
||||
nextOffset +
|
||||
(0x5 - (blockWidth[nextBlock[_0x3fcb48(0x1a1)]][0x0] + 0x1)) *
|
||||
gameOffset,
|
||||
(0x5 - (0x6 - blockHeight[nextBlock[_0x3fcb48(0x1a1)]][0x0]) + 0x1) *
|
||||
gameOffset,
|
||||
0x20 * scl,
|
||||
0x20 * scl
|
||||
);
|
||||
let _0x383be4 = Math["floor"](t / 0xe10),
|
||||
_0x5c18c2 = Math[_0x3fcb48(0x18c)](t / 0x3c) % 0x3c;
|
||||
_0x383be4 < 0xa && (_0x383be4 = "0" + _0x383be4),
|
||||
_0x5c18c2 < 0xa && (_0x5c18c2 = "0" + _0x5c18c2),
|
||||
(timeText = _0x383be4 + ":" + _0x5c18c2),
|
||||
fill(0x19)[_0x3fcb48(0x18d)](0x1)[_0x3fcb48(0x189)](0x20),
|
||||
text(timeText, nextOffset - 0x2, gameOffset * 0x10),
|
||||
text(_0x3fcb48(0x19a), nextOffset - 0x2, gameOffset * 0x13),
|
||||
text(linesCleared, nextOffset - 0x2, gameOffset * 0x15),
|
||||
text(_0x3fcb48(0x17b), nextOffset - 0x2, gameOffset * 0x18),
|
||||
text(score, nextOffset - 0x2, gameOffset * 0x1a),
|
||||
text(_0x3fcb48(0x1a9), nextOffset - 0x2, gameOffset * 0x1d),
|
||||
text(difficulty, nextOffset - 0x2, gameOffset * 0x1f),
|
||||
(levelText["innerHTML"] = _0x3fcb48(0x1a3) + levelSlider["value"]);
|
||||
}
|
||||
function keyPressed() {
|
||||
var _0xf53849 = _0x3887b9;
|
||||
if (keyCode === 0x50) {
|
||||
if (gameOver) return;
|
||||
(paused = !paused),
|
||||
(pauseScreen[_0xf53849(0x179)] = !pauseScreen[_0xf53849(0x179)]);
|
||||
}
|
||||
}
|
||||
function GameLogic() {
|
||||
var _0x15b64b = _0x3887b9;
|
||||
if (paused) return;
|
||||
if (gameOver) return;
|
||||
if (fullLine) {
|
||||
cleartime == 0x0 && ((linesCleared += 0x1), lineSound[_0x15b64b(0x1a6)]());
|
||||
(cleartime += 0x1), setLineColor(cleartime);
|
||||
cleartime > 0x1e &&
|
||||
(console[_0x15b64b(0x18f)](_0x15b64b(0x1b3)),
|
||||
deleteLine(),
|
||||
(cleartime = 0x0),
|
||||
(fullLine = ![]));
|
||||
return;
|
||||
}
|
||||
placed &&
|
||||
((playerBlock = nextBlock),
|
||||
(nextBlock = new Block(width / 0x2, 0x0)),
|
||||
nextBlock[_0x15b64b(0x198)](),
|
||||
playerBlock["col"] == nextBlock["col"] &&
|
||||
random() < dupChance &&
|
||||
((nextBlock[_0x15b64b(0x19f)] = (nextBlock["col"] + 0x1) % 0x4),
|
||||
nextBlock[_0x15b64b(0x18e)]()),
|
||||
(placed = ![])),
|
||||
updateGrid(),
|
||||
playerBlock[_0x15b64b(0x195)](),
|
||||
playerBlock[_0x15b64b(0x1b1)](),
|
||||
checkLine(),
|
||||
(t += 0x1);
|
||||
}
|
||||
function draw() {
|
||||
UI(), GameLogic();
|
||||
}
|
||||
BIN
sounds/line.mp3
Normal file
BIN
sounds/line.mp3
Normal file
Binary file not shown.
BIN
sounds/place.mp3
Normal file
BIN
sounds/place.mp3
Normal file
Binary file not shown.
265
style.css
Normal file
265
style.css
Normal file
|
|
@ -0,0 +1,265 @@
|
|||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@font-face {
|
||||
font-family: "pixelFont";
|
||||
src: url("fonts/retroFont.ttf");
|
||||
}
|
||||
|
||||
html, body {
|
||||
font-family: "pixelFont";
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
color: rgb(206, 174, 127);
|
||||
background-color: black;
|
||||
}
|
||||
canvas {
|
||||
display: block;
|
||||
}
|
||||
|
||||
h1{
|
||||
font-size: 36px;
|
||||
text-shadow: 0px 3px rgb(73, 62, 46);
|
||||
}
|
||||
|
||||
#cnv{
|
||||
position: absolute;
|
||||
background-color: rgb(206, 174, 127);
|
||||
width: 590px;
|
||||
height: 640px;
|
||||
|
||||
top:50%;
|
||||
left:50%;
|
||||
transform: translate(-50%,-50%);
|
||||
z-index: 0;
|
||||
|
||||
padding: 10px;
|
||||
box-shadow: 0px 16px rgb(73, 62, 46);
|
||||
}
|
||||
|
||||
.page{
|
||||
font-size: 24px;
|
||||
position: absolute;
|
||||
width: 304px;
|
||||
height: 304px;
|
||||
padding:0%;
|
||||
top:50%;
|
||||
transform: translate(0,-50%);
|
||||
z-index: 2;
|
||||
border: none;
|
||||
background-color: rgb(165, 150, 127);
|
||||
|
||||
box-shadow: 0px 0px 4px 4px rgba(0, 0, 0, 0.2);
|
||||
|
||||
|
||||
}
|
||||
|
||||
#startpage{
|
||||
height: 500px;
|
||||
}
|
||||
|
||||
#pausepage{
|
||||
height: 400px;
|
||||
}
|
||||
|
||||
#aboutpage{
|
||||
height: 400px;
|
||||
}
|
||||
|
||||
#aboutpage p{
|
||||
font-size: 16px;
|
||||
margin-bottom: 4px;
|
||||
margin-top: 4px;
|
||||
}
|
||||
|
||||
#gameoverpage{
|
||||
height: 400px;
|
||||
}
|
||||
|
||||
button{
|
||||
cursor:pointer;
|
||||
font-size: 24px;
|
||||
border: none;
|
||||
font-family: "pixelFont";
|
||||
background-color: rgb(76, 189, 54);
|
||||
padding:16px;
|
||||
box-shadow: 0px 16px rgb(16, 53, 18);
|
||||
}
|
||||
|
||||
button:hover{
|
||||
transform: translate(0,8px);
|
||||
box-shadow: 0px 8px rgb(16, 53, 18);
|
||||
}
|
||||
|
||||
button:active{
|
||||
transform: translate(0,16px);
|
||||
box-shadow: 0px 0px rgb(14, 54, 16);
|
||||
}
|
||||
|
||||
.smallbutton{
|
||||
cursor:pointer;
|
||||
font-size: 16px;
|
||||
border: none;
|
||||
font-family: "pixelFont";
|
||||
background-color: rgb(189, 54, 54);
|
||||
padding:8px;
|
||||
box-shadow: 0px 8px rgb(53, 16, 16);
|
||||
}
|
||||
|
||||
.smallbutton:hover{
|
||||
transform: translate(0,4px);
|
||||
box-shadow: 0px 4px rgb(16, 53, 18);
|
||||
}
|
||||
|
||||
.smallbutton:active{
|
||||
transform: translate(0,8px);
|
||||
box-shadow: 0px 0px rgb(14, 54, 16);
|
||||
}
|
||||
|
||||
.aboutbutton{
|
||||
cursor:pointer;
|
||||
font-size: 24px;
|
||||
margin:-10px;
|
||||
width:50px;
|
||||
height:50px;
|
||||
border: none;
|
||||
font-family: "pixelFont";
|
||||
background-color: rgb(189, 54, 54);
|
||||
padding:8px;
|
||||
box-shadow: 0px 8px rgb(53, 16, 16);
|
||||
}
|
||||
|
||||
.aboutbutton:hover{
|
||||
transform: translate(0,4px);
|
||||
box-shadow: 0px 4px rgb(16, 53, 18);
|
||||
}
|
||||
|
||||
.aboutbutton:active{
|
||||
transform: translate(0,8px);
|
||||
box-shadow: 0px 0px rgb(14, 54, 16);
|
||||
}
|
||||
|
||||
.sharebutton{
|
||||
cursor:pointer;
|
||||
font-size: 24px;
|
||||
margin:-10px;
|
||||
height:50px;
|
||||
border: none;
|
||||
font-family: "pixelFont";
|
||||
background-color: rgb(54, 139, 189);
|
||||
padding:8px;
|
||||
box-shadow: 0px 8px rgb(16, 38, 53);
|
||||
}
|
||||
|
||||
.sharebutton:hover{
|
||||
transform: translate(0,4px);
|
||||
box-shadow: 0px 4px rgb(16, 38, 53);
|
||||
}
|
||||
|
||||
.sharebutton:active{
|
||||
transform: translate(0,8px);
|
||||
box-shadow: 0px 0px rgb(16, 38, 53);
|
||||
}
|
||||
|
||||
.box{
|
||||
|
||||
width:100%;
|
||||
/* Firefox */
|
||||
height: -moz-calc(100% - 16px);
|
||||
/* WebKit */
|
||||
height: -webkit-calc(100% - 16px);
|
||||
/* Opera */
|
||||
height: -o-calc(100% - 16px);
|
||||
/* Standard */
|
||||
height: calc(100% - 16px);
|
||||
box-shadow: 0px 16px rgb(65, 61, 57);
|
||||
|
||||
}
|
||||
|
||||
.slider {
|
||||
-webkit-appearance: none;
|
||||
width: 50%;
|
||||
height: 8px;
|
||||
background: black;
|
||||
outline: none;
|
||||
opacity: 0.7;
|
||||
-webkit-transition: .2s;
|
||||
transition: opacity .2s;
|
||||
}
|
||||
|
||||
.slider:hover {
|
||||
opacity: 1;
|
||||
}
|
||||
|
||||
.slider::-webkit-slider-thumb {
|
||||
-webkit-appearance: none;
|
||||
appearance: none;
|
||||
width: 16px;
|
||||
height: 16px;
|
||||
background: rgb(65, 61, 57);
|
||||
border-width: 4px ;
|
||||
border-color: black;
|
||||
border-radius: 0px;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.slider::-moz-range-thumb {
|
||||
width: 16px;
|
||||
height: 16px;
|
||||
background: rgb(65, 61, 57);
|
||||
border-width: 4px ;
|
||||
border-color: black;
|
||||
border-radius: 0px;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
|
||||
.logo.is-animation {
|
||||
margin-top: 0.6em;
|
||||
}
|
||||
|
||||
.logo.is-animation span {
|
||||
display: inline-block;
|
||||
animation: wave-text 1s ease-in-out infinite;
|
||||
}
|
||||
|
||||
.logo.is-animation span:nth-of-type(1) {
|
||||
animation-delay: 0.0s;
|
||||
}
|
||||
.logo.is-animation span:nth-of-type(2) {
|
||||
animation-delay: 0.1s;
|
||||
}
|
||||
.logo.is-animation span:nth-of-type(3) {
|
||||
animation-delay: 0.2s;
|
||||
}
|
||||
.logo.is-animation span:nth-of-type(4) {
|
||||
animation-delay: 0.3s;
|
||||
}
|
||||
.logo.is-animation span:nth-of-type(5) {
|
||||
animation-delay: 0.4s;
|
||||
}
|
||||
.logo.is-animation span:nth-of-type(6) {
|
||||
animation-delay: 0.50s;
|
||||
}
|
||||
.logo.is-animation span:nth-of-type(7) {
|
||||
animation-delay: 0.6s;
|
||||
}
|
||||
.logo.is-animation span:nth-of-type(8) {
|
||||
animation-delay: 0.7s;
|
||||
}
|
||||
|
||||
@keyframes wave-text{
|
||||
00%{
|
||||
transform: translateY(0em);
|
||||
}
|
||||
60%{
|
||||
transform: translateY(-0.6em);
|
||||
}
|
||||
100%{
|
||||
transform: translateY(0em);
|
||||
}
|
||||
}
|
||||
Loading…
Reference in a new issue