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/05 23:58:54

MixJuice GET URL : kidspod.club/mj/442

093

  • No registered tag exist.

SOURCE CODE

var cx;
var cy;
var cbx;
var cby;
var bx;
var by;
var bhx;
var bhy;
var hf;
var bhp;
var key;
var bbx;
var bby;
var bbf;

cx = 15;
cy = 22;
cbx = 0;
cby = 0;
bx = 13;
by = 8;
bhp = 100;
bf = 0;
bbf = 0;

while(1){
 key = inkey();
 if(key == 28){
  if(cx > 0){
   cx = cx - 1;
  }
 }
 if(key == 29){
  if(cx < 31){
   cx = cx + 1;
  }
 }
 if(key == 30){
  if(cy > 2){
   cy = cy - 1;
  }
 }
 if(key == 31){
  if(cy < 22){
   cy = cy + 1;
  }
 }
 if((key == 32) * (cby == 0)){
  cbx = cx;
  cby = cy - 2;
 }
 if(cby > 0){
  cby = cby - 1;
 }
 
 if(bbf == 0){
  bbf = 1;
  bbx = bx + 1;
  bby = by + 3;
 }
 if(bby < 23){
  bby = bby + 1;
  if(bby >= 23){
   bbf = 0;
   bby = 0;
  }
 }
 
 if(bf == 0){
  if(bx < 25){
   bx = bx + 1;
  }
  else{
   bx = bx - 1;
   bf = 1;
  }
 }
 else{
  if(bx > 5){
   bx = bx - 1;
  }
  else{
   bx = bx + 1;
   bf = 0;
  }
 }
 
 cls();
 lc(cx, cy);
 log(chr(0xF1));
 if(cby != 0){
  lc(cbx, cby);
  log("|");
 }
 
 bhx = bx;
 while(bhx <= (bx + 5)){
  bhy = by;
  while(bhy >= (by - 2)){
   lc(bhx, bhy);
   log("@");
   bhy = bhy - 1;
  }
  bhx = bhx + 1;
 }
 
 bhx = bbx;
 if(bbf == 1){
  while(bhx <= bbx + 2){
   bhy = bby;
   while(bhy <= bby + 2){
    lc(bhx, bhy);
    log(chr(0x8F));
    bhy = bhy + 1;
   }
   bhx = bhx + 1;
  }
 }
 
 sleep(20);
}

COMMENT