Use left and right keys to move and space bar to jump. There's no goal, the robot is just happy to skip around his tiny little world.
function d(e,f,g){i=0;while(k=e.match(/\w\d*/g)[i++]){c.fillStyle=l[k[0]]||'000';c.f((+k[1]*G+((G-1)*-5)+f)*4,4*(+k[2]+g),4*G*((k[3]|0)+1),4*((k[4]|0)+1))}return d}m=n=o=p=q=r=0;l={37:-1,39:t=j=1,32:'if(!n)n=o=-4;0',w:'#fff',1:v='057w',2:'1702w26w354w542w63b64',3:'6702w56w054',4:v+'022w1104b12w432w5202b53w34',5:v+'1004w012b11'};b.onkeyup=b.onkeydown=function(e){j=(p=e.type[6]?eval(l[e.keyCode])^0||p:e.keyCode>36?0:p)||j};c.f=c.fillRect;u='w18w7';v='00245300241115430000254300243';setInterval("w=a.width/4;c.f(B=0,0,w*4,x=a.height);y=(Math.max(232,w+32)/8)|0;z=(x/8|0)-9;F=m+p;G=Math.floor(1+(s+F)/8)%y;while(G<0)G=y+G;E=!+v[G];_=+(t%18<9);if(E&&r==z||r<z){m=F;q=E?z:z-9}r+=r>z?-r:o++;if(r>q&&o>0){n=o=0;r=q}G=j;d('w1063b4101b6101'+['w29w69',u+7,u+8,u+9][H=n?2:p?t%4:0],C=s-4,D=+'6645'[H]+r+(E?_:0))('w106w2142b51b421',C,+'5455'[H]+D)('w00w80',C,+'7676'[H]+D);G=1;while(B<y){A=B++*8-m;while(A<-16)A+=y*8;while(A>w+8)A-=y*8;eval('d(\"b0777w'+(l[v[B]]||['081w271w481w671b069','291w081w691w481'][_])+'b\",A,z+3)')}t++",s=82)
ZnVuY3Rpb24gZChlLGYsZyl7aT0wO3doaWxlKGs9ZS5tYXRjaCgvXHdcZCovZylbaSsrXSl7Yy5maWxsU3R5bGU9bFtrWzBdXXx8JzAwMCc7Yy5mKCgra1sxXSpHKygoRy0xKSotNSkrZikqNCw0Kigra1syXStnKSw0KkcqKChrWzNdfDApKzEpLDQqKChrWzRdfDApKzEpKX1yZXR1cm4gZH1tPW49bz1wPXE9cj0wO2w9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zA4MXc2OTF3NDgxJ11bX10pKydiXCIsQSx6KzMpJyl9dCsrIixzPTgyKQ==
/**
* This is the code I had before I started minifying by hand.
* I changed some values during my final tweaks but I think this source gives you a rough idea of how I've set things up.
*
* If you have any questions just send me a tweet: @rvmook
**/
function drawSquare(charString,offsetX,offsetY,fakeDirection){
fakeDirection=fakeDirection||direction;
i=0;
while(square=charString.match(/\w\d*/g)[i++]) {
c.fillStyle=objReference[square[0]];
c.f((+square[1]*fakeDirection+((fakeDirection-1)*-5)+offsetX)*4,4*(+square[2]+offsetY),(fakeDirection*((square[3]|0)+1))*4,4*((square[4]|0)+1))
}
return drawSquare
}
worldOffset=isJumping=velY=velX=destY=posY=0;
objReference={
//key handling
37:-1,
39:counter=direction=1,
32:'if(!isJumping)isJumping=velY=-4;0',
// colors
b:'#000',
w:'#fff',
// tiles
1:'057',
2:'1702w26w354w542w63b64',
3:'6702w56w054',
4:'057w022w1104b12w432w5202b53w34',
5:'057w1004w012b11'
};
b.onkeyup=b.onkeydown=function(e){
direction=(velX=e.type[6]?eval(objReference[e.keyCode])^0||velX:e.keyCode>36?0:velX)||direction;
}
c.f=c.fillRect;
feetPart='w18w7';
tiles='00245300241115430000254300243';
setInterval(function(){
cWidth=a.width/4;
cHeight=a.height/4|0;
worldWidth =Math.floor(Math.max(tiles.length*8,cWidth+32)/8);
SWIM_DEST=cHeight/2-6;
// hit detection
newWorldOffset = worldOffset+velX;
actualX=Math.floor(1+(posX+newWorldOffset)/8)%worldWidth;
while(actualX<0) actualX = worldWidth+actualX;
isWater=!+tiles[actualX];
//if in water, don't move if next tile == land
if(isWater && posY==SWIM_DEST || posY < SWIM_DEST) {
worldOffset=newWorldOffset;
destY=isWater?SWIM_DEST:SWIM_DEST-11;
}
posY+=velY++;
if(posY>destY&&velY>0) {
isJumping=velY=0;
posY=destY;
}
// clear (last draw thing should make fill color black
c.f(index=0,0,cWidth*4,cHeight*4);
// robot
drawSquare('w1063b4101b6101'+['w29w69',feetPart+7,feetPart+8,feetPart+9][step=isJumping?2:velX?counter%4:0],posX-4,ry=+'6645'[step]+posY)
('w106w2142b51b421',posX-4,+'5455'[step]+ry)
('w00w80',posX-4,+'7676'[step]+ry);
// world
while(index<worldWidth){
tileX=index++*8-worldOffset;
while(tileX<-16)tileX+=worldWidth*8;
while(tileX>cWidth+8)tileX-=worldWidth*8;
eval('drawSquare(\"b0777w'+(objReference[tiles[index]]||['081w271w481w671','291w081w691w481'][+(counter%18<9)])+'b\",tileX,cHeight/2-5,1)');
}
counter++;
},posX=90);