Enjoy programming more!
Kidspod is a post site which supports young programmers.
First step to join us.
Register as a member
For members

2017/12/01 15:14:54

MixJuice GET URL : kidspod.club/mj/438

090

  • No registered tag exist.

SOURCE CODE

cls();

var cx;
var cy;
var cf;
var cs;
var cv; 
var t;
var key;
var gf;
var px;
var py;
var wc;
var wx;
var bc;
var bx;
var by;
var i;

cf = 0;
cs = 0;
cv = 0;
t = 0;
wc = 2;
gf = 0;
bc = 0;
by = 0;
i = 0;
j = 0;

cx = 1;
cy = 4;

px = rnd(32);
py = (rnd(5) + 1) * 4;

while(i < 5){
 by = by + 4;
 while(j < 31){
  while(bc < 1){
   bx = rnd(10) + j;
   if(((cx == bx) * (cy == by)) + ((px == bx) * (py == by))){}
   else{
    lc(bx, by);
    log("#");
    bc = bc + 1;
   }
  }
  bc = 0;
  j = j + 10;
 }
 j = 0;
 i = i + 1;
}

lc(px, py);
log("$");

while(1){
 wx = 0;
 while(wx < 32){
  lc(wx, 5);
  log("=");
  lc(wx, 9);
  log("=");
  lc(wx, 13);
  log("=");
  lc(wx, 17);
  log("=");
  lc(wx, 21);
  log("=");
  wx = wx + 1;
 }
 
 lc(0, 0);
 log("TIME:");
 log(t / 20);

 key = inkey();
 if((key == 28) * (cs == 0)){
  cf = 1;
 }
 if((key == 29) * (cs == 0)){
  cf = 2;
 }
 if((key == 30) * (cs == 0) * (cy >= 8)){
  lc(cx, cy);
  log(" ");
  cy = cy - 4;
 }
 if((key == 31) * (cs == 0) * (cy <= 16)){
  lc(cx, cy + 1);
  log(" ");
  cv = 3;
 }

 if(scr(cx, cy + 1) != 61){
  if(cv >= 3){
   lc(cx, cy);
   log(" ");
   cy = cy + 1;
   cs = cs + 1;
   cv = - 1;
  }
  cv = cv + 1;
 }
 
 if((cf == 1) * (cs == 0)){
  if(cx > 0){
   cx = cx - 1;
   lc(cx + 1, cy);
   log(" ");
  }
 }
 if((cf == 2) * (cs == 0)){
  if(cx < 31){
   cx = cx + 1;
   lc(cx - 1, cy);
   log(" ");
  }
 }
 
 if(cs == 4){
  cs = 0;
 }

 if((cx == px) * (cy == py)){
  break;
 }

 if(scr(cx, cy) == 35){
  gf = 1;
  break;
 }
 
 lc(cx, cy);
 log("K");

 lc(cx, cy - 1);
 log(" ");
 t  = t + 1;
 sleep(100);
}

cls();
if(gf == 0){
 lc(10, 11);
 log("GAME CLEAR!!");
 lc(12, 13);
 log("TIME: ");
 log(t / 20);
}
else{
 lc(10, 12);
 log("GAME OVER!");
}

COMMENT