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

2017/10/31 10:39:38

MixJuice GET URL : kidspod.club/mj/389

079

  • No registered tag exist.

SOURCE CODE

var wx;
var wy;
var wy_max;
var cx;
var cy;
var ex;
var ey;

wx = 10;
wy = 1;
wy_max = 20;
cx = 12;
cy = 20;
ex = 11;
ey = 1;

while(1){
 key = inkey();
 lc(cx, cy);
 log(" ");
 if((key == 28) * (cx > 11)){
  cx = cx - 1;
 }
 if((key == 29) * (cx < 12)){
  cx = cx + 1;
 }

 if(wy <= wy_max){
  cls();
  while(wy <= wy_max){
   lc(wx, wy);
   log("|  |");
   wy = wy + 1;
  }
 }
 
 if(ey > wy_max){
  lc(ex, ey - 1);
  log(" ");
  ex = rnd(2);
  ex = ex + 11;
  ey = 1;
 }
 
 lc(cx, 20);
 log("A");

 if((ey - 1) <= wy_max){
  lc(ex, ey - 1);
  log(" ");
 }

 if(ey <= wy_max){
  lc(ex, ey);
  log("V");
  ey = ey + 1;
 }
 
 sleep(20);
}

COMMENT