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/27 10:06:40

MixJuice GET URL : kidspod.club/mj/372

避けろ避けろ

  • No registered tag exist.

SOURCE CODE

cls();
var my_x = 15;
var my_y = 11;
var my_f = 0;
var key;
var score = 0;
var i = 0;
var r;
var speed = 100;
var flag = 0;

while(1){
 lc(0,0);
 log("                                ");
 lc(my_x, my_y);
 log(" ");
 lc(0,rnd(23) + 1);
 log(chr(0xF5));

 scroll(1);

 key = inkey();
 if(key == 30){
  if(my_y > 1){
   my_y = my_y - 1;
  }
 }
 if(key == 31){
  if(my_y < 23){
   my_y = my_y + 1;
  }
 }
 if(key == 28){
  if(my_x > 0){
   my_x = my_x - 1;
  }
 }
 if(key == 29){
  if(my_x < 31){
   my_x = my_x + 1;
  }
 }
 if(scr(my_x, my_y) == 0xF5){
  break;
 }

 if(flag == 0){
  if(i >= 10){
   score = score + 1;
   i = 0;
   r = rnd(5);
   if(r == 0){
    speed = 50;
    flag = 1;
   }
  }
 }
 else{
  if(i >= 20){
   score = score + 1;
   i = 0;
   r = rnd(5);
   if(r != 0){
    speed = 100;
    flag = 0;
   }
  }
 }
 i =i + 1;

 lc(my_x, my_y);
 if(my_f == 0){
  log(chr(0xF9));
  my_f = 1;
 }
 else{
  log(chr(0xFA));
  my_f = 0;
 }
 lc(0,0);
 log("SCORE:");
 log(score);

 sleep(speed);
}
lc(0,0);
log("SCORE:");
log(score);
lc(10,11);
log("GAME OVER");

COMMENT

Kidspod運営チーム
Kidspod運営チーム2017/10/02 09:42:37

スクロールの速さが変化するゲーム性が楽しいですね。油断していると、あっという間に当たってしまう! プレイヤーキャラのアニメーションもかわいらしいです。