- Author:
- Andrey Shuster
- Twitter:
- @
- GitHub:
- Facebook:
- Google+:
- +
- Reddit:
- /r/
- Pouet:
- Website:
- Compo:
- classic
- Demo link:
- https://js1k.com/2014-dragons/demo/1722
- Shortlink:
- https://js1k.com/1722
- Blog post:
- please update here!
- Bytes:
- 1016
- Chars:
- 1014
- Submission
var X=70,Y='fillStyle',d=X,e=X,f=0,h=3,k=0,l=0,m=[],n=!0,p,q,r=Date.now(),s=c.fillText.bind(c),t=Math.random,u,v,w=2*Math.PI;c.font="30px Arial";b.onkeydown=function(y){k=(y.keyCode-38)%2;l=(y.keyCode-39)%2;d+=X*k;e+=X*l;X>d&&(d=X);X>e&&(e=X);630<d&&(d=630);560<e&&(e=560);X<d&&!m[e/X-1][d/X-2]&&(h--,d=e=X);d/X-2==px&&e/X-1==py&&(f++,x())};function x(){px=~~(8*t())+0;py=~~(8*t())+0;0==m[py][px]&&(m[py][px]=3)}for(u=8;u--;)for(m[u]=[],v=8;v--;)m[u][v]=~~(6*t())+0;x();(g=function(){c[Y]="#34495e";c.fillRect(0,0,a.width,a.height);c[Y]="#2980b9";c.fillRect(90,0,610,630);c.fill();p=Date.now();q=p-r;c[Y]="#27ae60";for(u=8;u--;)for(v=8;v--;)3e3<q&&(m[u][v]+=~~(3*t())+-1,0>m[u][v]&&(m[u][v]=0),5<m[u][v]&&(m[u][v]=5),x(),r=p),c.beginPath(),c.arc(X+X*(v+1),X*(u+1),6*m[u][v],0,w,!0),c.fill();c[Y]="#e74c3c";c.beginPath();c.arc(X+X*(px+1),X*(py+1),6,0,w,!0);c.fill();c[Y]="#f1c40f";c.beginPath();k=l=0;s("☻",d-16,e+8);h?s("Score "+f+" Lives "+h,90,660):(n=!1,s("Game over",770,30));n&&requestAnimationFrame(g)})();
- Description
- Toppler clone, was popular in Russia by the name "Perestroyka"
Move around the field and collect red dots to get high score
- Base64 encoded
dmFyIFg9NzAsWT0nZmlsbFN0eWxlJyxkPVgsZT1YLGY9MCxoPTMsaz0wLGw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SksNiwwLHcsITApO2MuZmlsbCgpO2NbWV09IiNmMWM0MGYiO2MuYmVnaW5QYXRoKCk7az1sPTA7cygi4pi7IixkLTE2LGUrOCk7aD9zKCJTY29yZSAiK2YrIiAgIExpdmVzICIraCw5MCw2NjApOihuPSExLHMoIkdhbWUgb3ZlciIsNzcwLDMwKSk7biYmcmVxdWVzdEFuaW1hdGlvbkZyYW1lKGcpfSkoKTs=
- Original source
var S = 70, x = S, y = S,
sc = 0, // sc = score
l = 3, // l = lives
dx = 0, dy = 0,
t = [], // t = tiles
iG = true,
now, delta, then = Date.now(),
f = "fillStyle",
fr = "fillRect",
bp = "beginPath",
k = "keyCode",
o = c.fillText.bind(c),
mr = Math.random,
t1,
i, j, z = 2*Math.PI, sp = ' '
c.font = "30px Arial"
b.onkeydown = function(e) {
dx = (e[k] - 38) % 2, dy = (e[k] - 39) % 2;
x = x + (dx * S)
y = y + (dy * S)
// left and top
if (x < S) x = S
if (y < S) y = S
// right and bottom
if (x > S * 9) x = S*9
if (y > S * 8) y = S*8
// check if leaf under player
if (x > S) {
if (!t[y/S-1][x/S-2]) {
l--;
x = y = S
}
}
if (x/S-2 == px && y/S-1 == py) {
sc++;
dot()
}
}
function dot() {
px = rnd(0, 7), py = rnd(0, 7)
if (t[py][px] == 0) t[py][px] = 3
}
function rnd(min, max) {
return ~~(mr() * (max - min + 1)) + min
}
function init() {
for (i=8;i--;) {
t[i] = []
for (j=8;j--;) {
t[i][j] = rnd(0, 5)
}
}
dot()
}
init();
(g = function() {
// clear()
c[f] = "#34495e";
c[fr](0, 0, a.width, a.height)
c[f] = "#2980b9"
c[fr](90, 0, 610, 630)
c.fill()
now = Date.now()
delta = now - then
c[f] = "#27ae60"
for (i=8;i--;) {
for (j=8;j--;) {
if (delta > 3000) {
t[i][j] += rnd(-1, 1)
if (t[i][j] < 0) t[i][j] = 0
if (t[i][j] > 5) t[i][j] = 5
dot()
then = now
}
c[bp]()
c.arc(S+S*(j+1), S*(i+1), 6*t[i][j], 0, z, true)
c.fill()
}
}
c[f] = "#e74c3c"
c[bp]()
c.arc(S+S*(px+1), S*(py+1), 6, 0, z, true)
c.fill()
//drawPlayer()
c[f] = "#f1c40f"
c[bp]()
dx = dy = 0
o("\u263b", x-16, y+8)
//drawScores()
if (l) o("Score "+sc+sp+"Lives "+l, 90, 660)
else {
iG = false;
o("Game over", 770, 30)
}
if (iG) requestAnimationFrame(g)
})()