var c_x=15; var c_c=128; var x=0,y=10; function step(){ x=x+1; var chara=251+x%2; lc(x-1,y);log(" "); lc(x,y);log(chr(chara)); } function record(m){ lc(13,15);log(m," meters\n"); } function byeEnd(){ var cata_y=y+1; while(cata_y<23){ cata_y=cata_y+1; lc(c_x,cata_y-1);log(" "); lc(c_x,cata_y);log(chr(c_c)); sleep(50); } lc(c_x,cata_y);log(" "); record(0); exit(0); } function thrEnd(){ while(x<31){ step(); sleep(200); } record(0); exit(0); } function bend(){ var chara=250; var down=1; var pow=0; while(down){ pow=pow+3; y=y+1; lc(x,y-1);log(" "); lc(x,y);log(chr(chara)); lc(x,y+1);log(chr(c_c)); if(y>22){ down=0; pow=0; } sleep(200); down=btn(); } return pow; } function extend(pow){ var chara=249; var high=0; while(pow>0){ if(y>10){ y=y-1; lc(x,y);log(chr(chara)); lc(x,y+1);log(chr(c_c)); lc(x,y+2);log(" "); }else{ lc(rnd(31),0);log(chr(chara)); scroll(2); lc(x,y);log(chr(chara)); lc(x,y+1);log(" "); pow=pow-(rnd(pow)%3==0); } high=high+1; sleep(50); } return high; } function fall(){ var chara=249; while(y<23){ y=y+1; lc(x,y-1);log(" "); lc(x,y);log(chr(chara)); sleep(100); } lc(x,y);log(" "); } function jumping(){ var pow=bend(); var high=extend(pow); fall(); record(high); exit(0); } function gnd(){ var g_x=0,g_y=y+1; while(g_x<32){ var g_c=143; if(g_x==c_x) g_c=c_c; lc(g_x,g_y);log(chr(g_c)); g_x=g_x+1; } } cls(); gnd(); while(1){ step(); sleep(300); if(x<c_x){ if(btn()==1) byeEnd(); } // else if if(x==c_x){ if(btn()==1) jumping(); } // else if if(c_x<x){ thrEnd(); } }