var gun_y; var key; var beam_x; var beam_y; var target; var flag; var score; var time; gun_y = 12; beam_x = 0; beam_y = 0; target = 0; flag = 0; score = 0; time = 1000; 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 > 30) * (beam_y == target)){ flag = 0; score = score + 1; } if(beam_x > 31){ beam_x = 0; } if(flag == 0){ target = rnd(22); target = target + 1; flag = 1; } cls(); lc(0, gun_y); log("}") if(beam_x != 0){ lc(beam_x, beam_y); log("-"); } if(flag == 1){ lc(31, target); log("X"); } lc(0, 0); log("SCORE: "); log(score); lc(10, 0); log("TIME: "); log(time); time = time - 5; if(time < 0){ break; } sleep(30); }