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

2017/11/19 10:33:40

MixJuice GET URL : kidspod.club/mj/429

085

  • No registered tag exist.

SOURCE CODE

var sy;
var key;
var nx;
var flag;
var score;
var jflag;

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

while(1){
 if((nx == 15)*(sy == 22)){
  break;
 }
 key = inkey();
 if((key == 32) * (jflag == 0)){
  sy = sy - 3;
  jflag = 1;

 }
 if(sy < 22){
  sy = sy + 1;
  if(sy == 22){
   jflag = 0;
  }
 }
 cls();
 lc(15, sy);
 log(chr(0xF9));

 if(flag == 0){
  if(nx < 30){
   nx = nx + 1;
  }
  else{
   nx = nx - 1;
   flag = 1;
  }
 }
 else{
  if(nx > 0){
   nx = nx - 1;
  }
  else{
   nx = nx + 1;
  flag = 0;
  }
 }
 score = score + 1;
 lc(0, 0);
 log("SCORE:");
 log(score);
 lc(nx, 22);
 log(chr(0xEC));
 sleep(70);
}

COMMENT