- Author:
- z0va
- Twitter:
- @
- GitHub:
- Facebook:
- Google+:
- +
- Reddit:
- /r/
- Pouet:
- Website:
- weexord.org
- Compo:
- classic
- Demo link:
- https://js1k.com/2010-first/demo/803
- Shortlink:
- https://js1k.com/803
- Blog post:
- please update here!
- Bytes:
- 1024
- Chars:
- 1024
- Submission
x=9;y=336;z=10;K=[];L=[[20,290]];p=document.body.children[X=Y=J=T=V=0];p.width=W=224;p.height=H=352;q=p.getContext('2d');function R(x,y,w,h,c){q.fillStyle=c;q.fillRect(x,y,w,h)}function C(a,b){j=(b>336)?0:q.getImageData(a,b,1,1).data;if(j[0]==255&!j[1]&!j[2])return 1;return}function P(y){if(y>40){e=r(30,134);f=y-r(40,80);L.push([e,f])}}function r(a,b){return a+Math.round(Math.random()*(b-a))}setInterval(function(){if(!V){T++;s=(T>300)?1:0;if(s)y++;a=x+X;b=a+15;if(a<0)x=X=0;if(b>W){x=208;X=0}x+=X;y+=Y;O=0;if(Y>=0){m=5;while(m<14){c=y+15;if(C(a,c)||C(b,c)){g=C(a,c)?a:b;while(C(g,y+14))y--;O=1;m=14}m+=4}if(y>=336){if(!s){O=1;y=336}else V=1}}if(O)Y=J=0;else if(Y<11)Y++;R(0,0,W,H,'#9CF');R(x,y,16,16,'#000');P(L[L.length-1][1]);for(I in L){if(s)L[I][1]+=1;R(L[I][0],L[I][1],60,16,'red')}}},20);onkeydown=function(e){Z(e,1)};onkeyup=function(e){Z(e,0)};function Z(e,u){E=e.keyCode;if(!E-37>>2){if(E==38){if(!J&Y<=1){J=1;Y=-14}}else{j=K.indexOf(E);if(j>-1)K.splice(j,1);!u?E=K[K.length-1]:K.push(E);X=E^37?E^39?0:2:-2}}}
- Description
- v3.0 Game is now a "papy jump" like
You have ~3s before scrolling start
GO UP guy ! :)
v2.0 Modify color scheme
Fixed jumping bugs
Added max Y speed
Added some optimizations
- Base64 encoded
eD05O3k9MzM2O3o9MTA7Sz1bXTtMPVtbMjAsMjkwXV07cD1kb2N1bWVud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l1cD1mdW5jdGlvbihlKXtaKGUsMCl9O2Z1bmN0aW9uIFooZSx1KXtFPWUua2V5Q29kZTtpZighRS0zNz4+Mil7aWYoRT09Mzgpe2lmKCFKJlk8PTEpe0o9MTtZPS0xNH19ZWxzZXtqPUsuaW5kZXhPZihFKTtpZihqPi0xKUsuc3BsaWNlKGosMSk7IXU/RT1LW0subGVuZ3RoLTFdOksucHVzaChFKTtYPUVeMzc/RV4zOT8wOjI6LTJ9fX0NCg==
- Original source
// Init Datas
x = 9;
y = 336;
z = 10;
K = [];
L = [[20,290]];
// Scene
p = document.body.children[X=Y=J=T=V=0];
p.width = W = 224;
p.height = H = 352;
q = p.getContext('2d');
// Functions
// Draw rectangle
function R(x,y,w,h,c){
q.fillStyle = c;
q.fillRect(x,y,w,h);
}
// Check pixel color at (a;b)
function C(a,b){
j = (b > 336) ? 0 : q.getImageData(a,b,1,1).data;
if(j[0] == 255 & !j[1] & !j[2]) return 1;
return;
}
// Generate new platform
function P(y){
if (y > 40) {
e = r(30,134);
f = y - r(40,80);
L.push([e,f]);
}
}
// Generate random number (interval = (a;b))
function r(a,b){return a + Math.round(Math.random() * (b - a));}
// Game loop
setInterval(
function(){
if (!V) {
T++;
s = (T > 300) ? 1 : 0;
if (s) y++;
a = x + X;
b = a + 15;
// Horizontal limits
if(a < 0) x=X=0;
if(b > W){
x=208;
X=0;
}
// Update position
x += X;
y += Y;
O = 0;
if (Y >= 0) {
m = 5;
while (m < 14) {
c = y + 15;
if(C(a,c) || C(b,c)){
g = C(a,c) ? a : b;
while (C(g,y + 14)) y--;
O = 1;
m = 14;
}
m += 4;
}
if (y >= 336) {
if (!s) {
O = 1;
y = 336;
}
else V=1;
}
}
if (O) Y=J=0;
else if (Y < 11) Y++;
// Draw scene
R(0,0,W,H,'#9CF');
R(x,y,16,16,'#000');
// Add new platform and draw platforms
P(L[L.length-1][1]);
for (I in L) {
if (s) L[I][1] += 1;
R(L[I][0],L[I][1],60,16,'red');
}
}
},
20
);
// Keyboard events
onkeydown = function(e){Z(e,1);};
onkeyup = function(e){Z(e,0);};
function Z(e,u){
E = e.keyCode;
if(!E-37 >> 2){
if(E == 38) {
if (!J & Y <= 1) {
J = 1;
Y = -14;
}
}
else {
j = K.indexOf(E);
if(j > -1) K.splice(j,1);
!u ? E = K[K.length-1] : K.push(E);
X = E^37 ? E^39 ? 0 : 2 : -2;
}
}
}