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:11:12

MixJuice GET URL : kidspod.club/mj/439

091

  • No registered tag exist.

SOURCE CODE

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

nx = 0;
flag = 0;
sy = 22;
score = 0;
jflag = 0;
cls();

log("Enter:");
log(chr(0xBD));
log(chr(0xC0));
log(chr(0xB0));
log(chr(0xC4));

while(key != 10){
 key = inkey();
 if(key == 10){
  cls();
  sleep(1000);
  lc(14,10);
  log("3");
  sleep(1000);
  lc(14,10);
  log("2");
  sleep(1000);
  lc(14,10);
  log("1");
  sleep(1000);
 }
}
while(1){
 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;
  }
 }

 key = inkey();
 if((key == 32) * (jflag == 0)){
  sy = sy - 5;
  jflag = 1;
 }
 if(sy < 22){
  sy = sy + 1;
  if(sy == 22){
   jflag = 0;
  }
 }
 if((nx == 15) * (sy == 22)){
  break;
 }
 
 score = score + 1;
 
 cls();
 lc(0,0);
 log("SCORE:");
 log(score);
 lc(15,sy);
 log(chr(0xF9));
 lc(nx,22);
 log(chr(0xF5));
 
 r = rnd(135);
 r = r + 26;
 sleep(r);
}

lc(12,11);
log("GAME OVER!!");
log("\n");

COMMENT