查看: 1148|回复: 2

[已经过期] 关于雷霆战机脚本

[复制链接]
梦石
0
星屑
50
在线时间
41 小时
注册时间
2014-8-7
回帖
53
发表于 2015-5-3 02:06:06 | 显示全部楼层 |阅读模式

加入我们,或者,欢迎回来。

您需要 登录 才可以下载或查看,没有账号?注册会员

×
本帖最后由 RyanBern 于 2015-5-3 21:49 编辑

想请问一下,如何让HP=0时不gameovr 而是像胜利时一样 提示:失败,然后返回当前地图呢?好像是在123行改,但是不知道怎么改o(╯□╰)o
还想请问如果用变量记录获得的分数? 谢谢大
  1. #==============================================================================
  2. # ■ 雷霆战机 代码作者:杨峰
  3. #------------------------------------------------------------------------------
  4. # 这个脚本前后花了我一个星期的时间去完成,完全是凭借自己的力量一行一行写的。
  5. # 都大三了,平时还要上学校一堆烂课,伤不起啊!!
  6. # 最后作品还算差强人意,就是由于素材原因飞机和子弹稍微大了点,判定也因此不
  7. # 精准,不过不碍事。希望大家可以借此相互学习。多说一句,面向对象的设计思想
  8. # 实在是太TM重要了!
  9. #==============================================================================
  10. class Scene_Plane
  11.   def main
  12.     @window_boss = Window_Boss.new
  13.     @window_show = Window_Show.new
  14.     @result = Window_Result.new
  15.     @fly_pattern = Fly_Pattern.new
  16.     @attack_pattern = Attack_Pattern.new
  17.     @bg = Plane.new
  18.     @bg.bitmap = RPG::Cache.picture("bg")
  19.     @me = My_Plane.new
  20.     @enemy_num = 0
  21.     @count = 0
  22.     @record = 0
  23.     @bomb_num = 3
  24.     @score = 0
  25.     [url=home.php?mod=space&uid=1208434]@destroy[/url] = 0
  26.     @score = 0
  27.     @destroy = 0
  28.     @speed = 0
  29.     @process = 0
  30.     @bg.zoom_x = 1.2
  31.     @bomb_ctrl = true
  32.     @judge_over  = true
  33.     @victory = false
  34.     @level_switch = false
  35.     @power_switch = false
  36.     @bomb_switch = false
  37.     @food_switch = false
  38.     @my_blast_switch = false
  39.     @my_blast_hit_switch = false
  40.     @boss_switch = false
  41.     @bomb_blast_switch = []
  42.     @bomb_blast = []
  43.     @enemy_switch= []
  44.     @bullet_switch = []
  45.     @blast_switch = []
  46.     @blast_hit_switch = []
  47.     @blast = []
  48.     @blast_hit = []
  49.     @enemy = []
  50.     Audio.bgm_play("Audio/BGM/chuaiji")
  51.     for i in 0..100
  52.       @bomb_blast_switch = []
  53.       @enemy_switch[i] = false
  54.       @bullet_switch[i] = false
  55.       @blast_switch[i] = false
  56.       @blast_hit_switch[i] = false
  57.     end
  58.     Graphics.transition
  59.     loop do
  60.       Graphics.update
  61.       Input.update
  62.       update
  63.       if $scene != self
  64.         break
  65.       end
  66.     end
  67.   Graphics.freeze
  68.   @bg.dispose
  69.   @result.dispose
  70.   @window_boss.dispose
  71.   @window_show.dispose
  72.   for i in 0..@enemy_num
  73.     if @enemy_switch[i]
  74.       @enemy[i].dispose
  75.     end
  76.   end
  77.   Audio.bgm_stop
  78.   end
  79.   
  80.   def update
  81.     @bg.oy -= 5
  82.     @speed +=1
  83.     @process +=1
  84.     back_menu
  85.     shooting
  86.     pl_move
  87.     my_bullet_move   
  88.     game_process
  89.     enemy_pattern
  90.     eat_items
  91.     bomb_blast
  92.     move_items
  93.     hit_you_me
  94.     enemy_animation
  95.     enemy_leave
  96.     me_animation
  97.     boss_info
  98.     my_death
  99.   end
  100.   
  101.   def shooting
  102.     if Input.trigger?(Input::C) or Input.repeat?(Input::C)
  103.       @me.shotn_spread
  104.     end
  105.   end
  106.   def back_menu
  107.     if Input.trigger?(Input::F5)
  108.       $scene = Scene_Map.new
  109.     end
  110.   end
  111.   
  112.   def boss_info
  113.     if @boss_switch
  114.       @window_boss.refresh(@enemy[70].hp)
  115.       if @enemy[70].mode_switch
  116.         @enemy[70].attack_mode
  117.       end
  118.     end
  119.   end
  120.   
  121.   def my_death
  122.     if @me.hp <=0 and @judge_over
  123. game_over
  124.   end
  125. end

  126.   def hit_you_me
  127.     for i in 0..@enemy_num
  128.       if @enemy_switch[i]
  129.         hit_enemy(i)
  130.       end
  131.       hit_myself(i)
  132.       enemy_bullet_move(i)
  133.     end   
  134.   end  
  135.   def enemy_animation
  136.     for i in 0..@enemy_num
  137.       if @blast_switch[i]
  138.         @blast[i].animation
  139.         if @blast[i].control == -1
  140.            @blast[i].dispose
  141.            @enemy[i].dispose
  142.            @blast_switch[i] = false
  143.         end
  144.       end
  145.     end
  146.     for i in 0..@enemy_num
  147.       if @blast_hit_switch[i]
  148.         @blast_hit[i].animation
  149.         if @blast_hit[i].control == -1
  150.            @blast_hit[i].dispose
  151.            @blast_hit_switch[i] = false
  152.         end
  153.       end
  154.     end
  155.   end
  156.   def me_animation
  157.     if @my_blast_hit_switch
  158.       @my_blast_hit.animation
  159.       if @my_blast_hit.control == -1
  160.         @my_blast_hit.dispose
  161.         @my_blast_hit_switch = false
  162.       end
  163.     end
  164.     if @my_blast_switch
  165.       @my_blast.animation
  166.       if @my_blast.control == -1
  167.         @me.dispose
  168.         $scene = Scene_Gameover.new
  169.       end
  170.     end  
  171.   end
  172.   def move_items
  173.     if @bomb_switch
  174.       @bomb.move
  175.       if @bomb.pic.y >= 600
  176.         @bomb.dispose
  177.         @bomb_switch = false
  178.       end
  179.     end
  180.     if @level_switch
  181.       @level.move
  182.       if @level.pic.y >= 600
  183.         @level.dispose
  184.         @level_switch = false
  185.       end
  186.     end  
  187.    
  188.     if @power_switch
  189.       @power.move
  190.       if @power.pic.y >= 600
  191.         @power.dispose
  192.         @power_switch = false
  193.       end
  194.     end
  195.     if @food_switch
  196.       @food.move
  197.       if @food.pic.y >= 600
  198.         @food.dispose
  199.         @food_switch = false
  200.       end
  201.     end   
  202.   end
  203.   def bomb_blast
  204.     if Input.trigger?(Input::A)
  205.       if @bomb_num > 0 and @bomb_ctrl == true
  206.         Audio.se_play("Audio/SE/Explosion02")
  207.         @bomb_ctrl = false
  208.         @bomb_num -= 1
  209.         for i in 0..@enemy_num
  210.           if @enemy_switch[i]
  211.             @enemy[i].hp -= 10
  212.           end
  213.         end
  214.         for i in 0..5
  215.           @bomb_blast_switch[i] = true
  216.           case i
  217.             when 0..2
  218.               @bomb_blast[i] = Blast_Explosion2.new( i * 200,50)
  219.             when 3..5
  220.               @bomb_blast[i] = Blast_Explosion2.new( (i - 3) * 200,220)
  221.           end            
  222.         end        
  223.       end
  224.     end
  225.     for i in 0..5
  226.       if @bomb_blast_switch[i]
  227.         @bomb_blast[i].animation
  228.         if @bomb_blast[i].control == -1
  229.            @bomb_blast[i].dispose
  230.            @bomb_blast_switch[i] = false
  231.            @bomb_ctrl = true
  232.         end
  233.       end
  234.     end     
  235.   end  
  236.   def eat_items
  237.     if @bomb_switch
  238.       if @me.eat_bomb(@bomb.pic.x,@bomb.pic.y)
  239.         @bomb_num += 1
  240.         @bomb.dispose
  241.         @bomb_switch = false
  242.       end
  243.     end
  244.    
  245.     if @level_switch
  246.       if @me.eat_level(@level.pic.x,@level.pic.y)
  247.         @level.dispose
  248.         @level_switch = false
  249.         if @me.level < 4
  250.           @me.level += 2
  251.         end
  252.       end
  253.     end  
  254.     if @power_switch
  255.       if @me.eat_power(@power.pic.x,@power.pic.y)
  256.         @me.power += 1
  257.         @power.dispose
  258.         @power_switch = false
  259.       end
  260.     end     
  261.     if @food_switch
  262.       if @me.eat_food(@food.pic.x,@food.pic.y)
  263.         @me.hp += 50
  264.         if @me.hp >=200
  265.           @me.hp = 200
  266.         end
  267.         @food.dispose
  268.         @food_switch = false
  269.       end
  270.     end     
  271.   end
  272.   def enemy_leave
  273.     for i in 0..@enemy_num
  274.       if @enemy_switch[i]
  275.         if @enemy[i].pic.x < -100 or @enemy[i].pic.x > 700 or @enemy[i].pic.y > 500 or @enemy[i].pic.y < -150
  276.           @enemy[i].dispose
  277.           @enemy_switch[i] = false
  278.         end
  279.       end
  280.     end
  281.   end
  282.   def enemy_pattern
  283.    if @speed == 5
  284.       @result.refresh(@me.hp,@score,@destroy,@bomb_num)
  285.       for i in 0..@enemy_num
  286.         if @enemy_switch[i]
  287.           @fly_pattern.pattern(@enemy[i],i)
  288.           @attack_pattern.pattern(@me,i,@enemy[i])
  289.         end
  290.       end
  291.       @speed = 0
  292.     end  
  293.   end
  294.   
  295.   
  296.   def game_process
  297.     if @process < 100
  298.       @window_show.refresh(0)
  299.     elsif @process == 100
  300.       @window_show.contents.clear
  301.       Audio.se_play("Audio/SE/start")
  302.     end
  303.    
  304.     if @process <= 250 and @process >= 50 and @process % 50 == 0
  305.       @enemy[@enemy_num] = Enemy_Li.new(-80,100)
  306.       @enemy_switch[@enemy_num] = true
  307.       @bullet_switch[@enemy_num] = true
  308.       @enemy_num += 1
  309.       @enemy[@enemy_num] = Enemy_Li.new(640,100)
  310.       @enemy_switch[@enemy_num] = true
  311.       @bullet_switch[@enemy_num] = true
  312.       @enemy_num += 1
  313.     end
  314.    
  315.     if @process == 500
  316.       @enemy[@enemy_num] = Enemy_Green.new(500,-80)
  317.       @enemy_switch[@enemy_num] = true
  318.       @bullet_switch[@enemy_num] = true
  319.       @enemy_num += 1
  320.     end
  321.     if @process == 550
  322.       @enemy[@enemy_num] = Enemy_Green.new(400,-80)
  323.       @enemy_switch[@enemy_num] = true
  324.       @bullet_switch[@enemy_num] = true
  325.       @enemy_num += 1
  326.     end
  327.     if @process == 600
  328.       @enemy[@enemy_num] = Enemy_Green.new(300,-80)
  329.       @enemy_switch[@enemy_num] = true
  330.       @bullet_switch[@enemy_num] = true
  331.       @enemy_num += 1
  332.       @enemy[@enemy_num] = Enemy_Toon.new(-80,150)
  333.       @enemy_switch[@enemy_num] = true
  334.       @bullet_switch[@enemy_num] = true
  335.       @enemy_num += 1
  336.       @enemy[@enemy_num] = Enemy_Toon.new(640,150)
  337.       @enemy_switch[@enemy_num] = true
  338.       @bullet_switch[@enemy_num] = true
  339.       @enemy_num += 1

  340.     end
  341.     if @process == 650
  342.       @enemy[@enemy_num] = Enemy_Green.new(200,-80)
  343.       @enemy_switch[@enemy_num] = true
  344.       @bullet_switch[@enemy_num] = true
  345.       @enemy_num += 1
  346.     end
  347.     if @process == 700
  348.       @enemy[@enemy_num] = Enemy_Green.new(100,-80)
  349.       @enemy_switch[@enemy_num] = true
  350.       @bullet_switch[@enemy_num] = true
  351.       @enemy_num += 1
  352.     end
  353.   
  354.     if @process <= 900 and @process >= 800 and @process % 100 == 0
  355.       @enemy[@enemy_num] = Enemy_Li.new(-80,100)
  356.       @enemy_switch[@enemy_num] = true
  357.       @bullet_switch[@enemy_num] = true
  358.       @enemy_num += 1
  359.       @enemy[@enemy_num] = Enemy_Li.new(640,100)
  360.       @enemy_switch[@enemy_num] = true
  361.       @bullet_switch[@enemy_num] = true
  362.       @enemy_num += 1
  363.     end
  364.    
  365.     if @process == 920
  366.       @enemy[@enemy_num] = Enemy_Jit.new(100,-80)
  367.       @enemy_switch[@enemy_num] = true
  368.       @bullet_switch[@enemy_num] = true
  369.       @enemy_num += 1
  370.       @enemy[@enemy_num] = Enemy_Jit.new(500,-80)
  371.       @enemy_switch[@enemy_num] = true
  372.       @bullet_switch[@enemy_num] = true
  373.       @enemy_num += 1
  374.     end
  375.     if @process == 950
  376.       @enemy[@enemy_num] = Enemy_God.new(-80,100)
  377.       @enemy_switch[@enemy_num] = true
  378.       @bullet_switch[@enemy_num] = true
  379.       @enemy_num += 1
  380.       @enemy[@enemy_num] = Enemy_God.new(640,100)
  381.       @enemy_switch[@enemy_num] = true
  382.       @bullet_switch[@enemy_num] = true
  383.       @enemy_num += 1
  384.     end
  385.      
  386.     if @process == 1100
  387.       @enemy[@enemy_num] = Enemy_X.new(100,-80)
  388.       @enemy_switch[@enemy_num] = true
  389.       @bullet_switch[@enemy_num] = true
  390.       @enemy_num += 1
  391.       @enemy[@enemy_num] = Enemy_X.new(500,-80)
  392.       @enemy_switch[@enemy_num] = true
  393.       @bullet_switch[@enemy_num] = true
  394.       @enemy_num += 1
  395.     end   
  396.    
  397.    
  398.     if @process <= 1350 and @process >= 1250 and @process % 50 == 0
  399.       @enemy[@enemy_num] = Enemy_Green.new(-80,200)
  400.       @enemy_switch[@enemy_num] = true
  401.       @bullet_switch[@enemy_num] = true
  402.       @enemy_num += 1
  403.       @enemy[@enemy_num] = Enemy_Green.new(640,200)
  404.       @enemy_switch[@enemy_num] = true
  405.       @bullet_switch[@enemy_num] = true
  406.       @enemy_num += 1
  407.     end
  408.       
  409.     if @process <= 1450 and @process >= 1400 and @process % 50 == 0
  410.       @enemy[@enemy_num] = Enemy_Li.new(-80,100)
  411.       @enemy_switch[@enemy_num] = true
  412.       @bullet_switch[@enemy_num] = true
  413.       @enemy_num += 1
  414.       @enemy[@enemy_num] = Enemy_Li.new(640,100)
  415.       @enemy_switch[@enemy_num] = true
  416.       @bullet_switch[@enemy_num] = true
  417.       @enemy_num += 1
  418.     end
  419.    
  420.     if @process == 1600
  421.       @enemy[@enemy_num] = Enemy_Red.new(-80,100)
  422.       @enemy_switch[@enemy_num] = true
  423.       @bullet_switch[@enemy_num] = true
  424.       @enemy_num += 1
  425.       @enemy[@enemy_num] = Enemy_Red.new(640,100)
  426.       @enemy_switch[@enemy_num] = true
  427.       @bullet_switch[@enemy_num] = true
  428.       @enemy_num += 1
  429.     end
  430.    
  431.     if @process <= 1750 and @process >= 1650 and @process % 50 == 0
  432.       @enemy[@enemy_num] = Enemy_Ye.new(-80,-80)
  433.       @enemy_switch[@enemy_num] = true
  434.       @bullet_switch[@enemy_num] = true
  435.       @enemy_num += 1
  436.       @enemy[@enemy_num] = Enemy_Ye.new(640,-80)
  437.       @enemy_switch[@enemy_num] = true
  438.       @bullet_switch[@enemy_num] = true
  439.       @enemy_num += 1
  440.     end

  441.     if @process == 1900
  442.       @enemy[@enemy_num] = Enemy_Jp.new(-80,50)
  443.       @enemy_switch[@enemy_num] = true
  444.       @bullet_switch[@enemy_num] = true
  445.       @enemy_num += 1
  446.       @enemy[@enemy_num] = Enemy_Jp.new(640,50)
  447.       @enemy_switch[@enemy_num] = true
  448.       @bullet_switch[@enemy_num] = true
  449.       @enemy_num += 1
  450.     end

  451.     if @process == 2000
  452.       @enemy[@enemy_num] = Enemy_Red.new(100,500)
  453.       @enemy_switch[@enemy_num] = true
  454.       @bullet_switch[@enemy_num] = true
  455.       @enemy_num += 1
  456.       @enemy[@enemy_num] = Enemy_Red.new(400,500)
  457.       @enemy_switch[@enemy_num] = true
  458.       @bullet_switch[@enemy_num] = true
  459.       @enemy_num += 1
  460.     end

  461.     if @process <= 2100 and @process >= 2000 and @process % 100 == 0
  462.       @enemy[@enemy_num] = Enemy_God.new(-80,150)
  463.       @enemy_switch[@enemy_num] = true
  464.       @bullet_switch[@enemy_num] = true
  465.       @enemy_num += 1
  466.       @enemy[@enemy_num] = Enemy_God.new(640,250)
  467.       @enemy_switch[@enemy_num] = true
  468.       @bullet_switch[@enemy_num] = true
  469.       @enemy_num += 1
  470.     end
  471.      
  472.     if @process == 2200
  473.       @enemy[@enemy_num] = Enemy_LX.new(250,-80)
  474.       @enemy_switch[@enemy_num] = true
  475.       @bullet_switch[@enemy_num] = true
  476.       @enemy_num += 1
  477.     end
  478.    
  479.     if @process <= 2350 and @process >= 2250 and @process % 50 == 0
  480.       @enemy[@enemy_num] = Enemy_Green.new(-80,200)
  481.       @enemy_switch[@enemy_num] = true
  482.       @bullet_switch[@enemy_num] = true
  483.       @enemy_num += 1
  484.       @enemy[@enemy_num] = Enemy_Green.new(640,200)
  485.       @enemy_switch[@enemy_num] = true
  486.       @bullet_switch[@enemy_num] = true
  487.       @enemy_num += 1
  488.     end
  489.    
  490.     if @process <= 2600 and @process >= 2500 and @process % 100 == 0
  491.       @enemy[@enemy_num] = Enemy_Li.new(-80,200)
  492.       @enemy_switch[@enemy_num] = true
  493.       @bullet_switch[@enemy_num] = true
  494.       @enemy_num += 1
  495.       @enemy[@enemy_num] = Enemy_Li.new(640,200)
  496.       @enemy_switch[@enemy_num] = true
  497.       @bullet_switch[@enemy_num] = true
  498.       @enemy_num += 1
  499.     end
  500.     if @process == 2700
  501.       @enemy[@enemy_num] = Enemy_LX.new(-80,50)
  502.       @enemy_switch[@enemy_num] = true
  503.       @bullet_switch[@enemy_num] = true
  504.       @enemy_num += 1
  505.       @enemy[@enemy_num] = Enemy_LX.new(640,50)
  506.       @enemy_switch[@enemy_num] = true
  507.       @bullet_switch[@enemy_num] = true
  508.       @enemy_num += 1
  509.     end
  510.     if @process <= 2800 and @process >= 2750 and @process % 50 == 0
  511.       @enemy[@enemy_num] = Enemy_Toon.new(-80,250)
  512.       @enemy_switch[@enemy_num] = true
  513.       @bullet_switch[@enemy_num] = true
  514.       @enemy_num += 1
  515.       @enemy[@enemy_num] = Enemy_Toon.new(640,250)
  516.       @enemy_switch[@enemy_num] = true
  517.       @bullet_switch[@enemy_num] = true
  518.       @enemy_num += 1
  519.     end
  520.    
  521.     if @process < 3100 and @process>= 3000
  522.     @window_show.refresh(1)
  523.     elsif @process == 3100
  524.       @window_show.contents.clear
  525.       Audio.bgm_stop
  526.       Audio.se_play("Audio/SE/warning")
  527.     end

  528.     if @process == 3200
  529.       @enemy[@enemy_num] = Enemy_Boss.new(150,-120)
  530.       @enemy_switch[@enemy_num] = true
  531.       @bullet_switch[@enemy_num] = true
  532.       @boss_switch = true
  533.       @enemy_num += 1
  534.       Audio.bgm_play("Audio/BGM/action_world2")
  535.     end
  536.     if @victory and @record == 0
  537.       Audio.me_play("Audio/ME/victory")
  538.       @record = @process
  539.     end
  540.    
  541.     if @victory
  542.       if @process != @record + 100
  543.         @window_show.refresh(2)
  544.       else
  545.          $scene = Scene_Map.new
  546.       end
  547.     end
  548.   end
  549.   
  550.   
  551.   def hit_myself(turn)
  552.     if @bullet_switch[turn]
  553.       for i in 0..@enemy[turn].bullet_num
  554.         if @enemy[turn].attack[i]
  555.           if(@me.hit(@enemy[turn].bullet[i].pic.x,@enemy[turn].bullet[i].pic.y,@enemy[turn].bullet[i].power))
  556.             if @me.hp > 0 and @my_blast_hit_switch == false
  557.               @my_blast_hit_switch = true
  558.               @my_blast_hit = Blast_Hit.new(@me.pic.x - 30 ,@me.pic.y - 30)
  559.             end
  560.             @enemy[turn].bullet[i].dispose
  561.             @enemy[turn].attack[i] = false   
  562.           end
  563.         end
  564.       end
  565.     end
  566.   end
  567.   
  568.   def game_over
  569.     Audio.se_play("Audio/SE/Explosion04")
  570.     @my_blast = Blast_Explosion.new(@me.pic.x - 25,@me.pic.y - 25)
  571.     @my_blast_switch = true
  572.     @judge_over = false
  573.   end
  574.   
  575.   
  576.   def hit_enemy(turn)
  577.     for i in [email]0..@me.bullet_num[/email]
  578.       if  @me.attack[i]
  579.         if(@enemy[turn].hit(@me.bullet[i].pic.x,@me.bullet[i].pic.y,@me.power))
  580.           if @enemy[turn].hp > 0 and @blast_hit_switch[turn] == false
  581.             @blast_hit[turn] = Blast_Hit.new(@enemy[turn].pic.x- 20 ,@enemy[turn].pic.y)
  582.             @blast_hit_switch[turn] = true
  583.           end
  584.           @me.bullet[i].dispose
  585.           @me.attack[i] = false
  586.         end
  587.       end
  588.     end
  589.    
  590.     if @enemy[turn].hp <= 0
  591.       @score += 10 * @enemy[turn].level
  592.       @destroy += 1
  593.       Audio.se_play("Audio/SE/Explosion01")
  594.       @blast[turn] = Blast_Explosion.new(@enemy[turn].pic.x - 30,@enemy[turn].pic.y)
  595.       @blast_switch[turn] = true
  596.       @enemy_switch[turn] = false
  597.       if turn == 4 or turn == 21 or turn == 53 or turn == 64
  598.         @bomb = Bomb.new(@enemy[turn].pic.x + 50,@enemy[turn].pic.y + 40)
  599.         @bomb_switch = true
  600.       end
  601.       if turn == 12 or  turn == 34 or turn == 47 or turn == 65
  602.         @level = Level.new(@enemy[turn].pic.x + 50,@enemy[turn].pic.y + 40)
  603.         @level_switch = true
  604.       end
  605.       if turn == 33
  606.         @power = Power.new(@enemy[turn].pic.x + 50,@enemy[turn].pic.y + 40)
  607.         @power_switch = true
  608.       end
  609.       if turn == 30 or turn == 66
  610.         @food = Food.new(@enemy[turn].pic.x + 50,@enemy[turn].pic.y + 40)
  611.         @food_switch = true
  612.       end
  613.       if turn == 70
  614.         @victory = true
  615.       end
  616.     end
  617.   end
  618.   
  619.   
  620.   def enemy_bullet_move(turn)
  621.     if @bullet_switch[turn]
  622.       for i in 0..@enemy[turn].bullet_num
  623.          if @enemy[turn].attack[i]
  624.            if  @enemy[turn].bullet[i].type == 0
  625.              @enemy[turn].bullet[i].down_fly
  626.            end
  627.            if  @enemy[turn].bullet[i].type == 1
  628.              @enemy[turn].bullet[i].search_fly(1)
  629.            end
  630.            if  @enemy[turn].bullet[i].type == 2
  631.              @enemy[turn].bullet[i].search_fly(1)
  632.            end           
  633.            if @enemy[turn].bullet[i].pic.y >=500
  634.              @enemy[turn].attack[i]=false
  635.              @enemy[turn].bullet[i].dispose
  636.            end            
  637.          end
  638.       end
  639.     end
  640.   end
  641.   
  642.   
  643.   def my_bullet_move
  644.     for i in @[email]count..@me.bullet_num[/email]
  645.       if  @me.attack[i]
  646.         @me.bullet[i].search_fly(2)
  647.         if @me.bullet[i].pic.y <= -60
  648.           @me.attack[i]=false
  649.           @me.bullet[i].dispose
  650.           @count += 1
  651.         end
  652.       end
  653.     end
  654.   end
  655.   
  656.   def pl_move
  657.     if Input.trigger?(Input::UP) or Input.repeat?(Input::UP)
  658.        if @me.pic.y>=0
  659.          @me.pic.y-=20
  660.        end
  661.     end
  662.     if Input.trigger?(Input::RIGHT) or Input.repeat?(Input::RIGHT)
  663.        if @me.pic.x<=520
  664.          @me.pic.x+=20
  665.        end
  666.     end
  667.     if Input.trigger?(Input::DOWN) or Input.repeat?(Input::DOWN)
  668.        if @me.pic.y <=380
  669.          @me.pic.y+=20
  670.        end
  671.     end
  672.     if Input.trigger?(Input::LEFT) or Input.repeat?(Input::LEFT)
  673.        if @me.pic.x>=0
  674.          @me.pic.x-=20
  675.        end
  676.     end
  677.   end
  678. end



  679. class My_Plane
  680.   attr_accessor :pic
  681.   attr_accessor :hp
  682.   attr_accessor :power
  683.   attr_accessor :level
  684.   attr_accessor :bullet
  685.   attr_accessor :bullet_num
  686.   attr_accessor :attack
  687.   def initialize
  688.     @hp = 200
  689.     @attack  = false
  690.     @level = 0
  691.     @power = 1
  692.     @pic = Sprite.new
  693.     @pic.x = 300
  694.     @pic.y = 360
  695.     @pic.bitmap = RPG::Cache.picture("BluePlane")
  696.     @attack = []
  697.     @bullet = []
  698.     @bullet_num = 0
  699.   end
  700.   
  701.   
  702.   def eat_bomb(x,y)
  703.     if x <= @pic.x + 80 and x >= @pic.x + 20 and y <= @pic.y + 70 and y >= @pic.y
  704.       Audio.se_play("Audio/SE/eatbomb")
  705.       return true
  706.     else
  707.       return false
  708.     end
  709.   end
  710.    
  711.   def eat_level(x,y)
  712.     if x <= @pic.x + 80 and x >= @pic.x + 20 and y <= @pic.y + 70 and y >= @pic.y
  713.       Audio.se_play("Audio/SE/eatlevel")
  714.       return true
  715.     else
  716.       return false
  717.     end
  718.   end
  719.   
  720.   def eat_power(x,y)
  721.     if x <= @pic.x + 80 and x >= @pic.x + 20 and y <= @pic.y + 70 and y >= @pic.y
  722.       Audio.se_play("Audio/SE/eatpower")
  723.       return true
  724.     else
  725.       return false
  726.     end
  727.   end

  728.   def eat_food(x,y)
  729.     if x <= @pic.x + 80 and x >= @pic.x + 20 and y <= @pic.y + 70 and y >= @pic.y
  730.       Audio.se_play("Audio/SE/eatlevel")
  731.       return true
  732.     else
  733.       return false
  734.     end
  735.   end
  736.   
  737.   def shotn_spread
  738.     for i in 0..@level
  739.       shot_spread(i)
  740.     end
  741.   end
  742.   
  743.   def shot_spread(place)
  744.     Audio.se_play("Audio/SE/destroyer_lazer1")
  745.     @bullet[@bullet_num] = My_Bullet.new(@power)
  746.     angle = Math::PI * (place + 1) / (@level + 2)  
  747.     x = Math.cos(angle)
  748.     y = Math.sin(angle)
  749.     if x  == 0
  750.       @bullet[@bullet_num].ratiox = 0
  751.       @bullet[@bullet_num].ratio = 1
  752.       @bullet[@bullet_num].ratioy = -1
  753.     else
  754.       @bullet[@bullet_num].ratio = y / x
  755.       if @bullet[@bullet_num].ratio > 0
  756.         @bullet[@bullet_num].ratiox =  -1
  757.         @bullet[@bullet_num].ratioy = -1
  758.       else
  759.         @bullet[@bullet_num].ratiox = 1
  760.         @bullet[@bullet_num].ratioy = 1
  761.       end
  762.     end
  763.     if @power == 1
  764.       @bullet[@bullet_num].pic.x = @pic.x - 40 * Math.cos(angle) + 30
  765.       @bullet[@bullet_num].pic.y = @pic.y + 40 * Math.sin(angle) - 30
  766.     elsif @power ==2
  767.       @bullet[@bullet_num].pic.x = @pic.x - 40 * Math.cos(angle)
  768.       @bullet[@bullet_num].pic.y = @pic.y + 40 * Math.sin(angle) - 60
  769.     end
  770.     @attack[@bullet_num] = true
  771.     @bullet_num += 1
  772.   end  
  773.   
  774.   
  775.   
  776.   
  777.   def hit(x,y,power)
  778.     if x >= @pic.x  and x <= @pic.x + 70 and y >= @pic.y and y <= @pic.y + 40
  779.       @hp -= power
  780.       Audio.se_play("Audio/SE/lazer_hit")
  781.       return true
  782.     end
  783.     return false
  784.   end
  785.   
  786.   def dispose
  787.     @pic.dispose
  788.   end
  789. end


  790. class  Enemy_Plane
  791.   attr_accessor :pic
  792.   attr_accessor :boss_suit
  793.   attr_accessor :width
  794.   attr_accessor :hp
  795.   attr_accessor :power
  796.   attr_accessor :level
  797.   attr_accessor :speed
  798.   attr_accessor :attack_type
  799.   attr_accessor :bullet
  800.   attr_accessor :bullet_size
  801.   attr_accessor :bullet_num
  802.   attr_accessor :attack
  803.   def initialize(x,y)
  804.     @pic = Sprite.new
  805.     @pic.x = x  
  806.     @pic.y = y
  807.     @level = 1
  808.     @power = 1
  809.     @boss_suit = 0
  810.     @speed = 1
  811.     @bullet_size = 0
  812.     @attack_type = 0
  813.     @bullet_num = 0
  814.     @width = 128
  815.     @bullet = []
  816.     @attack  = []
  817.   end
  818.   
  819.   def shot_forward(place,num)
  820.     Audio.se_play("Audio/SE/117-Fire01")
  821.     @bullet[@bullet_num] = Enemy_Bullet.new(@power)
  822.     @bullet[@bullet_num].type = 0
  823.     if @power == 1
  824.       @bullet[@bullet_num].pic.x = @pic.x + (place + 1) * @width/ (num + 2) - 30 + @boss_suit
  825.     else
  826.       @bullet[@bullet_num].pic.x = @pic.x + (place + 1) * @width/ (num + 2) - 60+ @boss_suit
  827.     end
  828.     @bullet[@bullet_num].pic.y = @pic.y + @width / 3+ @boss_suit
  829.     @attack[@bullet_num] = true
  830.     @bullet_num += 1
  831.   end
  832.   
  833.   def shotn(num)
  834.     for i in 0..num
  835.       shot_forward(i,num)
  836.     end
  837.   end
  838.   
  839.   def shotn_me(plane,num)
  840.     for i in 0..num
  841.       shot_me(plane,i,num)
  842.     end
  843.   end
  844.   
  845.   def shot_me(plane,place,num)
  846.     Audio.se_play("Audio/SE/117-Fire01")
  847.     @bullet[@bullet_num] = Enemy_Bullet.new(@power)
  848.     @bullet[@bullet_num].type = 1
  849.     x = (plane.pic.x - pic.x) *1.0
  850.     y = plane.pic.y - pic.y
  851.     if x == 0
  852.       @bullet[@bullet_num].ratiox = 0
  853.       if y >= 0
  854.         @bullet[@bullet_num].ratio = 1
  855.       else
  856.         @bullet[@bullet_num].ratio = -1
  857.       end
  858.     else
  859.       @bullet[@bullet_num].ratio = y / x
  860.       if @bullet[@bullet_num].ratio == 0
  861.         if x >= 0
  862.           @bullet[@bullet_num].ratiox = 1
  863.         else
  864.           @bullet[@bullet_num].ratiox = -1
  865.         end
  866.       else
  867.         if x > 0
  868.           @bullet[@bullet_num].ratiox = 1
  869.         else
  870.           @bullet[@bullet_num].ratiox = -1
  871.           @bullet[@bullet_num].ratioy = -1
  872.         end
  873.       end
  874.     end
  875.     if @power == 1
  876.       @bullet[@bullet_num].pic.x = @pic.x + (place + 1) * width/ (num + 2) - 30+ @boss_suit
  877.     elsif @power == 4
  878.       @bullet[@bullet_num].pic.x = @pic.x + (place + 1) * width/ (num + 2) - 60+ @boss_suit
  879.     else
  880.       @bullet[@bullet_num].pic.x = @pic.x + (place + 1) * width/ (num + 2) - 100+ @boss_suit
  881.     end
  882.     @bullet[@bullet_num].pic.y = @pic.y + 60+ @boss_suit
  883.     @attack[@bullet_num] = true
  884.     @bullet_num += 1
  885.   end
  886.   
  887.   def shotn_spread(num)
  888.     for i in 0..num
  889.       shot_spread(i,num)
  890.     end
  891.   end
  892.   
  893.   def shot_spread(place,num)
  894.     Audio.se_play("Audio/SE/117-Fire01")
  895.     @bullet[@bullet_num] = Enemy_Bullet.new(@power)
  896.     @bullet[@bullet_num].type = 2
  897.     angle = Math::PI * (place + 1) / (num + 2)  
  898.     x = Math.cos(angle)
  899.     y = Math.sin(angle)
  900.     if x  == 0
  901.       @bullet[@bullet_num].ratiox = 0
  902.       @bullet[@bullet_num].ratio = 1
  903.     else
  904.       @bullet[@bullet_num].ratio = y / x
  905.       if @bullet[@bullet_num].ratio > 0
  906.         @bullet[@bullet_num].ratiox = - 1
  907.       else
  908.         @bullet[@bullet_num].ratiox = 1
  909.         @bullet[@bullet_num].ratioy = -1
  910.       end
  911.     end
  912.     if @power == 1 or @power == 4
  913.       @bullet[@bullet_num].pic.x = @pic.x - 40 * Math.cos(angle) + 30+ @boss_suit
  914.     else
  915.       @bullet[@bullet_num].pic.x = @pic.x - 40 * Math.cos(angle) + @boss_suit
  916.     end
  917.     @bullet[@bullet_num].pic.y = @pic.y + 40 * Math.sin(angle) + 40+ @boss_suit
  918.     @attack[@bullet_num] = true
  919.     @bullet_num += 1
  920.   end
  921.   
  922.   def hit(x,y,power)
  923.     if x >= @pic.x- 10  and x <= @pic.x + 80  and y >= @pic.y and y <= @pic.y + 40
  924.       @hp -= power
  925.       Audio.se_play("Audio/SE/lazer_hit")
  926.       return true
  927.     end
  928.     return false
  929.   end
  930.   
  931.   def dispose
  932.     @pic.dispose
  933.   end
  934. end

  935. class Enemy_Li < Enemy_Plane
  936.   def initialize(x,y)
  937.     super(x,y)
  938.     @attack_type = -1
  939.     @bullet_size = 0
  940.     @speed = 2
  941.     @level= 1
  942.     @hp = 2
  943.     @pic.bitmap = RPG::Cache.picture("LiPlane")
  944.   end
  945. end

  946. class Enemy_Green < Enemy_Plane
  947.   def initialize(x,y)
  948.     super(x,y)
  949.     @attack_type = 0
  950.     @bullet_size = 0
  951.     @speed = 2
  952.     @power = 1
  953.     @level= 2
  954.     @hp = 2
  955.     @pic.bitmap = RPG::Cache.picture("GreenPlane")
  956.   end
  957. end

  958. class Enemy_God < Enemy_Plane
  959.   def initialize(x,y)
  960.     super(x,y)
  961.     @attack_type = 1
  962.     @bullet_size = 0
  963.     @level = 4
  964.     @power = 1
  965.     @speed = 2
  966.     @hp = 5
  967.     @pic.bitmap = RPG::Cache.picture("GodPlane")
  968.   end
  969. end
  970. class Enemy_X < Enemy_Plane
  971.   def initialize(x,y)
  972.     super(x,y)
  973.     @attack_type = 1
  974.     @bullet_size = 2
  975.     @level = 6
  976.     @power = 1
  977.     @speed = 1
  978.     @hp = 10
  979.     @pic.bitmap = RPG::Cache.picture("XPlane")
  980.   end
  981. end

  982. class Enemy_Jit < Enemy_Plane
  983.   def initialize(x,y)
  984.     super(x,y)
  985.     @attack_type = 0
  986.     @bullet_size = 1
  987.     @power = 2
  988.     @level = 5
  989.     @speed = 1
  990.     @hp = 15
  991.     @pic.bitmap = RPG::Cache.picture("JitPlane")
  992.   end
  993. end

  994. class Enemy_Jp < Enemy_Plane
  995.   def initialize(x,y)
  996.     super(x,y)
  997.     @attack_type = 2
  998.     @bullet_size = 3
  999.     @level = 6
  1000.     @speed = 1
  1001.     @power = 3
  1002.     @hp = 15
  1003.     @pic.bitmap = RPG::Cache.picture("JpPlane")
  1004.   end
  1005. end

  1006. class Enemy_LX < Enemy_Plane
  1007.   def initialize(x,y)
  1008.     super(x,y)
  1009.     @attack_type = 1
  1010.     @bullet_size = 4
  1011.     @level = 10
  1012.     @power = 4
  1013.     @speed = 1
  1014.     @hp = 30
  1015.     @pic.bitmap = RPG::Cache.picture("LXPlane")
  1016.   end
  1017. end
  1018. class Enemy_Red < Enemy_Plane
  1019.   def initialize(x,y)
  1020.     super(x,y)
  1021.     @attack_type = 2
  1022.     @bullet_size = 1
  1023.     @level = 5
  1024.     @power = 3
  1025.     @speed = 1
  1026.     @hp = 20
  1027.     @pic.bitmap = RPG::Cache.picture("RedPlane")
  1028.   end
  1029. end
  1030. class Enemy_Toon < Enemy_Plane
  1031.   def initialize(x,y)
  1032.     super(x,y)
  1033.     @attack_type = 1
  1034.     @bullet_size = 0
  1035.     @level = 3
  1036.     @power = 1
  1037.     @speed = 2
  1038.     @hp = 2
  1039.     @pic.bitmap = RPG::Cache.picture("ToonPlane")
  1040.   end
  1041. end
  1042. class Enemy_Ye < Enemy_Plane
  1043.   def initialize(x,y)
  1044.     super(x,y)
  1045.     @attack_type = 0
  1046.     @bullet_size = 1
  1047.     @power = 1
  1048.     @level = 6
  1049.     @speed = 2.5
  1050.     @hp = 5
  1051.     @pic.bitmap = RPG::Cache.picture("YePlane")
  1052.   end
  1053. end


  1054. class Enemy_Boss < Enemy_Plane
  1055.   attr_accessor :mode_switch
  1056.   def initialize(x,y)
  1057.     super(x,y)
  1058.     @mode_switch = false
  1059.     @attack_type = 1
  1060.     @boss_suit = 50
  1061.     @bullet_size = 5
  1062.     @power = 3
  1063.     @level = 100
  1064.     @width = 240
  1065.     @speed = 1
  1066.     @hp = 1000
  1067.     @pic.bitmap = RPG::Cache.picture("boss")
  1068.   end
  1069.   
  1070.   def attack_mode
  1071.     @attack_type = rand(3)
  1072.     mode_switch = false
  1073.     case @attack_type
  1074.       when 0
  1075.         @power = 4
  1076.         @bullet_size = 6
  1077.       when 1
  1078.         @power = 3
  1079.         @bullet_size = 5
  1080.       when 2
  1081.         @power = 2
  1082.         @bullet_size = 10
  1083.     end
  1084.   end
  1085.   def hit(x,y,power)
  1086.     if x >= @pic.x - 40 and x <= @pic.x + 280 and y >= @pic.y and y <=  @pic.y + 140
  1087.       @hp -= power
  1088.       Audio.se_play("Audio/SE/lazer_hit")
  1089.       return true
  1090.     end
  1091.     return false
  1092.   end
  1093. end


  1094. class Blast
  1095.   attr_accessor :pic
  1096.   attr_accessor :control
  1097.   attr_accessor :speed
  1098.   def initialize(x,y)
  1099.     @control = 0
  1100.     @speed =0
  1101.     @pic = Sprite.new
  1102.     @pic.x = x
  1103.     @pic.y = y
  1104.     @pic.bitmap = Bitmap.new(192,192)
  1105.   end  

  1106.   def dispose
  1107.     @pic.dispose
  1108.   end
  1109. end
  1110.   

  1111. class Blast_Explosion <  Blast
  1112.   def initialize(x,y)
  1113.     super(x,y)
  1114.   end
  1115.   def animation
  1116.     if  @speed == 5
  1117.       if @control ==2  or @control == 4 or @control == 5
  1118.         @pic.bitmap.dispose
  1119.         @pic.bitmap = Bitmap.new(192,192)
  1120.       end
  1121.       if @control <= 4
  1122.         @pic.bitmap.blt(0,0,RPG::Cache.picture("Explosion01"),Rect.new(192*@control,0,192,192))
  1123.         @control +=1
  1124.       elsif @control > 4 and @control <= 5
  1125.         @pic.bitmap.blt(0,0,RPG::Cache.picture("Explosion01"),Rect.new(192*(@control - 4),192,192,192))
  1126.         @control +=1
  1127.       else
  1128.         @control = -1
  1129.       end
  1130.       @speed = 0
  1131.     end
  1132.     @speed += 1   
  1133.   end
  1134. end

  1135. class Blast_Explosion2 <  Blast
  1136.   def initialize(x,y)
  1137.     super(x,y)
  1138.   end
  1139.   def animation
  1140.     if  @speed == 5
  1141.       if @control == 2  or @control == 4  or  @control == 6 or   @control == 9
  1142.         @pic.bitmap.dispose
  1143.         @pic.bitmap = Bitmap.new(192,192)
  1144.       end
  1145.       if @control <= 4
  1146.         @pic.bitmap.blt(0,0,RPG::Cache.picture("Explosion02"),Rect.new(192*@control,0,192,192))
  1147.         @control +=1
  1148.       elsif @control > 4 and @control <= 9
  1149.         @pic.bitmap.blt(0,0,RPG::Cache.picture("Explosion02"),Rect.new(192*(@control - 4),192,192,192))
  1150.         @control +=1
  1151.       else
  1152.         @control = -1
  1153.       end
  1154.       @speed = 0
  1155.     end
  1156.     @speed += 1   
  1157.   end
  1158. end

  1159. class Blast_Hit <  Blast
  1160.   def initialize(x,y)
  1161.     super(x,y)
  1162.   end
  1163.   def animation
  1164.     if @speed == 2
  1165.       if @control ==2  or @control == 4  or @control == 6 or @control == 9
  1166.         @pic.bitmap.dispose
  1167.         @pic.bitmap = Bitmap.new(192,192)      
  1168.       end
  1169.       if  @control <= 4
  1170.         @pic.bitmap.blt(0,0,RPG::Cache.picture("011-Weapon06"),Rect.new(192*@control,0,192,192))
  1171.         @control +=1
  1172.       elsif  @control > 4 and @control <= 9
  1173.         @pic.bitmap.blt(0,0,RPG::Cache.picture("011-Weapon06"),Rect.new(192*(@control - 4),192,192,192))
  1174.         @control +=1
  1175.       else
  1176.         @control = -1
  1177.       end
  1178.       @speed = 0
  1179.     end
  1180.     @speed += 1
  1181.   end
  1182. end

  1183.   
  1184. class Fly_Pattern
  1185.   attr_accessor :control
  1186.   attr_accessor :direction
  1187.   def initialize
  1188.     @control = []
  1189.     @direction = 1
  1190.     for i in 0..100
  1191.       @control[i] = 0
  1192.     end
  1193.   end
  1194.   
  1195.   def pattern(plane,turn)
  1196.     case turn
  1197.       when 21
  1198.         pattern_0(plane,turn)
  1199.       when 22
  1200.         pattern_1(plane,turn)
  1201.       when 10,11,12,15,16,25,26,53
  1202.         pattern_2(plane)
  1203.       when 47,48
  1204.         pattern_3(plane)
  1205.       when 0,2,4,6,8,13,17,19,23,27,29,31,33,35,37,49,51,54,56,58,60,62,66,68
  1206.         pattern_4(plane)
  1207.       when 1,3,5,7,9,14,18,20,24,28,30,32,34,36,38,50,52,55,57,59,61,63,67,69
  1208.         pattern_5(plane)
  1209.       when 39,41,43
  1210.         pattern_6(plane)
  1211.       when 40,42,44
  1212.         pattern_7(plane)
  1213.       when 45,64
  1214.         pattern_8(plane,turn)
  1215.       when 46,65
  1216.         pattern_9(plane,turn)
  1217.       when 70
  1218.         pattern_boss(plane,turn)
  1219.       else
  1220.         pattern_0(plane,turn)
  1221.     end
  1222.   end
  1223.    
  1224.   def pattern_0(plane,turn)
  1225.     @control[turn] += 1
  1226.     if @control[turn]< 40
  1227.        plane.pic.y += 5*plane.speed
  1228.     end
  1229.     if @control[turn]>= 40 and @control[turn] <= 100
  1230.        plane.pic.x += 5*plane.speed
  1231.     end
  1232.     if @control[turn] > 100
  1233.        plane.pic.y -= 5*plane.speed
  1234.     end
  1235.   end
  1236.   
  1237.   def pattern_1(plane,turn)
  1238.     @control[turn] += 1
  1239.     if @control[turn]< 40
  1240.        plane.pic.y += 5*plane.speed
  1241.     end
  1242.     if @control[turn]>= 40 and @control[turn] <= 100
  1243.        plane.pic.x -= 5*plane.speed
  1244.     end
  1245.     if @control[turn] > 100
  1246.        plane.pic.y -= 5*plane.speed
  1247.     end
  1248.   end
  1249.   

  1250.   def pattern_2(plane)
  1251.     plane.pic.y +=5*plane.speed
  1252.   end
  1253.    
  1254.   def pattern_3(plane)
  1255.     plane.pic.y -=5*plane.speed
  1256.   end
  1257.   
  1258.   def pattern_4(plane)
  1259.     plane.pic.x +=5*plane.speed
  1260.   end
  1261.   def pattern_5(plane)
  1262.     plane.pic.x -= 5*plane.speed
  1263.   end

  1264.   def pattern_6(plane)
  1265.     plane.pic.x += 4*plane.speed
  1266.     plane.pic.y += 4*plane.speed
  1267.   end
  1268.   
  1269.   def pattern_7(plane)
  1270.     plane.pic.x -= 4*plane.speed
  1271.     plane.pic.y += 4*plane.speed
  1272.   end
  1273.   
  1274.   def pattern_8(plane,turn)
  1275.     @control[turn] += 1
  1276.     if @control[turn] <= 60
  1277.        plane.pic.x += 4 *plane.speed
  1278.     end
  1279.     if @control[turn] <= 100 and @control[turn] > 60
  1280.        plane.pic.y += 3*plane.speed
  1281.     end
  1282.     if @control[turn] <=160 and @control[turn] >100
  1283.        plane.pic.x -= 4*plane.speed
  1284.      end
  1285.     if @control[turn] <=200 and @control[turn] >160
  1286.        plane.pic.y += 3*plane.speed
  1287.     end
  1288.     if @control[turn] >200
  1289.       plane.pic.x += 4 * plane.speed
  1290.     end
  1291.   end
  1292.   
  1293.   def pattern_9(plane,turn)
  1294.     @control[turn] += 1
  1295.     if @control[turn] <= 60
  1296.        plane.pic.x -= 4 *plane.speed
  1297.     end
  1298.     if @control[turn] <= 100 and @control[turn] > 60
  1299.        plane.pic.y += 3*plane.speed
  1300.     end
  1301.     if @control[turn] <=160 and @control[turn] >100
  1302.        plane.pic.x += 4 * plane.speed
  1303.      end
  1304.     if @control[turn] <=200 and @control[turn] >160
  1305.        plane.pic.y += 3*plane.speed
  1306.     end
  1307.     if @control[turn] >200
  1308.       plane.pic.x -= 4 * plane.speed
  1309.     end
  1310.   end
  1311.   

  1312.   def pattern_boss(plane,turn)
  1313.     @control[turn] += 1
  1314.     if @control[turn] <= 30
  1315.        plane.pic.y += 5 *plane.speed
  1316.     end
  1317.     if @control[turn] > 30 and @control[turn] <= 60
  1318.        plane.pic.x -= 5 * plane.speed
  1319.     end
  1320.     if @control[turn] > 60
  1321.       plane.pic.x += 5 *plane.speed * @direction
  1322.       if (@control[turn] - 120) % 60 == 0
  1323.         @direction = - @direction
  1324.       end
  1325.     end
  1326.   end  
  1327. end

  1328. class Attack_Pattern
  1329.   attr_accessor :control
  1330.   def initialize
  1331.     @control = []
  1332.     for i in 0..100
  1333.       @control[i] = 0
  1334.     end
  1335.   end
  1336.   def pattern(me,turn,plane)
  1337.     case plane.attack_type
  1338.       when 0
  1339.         forward(turn,plane)
  1340.       when 1
  1341.         search(me,turn,plane)
  1342.       when 2
  1343.         spread(turn,plane)
  1344.     end
  1345.   end  
  1346.   
  1347.   
  1348.   def forward(turn,plane)
  1349.     case turn
  1350.       when 10,11,12,15,16
  1351.         forward_1(turn,plane)
  1352.       when 21,22
  1353.         forward_2(turn,plane)
  1354.       when 39,40,41,42,43,44  
  1355.         forward_3(turn,plane)
  1356.       when 70
  1357.         forward_boss(turn,plane)
  1358.       else
  1359.         forward_1(turn,plane)
  1360.     end
  1361.   end
  1362.   
  1363.   def forward_1(turn,plane)
  1364.     @control[turn] += 1
  1365.     if @control[turn] % 10 == 0
  1366.       plane.shotn(plane.bullet_size)
  1367.     end
  1368.   end
  1369.   
  1370.   def forward_2(turn,plane)
  1371.     @control[turn] += 1
  1372.     if @control[turn] % 15 == 0
  1373.       plane.shotn(plane.bullet_size)
  1374.     end
  1375.     if @control[turn] % 15 == 1
  1376.       plane.shotn(plane.bullet_size)
  1377.     end
  1378.     if @control[turn] % 15 == 2
  1379.       plane.shotn(plane.bullet_size)
  1380.     end   
  1381.   end
  1382.   
  1383.   def forward_3(turn,plane)
  1384.     @control[turn] += 1
  1385.     if @control[turn] % 15 == 0
  1386.       plane.shotn(plane.bullet_size)
  1387.     end
  1388.     if @control[turn] % 15 == 1
  1389.       plane.shotn(plane.bullet_size)
  1390.     end
  1391.   end
  1392.   
  1393.   def forward_boss(turn,plane)
  1394.     @control[turn] += 1
  1395.     if @control[turn] % 15 == 0
  1396.       plane.shotn(plane.bullet_size)
  1397.     end
  1398.     if @control[turn] % 15 == 3
  1399.       plane.shotn(plane.bullet_size)
  1400.     end
  1401.     if @control[turn] == 60
  1402.       @control[turn] == 0
  1403.       plane.mode_switch = true
  1404.     end
  1405.   end   
  1406.   
  1407.   def search(me,turn,plane)
  1408.     case turn
  1409.       when 13,14,66,67,68,69
  1410.         search_1(me,turn,plane)
  1411.       when 23,24,25,26,49,50,51,52
  1412.         search_2(me,turn,plane)
  1413.       when 53,64,65
  1414.         search_3(me,turn,plane)
  1415.       when 70
  1416.         search_boss(me,turn,plane)
  1417.       else
  1418.         search_1(me,turn,plane)
  1419.     end
  1420.   end
  1421.   
  1422.   def search_1(me,turn,plane)
  1423.     @control[turn] += 1
  1424.     if @control[turn] % 10 == 0
  1425.       plane.shotn_me(me,plane.bullet_size)
  1426.     end
  1427.   end
  1428.   def search_2(me,turn,plane)
  1429.     @control[turn] += 1
  1430.     if @control[turn] % 15 == 0
  1431.       plane.shotn_me(me,plane.bullet_size)
  1432.     end
  1433.     if @control[turn] % 15 == 1
  1434.       plane.shotn_me(me,plane.bullet_size)
  1435.     end
  1436.     if @control[turn] % 15 == 2
  1437.       plane.shotn_me(me,plane.bullet_size)
  1438.     end
  1439.   end
  1440.   
  1441.   def search_3(me,turn,plane)
  1442.     @control[turn] += 1
  1443.     if @control[turn] % 15 == 0
  1444.       plane.shotn_me(me,plane.bullet_size)
  1445.     end
  1446.     if @control[turn] % 15 == 3
  1447.       plane.shotn_me(me,plane.bullet_size - 1)
  1448.     end
  1449.   end
  1450.   
  1451.   def search_boss(me,turn,plane)
  1452.     @control[turn] += 1
  1453.     if @control[turn] % 10 == 0
  1454.       plane.shotn_me(me,plane.bullet_size)
  1455.     end
  1456.     if @control[turn] % 10 == 1
  1457.       plane.shotn_me(me,plane.bullet_size)
  1458.     end
  1459.     if @control[turn] % 10 == 2
  1460.       plane.shotn_me(me,plane.bullet_size)
  1461.     end
  1462.    
  1463.     if @control[turn]  == 30
  1464.       @control[turn] == 0
  1465.       plane.mode_switch = true
  1466.     end  
  1467.   end
  1468.   
  1469.   def spread(turn,plane)
  1470.     case turn
  1471.       when 45,46
  1472.         spread_1(turn,plane)
  1473.       when 37,38,47,48
  1474.         spread_2(turn,plane)
  1475.       when 70
  1476.         spread_boss(turn,plane)
  1477.       else
  1478.         spread_1(turn,plane)
  1479.     end
  1480.   end

  1481.   def spread_1(turn,plane)
  1482.     @control[turn] += 1
  1483.     if @control[turn] % 15 == 0
  1484.       plane.shotn_spread(plane.bullet_size)
  1485.     end
  1486.     if @control[turn] % 15 == 1
  1487.       plane.shotn_spread(plane.bullet_size - 1)
  1488.     end
  1489.     if @control[turn] % 15 == 2
  1490.       plane.shotn_spread(plane.bullet_size)
  1491.     end
  1492.     if @control[turn] % 15 == 3
  1493.       plane.shotn_spread(plane.bullet_size - 1)
  1494.     end
  1495.   end  
  1496.   def spread_2(turn,plane)
  1497.     @control[turn] += 1
  1498.     if @control[turn] % 10 == 0
  1499.       plane.shotn_spread(plane.bullet_size)
  1500.     end
  1501.   end  

  1502.   def spread_boss(turn,plane)
  1503.     @control[turn] += 1
  1504.     if @control[turn] % 15 == 0
  1505.       plane.shotn_spread(plane.bullet_size)
  1506.     end
  1507.     if @control[turn] % 15 == 2
  1508.       plane.shotn_spread(plane.bullet_size - 1)
  1509.     end
  1510.     if @control[turn] % 15 == 4
  1511.       plane.shotn_spread(plane.bullet_size)
  1512.     end
  1513.     if @control[turn] % 15 == 6
  1514.       plane.shotn_spread(plane.bullet_size - 1)
  1515.     end
  1516.     if control[turn] == 60
  1517.       @control[turn] == 0
  1518.       plane.mode_switch = true
  1519.     end
  1520.   end
  1521. end


  1522. class Bullet
  1523.   attr_accessor :pic
  1524.   attr_accessor :power
  1525.   attr_accessor :type
  1526.   attr_accessor :ratio
  1527.   attr_accessor :ratiox
  1528.   attr_accessor :ratioy
  1529.   def initialize(x)
  1530.     @ratio = 1
  1531.     @power = 1
  1532.     @ratiox = 0
  1533.     @ratioy = 1
  1534.     @type = 0
  1535.     @pic = Sprite.new
  1536.   end
  1537.   
  1538.   def down_fly
  1539.     @pic.y += 10
  1540.   end
  1541.   
  1542.   def up_fly
  1543.     @pic.y -= 20
  1544.   end
  1545.   
  1546.   def search_fly(speed)
  1547.     @pic.x += 10 *speed * @ratiox / Math.hypot(@ratio, 1)
  1548.     @pic.y += 10 *speed * @ratio *@ratioy / Math.hypot(@ratio, 1)
  1549.   end
  1550.   

  1551.   def dispose
  1552.     @pic.dispose
  1553.   end
  1554. end

  1555. class My_Bullet < Bullet
  1556.   def initialize(x)
  1557.     super(x)
  1558.     if x == 1
  1559.       @pic.bitmap = RPG::Cache.picture("bullet_1")
  1560.     elsif x == 2
  1561.       @pic.bitmap = RPG::Cache.picture("bullet_2")
  1562.     end
  1563.   end
  1564. end

  1565. class Enemy_Bullet < Bullet
  1566.   def initialize(x)
  1567.     super(x)
  1568.     if x == 1
  1569.       @power = 1
  1570.       @pic.bitmap = Bitmap.new(64,64)
  1571.       @pic.bitmap.blt(0,0,RPG::Cache.picture("EnemyFire_03"),Rect.new(0,0,64,64))
  1572.     elsif x == 2
  1573.       @power = 2
  1574.       @pic.bitmap = Bitmap.new(128,128)
  1575.       @pic.bitmap.blt(0,0,RPG::Cache.picture("EnemyFire_01"),Rect.new(256,0,128,128))
  1576.     elsif x == 3
  1577.       @power = 3
  1578.       @pic.bitmap = Bitmap.new(128,128)
  1579.       @pic.bitmap.blt(0,0,RPG::Cache.picture("EnemyFire_02"),Rect.new(256,0,128,128))
  1580.     elsif x == 4
  1581.       @power = 4
  1582.       @pic.bitmap = Bitmap.new(128,128)
  1583.       @pic.bitmap.blt(0,0,RPG::Cache.picture("bullet_3"),Rect.new(0,0,128,128))
  1584.     end
  1585.   end
  1586. end

  1587. class Items
  1588.   attr_accessor :pic
  1589.   def initialize(x,y)
  1590.     @pic = Sprite.new
  1591.     @pic.x = x
  1592.     @pic.y = y
  1593.   end
  1594.   
  1595.   def move
  1596.     @pic.y += 1
  1597.   end
  1598.   
  1599.   def dispose
  1600.     @pic.dispose
  1601.   end
  1602. end

  1603. class Bomb < Items
  1604.   attr_accessor :pic
  1605.   def initialize(x,y)
  1606.     super(x,y)
  1607.     @pic.bitmap = RPG::Cache.picture("bomb")
  1608.   end
  1609. end

  1610. class Level < Items
  1611.   attr_accessor :pic
  1612.   def initialize(x,y)
  1613.     super(x,y)
  1614.     @pic.bitmap = RPG::Cache.picture("level")
  1615.   end
  1616. end

  1617. class Power < Items
  1618.   attr_accessor :pic
  1619.   def initialize(x,y)
  1620.     super(x,y)
  1621.     @pic.bitmap = RPG::Cache.picture("power")
  1622.   end
  1623. end

  1624. class Food < Items
  1625.   attr_accessor :pic
  1626.   def initialize(x,y)
  1627.     super(x,y)
  1628.     @pic.bitmap = RPG::Cache.picture("food")
  1629.   end
  1630. end
  1631.   

  1632. class Window_Result < Window_Base
  1633.   def initialize
  1634.     super(20, 400, 500, 100)
  1635.     self.contents = Bitmap.new(width - 32, height - 32)
  1636.     self.contents.font.name = ["方正粗活意简体","方正粗活意简体"]
  1637.     self.opacity = 0
  1638.   end
  1639.   
  1640.   def refresh(hp,score,destroy,bomb)
  1641.     self.contents.clear
  1642.     self.contents.font.size = 22
  1643.     self.contents.font.color = Color.new(255,20,20)
  1644.     self.contents.font.bold = false
  1645.     self.contents.draw_text(0,20,64,32,"生命:")
  1646.     self.contents.draw_text(240,20,64,32,"分数:#{score}")
  1647.     self.contents.draw_text(320,20,64,32,"灭敌数:#{destroy}")
  1648.     self.contents.draw_text(400,20,64,32,"炸弹数:#{bomb}")
  1649.     if hp >= 70
  1650.       self.contents.fill_rect(55, 27, hp * 0.8, 20,Color.new(84,121,241))
  1651.     elsif hp >= 40
  1652.       self.contents.fill_rect(55, 27, hp * 0.8, 20,Color.new(240,200,64))
  1653.     else
  1654.       self.contents.fill_rect(55, 27, hp * 0.8, 20,Color.new(231,81,81))
  1655.     end
  1656.   end
  1657. end

  1658. class Window_Show < Window_Base
  1659.   def initialize
  1660.     super(230, 140, 300, 300)
  1661.     self.contents = Bitmap.new(width - 32, height - 32)
  1662.     self.contents.font.name = ["方正粗活意简体","方正粗活意简体"]
  1663.     self.opacity = 0
  1664.   end
  1665.   
  1666.   def refresh(turn)
  1667.     self.contents.clear
  1668.     self.contents.font.size = 80
  1669.     self.contents.font.color = Color.new(255,80,20)
  1670.     self.contents.font.bold = false
  1671.     case turn
  1672.       when 0
  1673.         self.contents.draw_text(0,0,150,150,"开始")
  1674.       when 1
  1675.         self.contents.draw_text(0,0,150,150,"警告")
  1676.       when 2
  1677.         self.contents.draw_text(0,0,150,150,"胜利")
  1678.     end
  1679.   end
  1680. end

  1681. class Window_Boss < Window_Base
  1682.   def initialize
  1683.     super(20, 0, 500, 100)
  1684.     self.contents = Bitmap.new(width - 32, height - 32)
  1685.     self.contents.font.name = ["方正粗活意简体","方正粗活意简体"]
  1686.     self.opacity = 0
  1687.   end
  1688.   
  1689.   def refresh(hp)
  1690.     self.contents.clear
  1691.     self.contents.font.size = 22
  1692.     self.contents.font.color = Color.new(255,20,20)
  1693.     self.contents.font.bold = false
  1694.     self.contents.draw_text(0,20,64,32,"Boss:")
  1695.     if hp >= 230
  1696.       self.contents.fill_rect(55, 27, 0.4* hp ,20,Color.new(73,188,46))
  1697.     elsif hp >= 200
  1698.       self.contents.fill_rect(55, 27, 0.4* hp,20,Color.new(240,200,64))
  1699.     else
  1700.       self.contents.fill_rect(55, 27, 0.4* hp ,20,Color.new(231,81,81))
  1701.     end
  1702.   end
  1703. end
复制代码
梦石
0
星屑
1232
在线时间
1017 小时
注册时间
2011-4-30
回帖
1464
发表于 2015-5-3 05:59:12 | 显示全部楼层
本帖最后由 汪汪 于 2015-5-3 06:03 编辑

def my_death
    if @me.hp <=0 and @judge_over
game_over
  end
end
改成
def my_death
    if @me.hp <=0 and @judge_over
 $scene = Scene_Map.new
  end
end
试试

下面这个 添加是一句应该就可以了
def refresh(hp,score,destroy,bomb)
某变量=score  自己设置是哪个变量
    self.contents.clear
    self.contents.font.size = 22
    self.contents.font.color = Color.new(255,20,20)
    self.contents.font.bold = false
    self.contents.draw_text(0,20,64,32,"生命:")
    self.contents.draw_text(240,20,64,32,"分数:#{score}")
    self.contents.draw_text(320,20,64,32,"灭敌数:#{destroy}")
    self.contents.draw_text(400,20,64,32,"炸弹数:#{bomb}")
    if hp >= 70
      self.contents.fill_rect(55, 27, hp * 0.8, 20,Color.new(84,121,241))
    elsif hp >= 40
      self.contents.fill_rect(55, 27, hp * 0.8, 20,Color.new(240,200,64))
    else
      self.contents.fill_rect(55, 27, hp * 0.8, 20,Color.new(231,81,81))
    end
  end
end

点评

谢谢亲,不过 $scene = Scene_Map.new这样我试过,HP=0后只会自动返回地图,不会提示失败呢。  发表于 2015-5-4 11:11

评分

参与人数 1星屑 +100 梦石 +1 收起 理由
hys111111 + 100 + 1 认可答案

查看全部评分

回复

使用道具 举报

梦石
0
星屑
50
在线时间
41 小时
注册时间
2014-8-7
回帖
53
 楼主| 发表于 2015-5-4 11:12:51 | 显示全部楼层
汪汪 发表于 2015-5-3 05:59
def my_death
    if @me.hp = 40
      self.contents.fill_rect(55, 27, hp * 0.8, 20,Color.new(2 ...

谢谢亲,不过 $scene = Scene_Map.new这样我试过,HP=0后只会自动返回地图,不会提示失败呢。

点评

这一句上面加上一个变量操作,比如把 变量1="失败" 然后在地图上添加一个判断,调用事件就可以了。  发表于 2015-5-4 19:09
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册会员

本版积分规则

Powered by Discuz! X5.0 © 2001-2026 Discuz! Team.

在本版发帖返回顶部