cls(); var frame = 0; var delay; var myx = 15, myy = 22; var key = 0; var r; var life = 3; var i = 1; var time = 60; var score = 0; lc(7,11); log("PUSH ENTER START!!"); while(key != 10){ key = inkey(); } cls(); while(1){ delay = tick(); lc(0, 0); log(" "); lc(10, 0); log(" "); lc(20, 0); log(" "); lc(myx, myy); log(" "); if((frame % 3) == 0){ lc(rnd(32), 0); r = rnd(5); if(r == 0){ log(chr(0xE5)); } if(r == 1){ log(chr(0xEE)); } if(r == 2){ log(chr(0xED)); } if(r == 3){ log(chr(0xF7)); } if(r == 4){ log(chr(0xEC)); } scroll(2); } if((frame % 2) == 0){ key = inkey(); if(key == 29){ if(myx < 30){ myx = myx + 1; } } if(key == 28){ if(myx > 0){ myx = myx - 1; } } } if(scr(myx, myy) == 0xE5){ if(life < 3){ life = life +1; } } if(scr(myx, myy) == 0xEE){ time = time + 5; if(time > 999){ time = 999; } } if(scr(myx, myy) == 0xED){ score = score + 1; if(score > 9999){ score = 9999; } } if(scr(myx, myy) == 0xF7){ life = life - 1; } if(scr(myx, myy) == 0xEC){ life = life - 2; } if((frame % 20) == 0){ time = time - 1; } if((life < 1) + (time < 0)){ break; } if((frame % 2) == 0){ lc(myx, myy); log(chr(0xF9)); } else{ lc(myx,myy); log(chr(0xFA)); } lc(0,0); log("LIFE:"); while(i <= life){ log(chr(0xE5)); i = i +1; } i = 1; lc(10, 0); log("TIME:",time); lc(20, 0); log("SCORE:",score); frame = frame +1; delay = tick() - delay; sleep(50 - delay); } cls(); lc(10,10); log("GAME OVER!!"); lc(10,12); log("SCORE:", score, "\n");
ライフと時間の両方を気にしなければならないところが忙しくて、そして面白いです! 4種類のアイテムがどんどん出てくるのも賑やかで楽しいですね。ハートを取ろうとあせるあまり、お化けを取って思わず「しまった!」