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

2017/09/26 14:11:36

MixJuice GET URL : kidspod.club/mj/366

065

  • No registered tag exist.

SOURCE CODE

var gun_y;
var key;
var beam_x;
var beam_y;

gun_y = 12;
beam_x = 0;
beam_y = 0;

while(1){
 key = inkey();
 if((key == 30) * (gun_y > 1)){
  gun_y = gun_y - 1;
 }
 if((key == 31) * (gun_y < 22)){
  gun_y = gun_y + 1;
 }

 if((key == 32) * (beam_x == 0)){
  beam_x = 1;
  beam_y = gun_y;
 }
 if(beam_x != 0){
  beam_x = beam_x + 4;
 }
 if(beam_x > 31){
  beam_x = 0;
 }
 
 cls();
 lc(0, gun_y);
 log("}")
 if(beam_x != 0){
  lc(beam_x, beam_y);
  log("-");
 }
 
 sleep(30);
}

COMMENT