- Author:
- Frank Force
- Twitter:
- @
- GitHub:
- Facebook:
- Google+:
- +
- Reddit:
- /r/
- Pouet:
- Website:
- frankforce.com
- Compo:
- pure
- Demo link:
- https://js1k.com/2019-x/demo/4155
- Shortlink:
- https://js1k.com/4155
- Blog post:
- please update here!
- Bytes:
- 1017
- Chars:
- 1017
- Submission
for(_='0,Z};Y=1X+=W";V]=Ua[e++UQ;)QPR(OO2)K=[]J;++Ior(<bRecord-1=0;r+u":"[0]=function(a){"\\u><font );.shift(Math.olor=Yb.onkey+" meters;H[p++U;H=g[h-k]"&&( oW".lengthQ26abVe<;setTimeout(F,r>";fd[a.keyCode%37UPO9)?25b2."F){if(c)d[13]&&L(else{p=f."" "".VglC(nWm=d[2]-d;o=m?0>m?"/\\\\|Vf=p=nc#0F0>"+o00b0"o+"</font></b>VM=2>r?1:t<=?:O50)?K?1::M;rWK*M;O9) u<-30*v&Ou5)|30<u*v&O45-u) v*=),K&1<r|t<+v r-=v),uWvo="<nobrface=courier c#FFF>"yy<hIy){fxx<wIx)oWg[y][x];}ig>ig>;: "+Nr>IE-k>N New !E>k+10&(l>=n|l[1]<n) N=max(E-=k,N),>"+E,cXb.innerHTML=o}b.style.backgroundC"#000"99>E?50-E/3:16)YL){tX12;rX;u=t-3;Mv=;n=t/2;E=;c=0YCaJvar ee<r+1PE<=N&E>N-6&(e+E)%2?"x":E%100?" -"t+2;e<wP"V0==E%10 a[t+3UEl<k l[lU[r,]g[gUadown1up0YRreturn!(flo1E6*random())%a)Yvar d=[ZZ0],lJ,gJ,wX2Zh=3ZkX3,N=5,t,r,u,M,v,n,f=ZE,c;L()16)i=h+1;--i;)C(';G=/[^ -HL-NRT[-}]/.exec(_);)with(_.split(G))_=join(shift());eval(_)
- Description
- Ski for your life! Use arrow keys to move. Press enter to restart after dying.
- Base64 encoded
Zm9yKF89JzAsWn07WT0xWCs9VyI7Vl09VWFbZSsrVVE7KVFQUihPTzIpSz1bXUo7KytJb3IoHzxiHlJlY29yZB0tMR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SklYSlZdmFyIGQ9W1paMF0sbEosZ0osd1gyWmg9M1prWDMsTj01LHQscix1LE0sdixuLGY9WkUsYztMKCkFMTYpA2k9aCsxOy0taTspQygTJztHPS9bXiAtSEwtTlJUWy19XS8uZXhlYyhfKTspd2l0aChfLnNwbGl0KEcpKV89am9pbihzaGlmdCgpKTtldmFsKF8p
- Original source
// TINY SKI
// By Frank Force - 2019
G=function(a)
{
if (gameOver)
{
if (playerControls[13])
X();
}
else
{
// update player
p = playerPosLast, P = screenBuffer[height-playerHeight];
P[p++] = ".";
P[p++] = " ";
P[p++] = ".";
// shift the array
screenBuffer.shift();
trackMemory.shift();
A();
playerPos += m = playerControls[2] - playerControls[0];
o = m? m<0? "/" : "\\" : "|";
p = playerPos-1;
playerPosLast = p;
P = screenBuffer[height-playerHeight];
P[p++] = "<b><font color=#0F0>"+o;
P[p++] = "°";
P[p++] = o + "</font></b>";
// update track
trackDirection=trackLeft<2?1:trackMaxWidth<=trackLeft+trackWidth?-1:R(50)?(R(2)?1:-1):trackDirection;
trackLeft+=R(2)*trackDirection;
if (R(9))
{
if (trackWidth<-30*trackWidthDirection & R(trackWidth-15) | 30<trackWidth*trackWidthDirection&R(45-trackWidth))
trackWidthDirection *= -1;
if ((R(2) & trackLeft > 1) | trackMaxWidth<trackLeft+trackWidth+trackWidthDirection)
trackLeft-=trackWidthDirection;
trackWidth+=trackWidthDirection;
}
// dump output
o = "<nobr><font face=courier color=#FFF>"
for(y=0;y<height;++y)
{
for(x=0;x<width;++x)
o += screenBuffer[y][x];
o += "<br>";
}
o += "<big><big><br>"
o += "Record: " + bestDistance + " meters<br><br>";
if (++distance-playerHeight > bestDistance)
o += "New Record!<br>";
if (distance > playerHeight+10 & (trackMemory[0][0] >= playerPos | trackMemory[0][1] < playerPos))
{
bestDistance = Math.max(distance-=playerHeight, bestDistance);
o += "<b>" + distance + " meters<br>"
gameOver = 1;
}
b.innerHTML = o;
}
b.style.backgroundColor = "#000";
setTimeout(G,distance<99?50-distance/3:16);
}
X=function(a)
{
trackMaxWidth = 112;
trackLeft = 1;
trackWidth = trackMaxWidth-3;
trackDirection = 0;
trackWidthDirection = -1;
playerPos = trackMaxWidth/2;
distance = -1;
gameOver = 0;
}
A=function(a)
{
var a = [], x = 0;
while(x<trackLeft)
a[x++] = R(9)? "▲" : ".";
a[x++] = "⚫";
while(x<trackLeft+trackWidth+1)
a[x++] = distance<=bestDistance&distance>bestDistance-6 & (x+distance)%2?"x":distance%100?" ":"-";
a[x++] = "⚫";
while(x<trackMaxWidth+2)
a[x++] = R(9)? "▲" : ".";
while(x<width)
a[x++] = "";
if (distance%10 == 0)
a[trackMaxWidth+3] = distance;
if (trackMemory.length < playerHeight)
trackMemory[trackMemory.length] = [trackLeft, trackLeft+trackWidth];
screenBuffer[screenBuffer.length] = a;
}
b.onkeydown = function(a) {playerControls[a.keyCode%37]=1;}
b.onkeyup = function(a) {playerControls[a.keyCode%37]=0;}
R=function(a){return !(Math.floor(Math.random() * 1000000) % a);}
var playerControls = [0,0,0], trackMemory = [], screenBuffer = [], width = 120, height = 30, playerHeight = 13, bestDistance = 5, trackMaxWidth, playerHeight, trackLeft, trackWidth, trackDirection, trackWidthDirection, playerPos, playerPosLast=0, distance, gameOver;
X();
setTimeout(G,16)
for (i = height+1; --i;) A();