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/03 10:13:16

MixJuice GET URL : kidspod.club/mj/440

092

  • No registered tag exist.

SOURCE CODE

var nx;
var flag;
var sy;
var key;
var score;
var i;
var a;

sy = 22;
nx = 0;
flag = 0;
score = 0;

while(1){
 if((nx == 15) * (sy != 22)){
  score = score + 1;
 }
 
 key = inkey();
 if((key == 32) * (sy == 22)){
  sy = sy - 5;
 }
 if(sy < 22){
  sy = sy + 1;
 }

 i = rnd(10);
 if(flag == 0){
  if((nx < 30) * (i <= 2) * (nx != 14)){
   nx = nx + 2;
  }
  if((nx < 30) * (i > 2) + (nx == 14)){
   nx = nx + 1;
  }
  if(nx >= 30){
   nx =nx - 1;
   flag = 1;
  }
 }
 else{
  if((nx > 0) * (i <= 2) * (nx != 16)){
   nx = nx - 2;
  }
  if((nx > 0) * (i > 2) + (nx == 16)){
   nx = nx - 1;
  }
  if(nx <= 0){
   nx = nx + 1;
   flag = 0;
  }
 }
 cls();
 lc(0, 0);
 log("SCORE:");
 log(score);
 lc(nx, 22);
 log("_");
 lc(15, sy);
 log(chr(0xEC));

 if((nx ==15 )*(sy == 22)){
  lc(11, 12);
  log("GAME OVER");
  break;
 }

 sleep(40);
}

COMMENT