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 16:13:04

MixJuice GET URL : kidspod.club/mj/390

080

  • No registered tag exist.

SOURCE CODE

var i;
var cx;
var ex;
var ey;
var score;

i = 2;
cx = 12;
ex = 11;
ey = 1;
score = 0;

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

 if(i < 21){
  cls();
  while(i < 21){
   lc(10, i);
   log("|  |\n");
   i = i + 1;
  }
 }
 
 if(ey >= 21){
  lc(ex, ey - 1);
  log(" ");
  ex = rnd(2);
  ex = ex + 11;
  ey = 1;
 }
 
 lc(cx, 20);
 log("A");

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

 if(ey < 21){
  lc(ex, ey);
  log("V");
  ey = ey + 1;
 }
 
 lc(0, 0);
 log("SCORE: ");
 log(score / 10);
 score = score + 1;
 
 sleep(20);
}

COMMENT