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:26:57

MixJuice GET URL : kidspod.club/mj/428

084

  • No registered tag exist.

SOURCE CODE

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

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

cls();

lc(13, 10);
log("NEW GAME");
lc(7, 11);
log("----Enter PUSH----");
while(key != 10){
 key = inkey();
}

while(1){
 if((nx == 15) * (sy == 22)){
  break;
 }

 score = score + 1;

 key = inkey();
 if((key == 32) * (jflag == 0)){
  jflag = 1;
  sy = sy - 5;
 }
 if(sy < 22){
  sy = sy + 1;
  if(sy == 22){
   jflag = 0;
  }
 }

 if(flag == 0){
  if(nx < 30){
   r=rnd(3);
   if(r == 2){
    nx = nx + 3;
   }
   else{
    nx = nx + 1;
   }
  }
  else{
   nx = nx - 1;
   flag = 1;
  }
 }
 else{
 if(nx > 0){
  r=rnd(3);
   if(r == 2){
    nx = nx - 3;
   }
  nx = nx - 1;
  }
  else{
   nx = nx + 1;
   flag = 0;
  }
 }

 cls();
 lc(0, 0);
 log(chr(0xA0));
 log(score);
 lc(15, sy);
 log(chr(0xE2));
 lc(nx, 22);
 log(chr(0xF9));
 sleep(75);
}

lc(9, 11);
log("GAME OVER!!");

COMMENT