- Author:
- Christoph Sassenberg
- Twitter:
- @
- GitHub:
- Facebook:
- Google+:
- +
- Reddit:
- /r/
- Pouet:
- Website:
- defsprite.com
- Compo:
- classic
- Demo link:
- https://js1k.com/2011-trail/demo/961
- Shortlink:
- https://js1k.com/961
- Blog post:
- please update here!
- Bytes:
- 1018
- Chars:
- 1018
- Submission
for(p in a)a[p[0]+(p[6]||p.length)]=a[p];c.width=w=800;c.height=h=600;M=Math;R=M.random;d=0.1;q=y=h/2;f=s=u=t=r=x=i=0;Q=10;m=w/Q;Y=w/2;W=180;g=4;p=[];for(;i++<20;p.push(y));z="#6301#3601#FC01round1You have died of dysentery!1 steps".split(1);with(a){S=function(r,t,y){s4();ba();ta(x+t,y);r6(r);m6(0,0);bC(-Q,-5,-Q,15,0,Q);m6(5,0);bC(40,-Q,40,20,5,Q);f4();re();};I=setInterval(function(){s4();if(M.abs(p[7]-y)>W/2){ba();fillStyle=z[0];ta(Y+m,y);m6(0,0);for(i=0;i++<7;r=R()+1,r6(1),bC(50*r,-35*r,50*r,35*r,Q,5));f4();re();s5(4,4);fx(z[4],9,20);clearInterval(I);return;}fillStyle=z[1];fc(0,0,w,h);re();s4();ta(Q,15);fx(f+z[5],0,0);re();lineWidth=W;lineJoin=z[3];strokeStyle=z[2];ba();m6(0,p[0]);P=p.length;for(i=0;i<P;l6((i-1)*m+x,p[i++]));s6();re();x-=g;if(x<=-m){i=p[P-1]+((0.5-R())*110);P>Q?p=p.slice(1,P):0;p.push(M.min(500,M.max(i,100)));t=r;q=y;r=0.3*u+(s?d:-d);y+=30*u+(s?20:-20);s=!s;u=f%50;u?0:W-=5;u?0:g++;x=u=0;f++;}S(t,Y,q);S(r,Y+m,y);},25);}onkeydown=function(e){k=40-e.keyCode;e.type[5]&&k>=0&&k<3?u=1-k:0;}
- Description
- Stay on the Oregon Trail - or you will die of dysentery!
Use the up and down arrow keys to stay on the trail.
But beware: the trail gets narrow and steep the further you go.
Have fun!
- Base64 encoded
Zm9yKHAgaW4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big1MDAsTS5tYXgoaSwxMDApKSk7dD1yO3E9eTtyPTAuMyp1KyhzP2Q6LWQpO3krPTMwKnUrKHM/MjA6LTIwKTtzPSFzO3U9ZiU1MDt1PzA6Vy09NTt1PzA6ZysrO3g9dT0wO2YrKzt9Uyh0LFkscSk7UyhyLFkrbSx5KTt9LDI1KTt9b25rZXlkb3duPWZ1bmN0aW9uKGUpe2s9NDAtZS5rZXlDb2RlO2UudHlwZVs1XSYmaz49MCYmazwzP3U9MS1rOjA7fQ==
- Original source
for (p in a) a[p[0] + (p[6] || p.length)] = a[p];
c.width = w = 800;
c.height = h = 600;
M = Math;
R = M.random;
d = 0.1;
q = y = h / 2;
f = s = u = t = r = x = i = 0;
Q = 10;
m = w / Q;
Y = w / 2;
W = 180;
g = 4;
p = [];
for (; i++ < 20; p.push(y));
z = "#6301#3601#FC01round1You have died of dysentery!1 steps".split(1);
with (a) {
S = function(r, t, y) {
s4();
ba();
ta(x + t, y);
r6(r);
m6(0, 0);
bC(-Q, -5, -Q, 15, 0, Q);
m6(5, 0);
bC(40, -Q, 40, 20, 5, Q);
f4();
re();
};
I = setInterval(function() {
s4();
if (M.abs(p[7] - y) > W / 2) {
ba();
fillStyle = z[0];
ta(Y + m, y);
m6(0, 0);
for (i = 0; i++ < 7; r = R() + 1,r6(1),bC(50 * r, -35 * r, 50 * r, 35 * r, Q, 5));
f4();
re();
s5(4, 4);
fx(z[4], 9, 20);
clearInterval(I);
return;
}
fillStyle = z[1];
fc(0, 0, w, h);
re();
s4();
ta(Q, 15);
fx(f + z[5], 0, 0);
re();
lineWidth = W;
lineJoin = z[3];
strokeStyle = z[2];
ba();
m6(0, p[0]);
P = p.length;
for (i = 0; i < P; l6((i - 1) * m + x, p[i++]));
s6();
re();
x -= g;
if (x <= -m) {
i = p[P - 1] + ((0.5 - R()) * 110);
P > Q ? p = p.slice(1, P) : 0;
p.push(M.min(500, M.max(i, 100)));
//p.push(i>h*0.8?h*0.8:i<h*0.2?h*0.2:i);
t = r;
q = y;
r = 0.3 * u + (s ? d : -d);
y += 30 * u + (s ? 20 : -20);
s = !s;
u = f % 50;
u ? 0 : W -= 5;
u ? 0 : g++;
x = u = 0;
f++;
}
S(t, Y, q);
S(r, Y + m, y);
}, 25);
}
onkeydown = function(e) {
k = 40 - e.keyCode;
e.type[5] && k >= 0 && k < 3 ? u = 1 - k : 0;
};