设为首页收藏本站|繁體中文

Project1

 找回密码
 注册会员
搜索
查看: 778|回复: 2
打印 上一主题 下一主题

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

[复制链接]

Lv1.梦旅人

梦石
0
星屑
50
在线时间
41 小时
注册时间
2014-8-7
帖子
67
跳转到指定楼层
1
发表于 2015-5-3 02:06:06 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式

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

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

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

想请问一下,如何让HP=0时不gameovr 而是像胜利时一样 提示:失败,然后返回当前地图呢?好像是在123行改,但是不知道怎么改o(╯□╰)o
还想请问如果用变量记录获得的分数? 谢谢大
RUBY 代码复制
  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.  
  127.   def hit_you_me
  128.     for i in 0..@enemy_num
  129.       if @enemy_switch[i]
  130.         hit_enemy(i)
  131.       end
  132.       hit_myself(i)
  133.       enemy_bullet_move(i)
  134.     end   
  135.   end  
  136.   def enemy_animation
  137.     for i in 0..@enemy_num
  138.       if @blast_switch[i]
  139.         @blast[i].animation
  140.         if @blast[i].control == -1
  141.            @blast[i].dispose
  142.            @enemy[i].dispose
  143.            @blast_switch[i] = false
  144.         end
  145.       end
  146.     end
  147.     for i in 0..@enemy_num
  148.       if @blast_hit_switch[i]
  149.         @blast_hit[i].animation
  150.         if @blast_hit[i].control == -1
  151.            @blast_hit[i].dispose
  152.            @blast_hit_switch[i] = false
  153.         end
  154.       end
  155.     end
  156.   end
  157.   def me_animation
  158.     if @my_blast_hit_switch
  159.       @my_blast_hit.animation
  160.       if @my_blast_hit.control == -1
  161.         @my_blast_hit.dispose
  162.         @my_blast_hit_switch = false
  163.       end
  164.     end
  165.     if @my_blast_switch
  166.       @my_blast.animation
  167.       if @my_blast.control == -1
  168.         @me.dispose
  169.         $scene = Scene_Gameover.new
  170.       end
  171.     end  
  172.   end
  173.   def move_items
  174.     if @bomb_switch
  175.       @bomb.move
  176.       if @bomb.pic.y >= 600
  177.         @bomb.dispose
  178.         @bomb_switch = false
  179.       end
  180.     end
  181.     if @level_switch
  182.       @level.move
  183.       if @level.pic.y >= 600
  184.         @level.dispose
  185.         @level_switch = false
  186.       end
  187.     end  
  188.  
  189.     if @power_switch
  190.       @power.move
  191.       if @power.pic.y >= 600
  192.         @power.dispose
  193.         @power_switch = false
  194.       end
  195.     end
  196.     if @food_switch
  197.       @food.move
  198.       if @food.pic.y >= 600
  199.         @food.dispose
  200.         @food_switch = false
  201.       end
  202.     end   
  203.   end
  204.   def bomb_blast
  205.     if Input.trigger?(Input::A)
  206.       if @bomb_num > 0 and @bomb_ctrl == true
  207.         Audio.se_play("Audio/SE/Explosion02")
  208.         @bomb_ctrl = false
  209.         @bomb_num -= 1
  210.         for i in 0..@enemy_num
  211.           if @enemy_switch[i]
  212.             @enemy[i].hp -= 10
  213.           end
  214.         end
  215.         for i in 0..5
  216.           @bomb_blast_switch[i] = true
  217.           case i
  218.             when 0..2
  219.               @bomb_blast[i] = Blast_Explosion2.new( i * 200,50)
  220.             when 3..5
  221.               @bomb_blast[i] = Blast_Explosion2.new( (i - 3) * 200,220)
  222.           end            
  223.         end        
  224.       end
  225.     end
  226.     for i in 0..5
  227.       if @bomb_blast_switch[i]
  228.         @bomb_blast[i].animation
  229.         if @bomb_blast[i].control == -1
  230.            @bomb_blast[i].dispose
  231.            @bomb_blast_switch[i] = false
  232.            @bomb_ctrl = true
  233.         end
  234.       end
  235.     end     
  236.   end  
  237.   def eat_items
  238.     if @bomb_switch
  239.       if @me.eat_bomb(@bomb.pic.x,@bomb.pic.y)
  240.         @bomb_num += 1
  241.         @bomb.dispose
  242.         @bomb_switch = false
  243.       end
  244.     end
  245.  
  246.     if @level_switch
  247.       if @me.eat_level(@level.pic.x,@level.pic.y)
  248.         @level.dispose
  249.         @level_switch = false
  250.         if @me.level < 4
  251.           @me.level += 2
  252.         end
  253.       end
  254.     end  
  255.     if @power_switch
  256.       if @me.eat_power(@power.pic.x,@power.pic.y)
  257.         @me.power += 1
  258.         @power.dispose
  259.         @power_switch = false
  260.       end
  261.     end     
  262.     if @food_switch
  263.       if @me.eat_food(@food.pic.x,@food.pic.y)
  264.         @me.hp += 50
  265.         if @me.hp >=200
  266.           @me.hp = 200
  267.         end
  268.         @food.dispose
  269.         @food_switch = false
  270.       end
  271.     end     
  272.   end
  273.   def enemy_leave
  274.     for i in 0..@enemy_num
  275.       if @enemy_switch[i]
  276.         if @enemy[i].pic.x < -100 or @enemy[i].pic.x > 700 or @enemy[i].pic.y > 500 or @enemy[i].pic.y < -150
  277.           @enemy[i].dispose
  278.           @enemy_switch[i] = false
  279.         end
  280.       end
  281.     end
  282.   end
  283.   def enemy_pattern
  284.    if @speed == 5
  285.       @result.refresh(@me.hp,@score,@destroy,@bomb_num)
  286.       for i in 0..@enemy_num
  287.         if @enemy_switch[i]
  288.           @fly_pattern.pattern(@enemy[i],i)
  289.           @attack_pattern.pattern(@me,i,@enemy[i])
  290.         end
  291.       end
  292.       @speed = 0
  293.     end  
  294.   end
  295.  
  296.  
  297.   def game_process
  298.     if @process < 100
  299.       @window_show.refresh(0)
  300.     elsif @process == 100
  301.       @window_show.contents.clear
  302.       Audio.se_play("Audio/SE/start")
  303.     end
  304.  
  305.     if @process <= 250 and @process >= 50 and @process % 50 == 0
  306.       @enemy[@enemy_num] = Enemy_Li.new(-80,100)
  307.       @enemy_switch[@enemy_num] = true
  308.       @bullet_switch[@enemy_num] = true
  309.       @enemy_num += 1
  310.       @enemy[@enemy_num] = Enemy_Li.new(640,100)
  311.       @enemy_switch[@enemy_num] = true
  312.       @bullet_switch[@enemy_num] = true
  313.       @enemy_num += 1
  314.     end
  315.  
  316.     if @process == 500
  317.       @enemy[@enemy_num] = Enemy_Green.new(500,-80)
  318.       @enemy_switch[@enemy_num] = true
  319.       @bullet_switch[@enemy_num] = true
  320.       @enemy_num += 1
  321.     end
  322.     if @process == 550
  323.       @enemy[@enemy_num] = Enemy_Green.new(400,-80)
  324.       @enemy_switch[@enemy_num] = true
  325.       @bullet_switch[@enemy_num] = true
  326.       @enemy_num += 1
  327.     end
  328.     if @process == 600
  329.       @enemy[@enemy_num] = Enemy_Green.new(300,-80)
  330.       @enemy_switch[@enemy_num] = true
  331.       @bullet_switch[@enemy_num] = true
  332.       @enemy_num += 1
  333.       @enemy[@enemy_num] = Enemy_Toon.new(-80,150)
  334.       @enemy_switch[@enemy_num] = true
  335.       @bullet_switch[@enemy_num] = true
  336.       @enemy_num += 1
  337.       @enemy[@enemy_num] = Enemy_Toon.new(640,150)
  338.       @enemy_switch[@enemy_num] = true
  339.       @bullet_switch[@enemy_num] = true
  340.       @enemy_num += 1
  341.  
  342.     end
  343.     if @process == 650
  344.       @enemy[@enemy_num] = Enemy_Green.new(200,-80)
  345.       @enemy_switch[@enemy_num] = true
  346.       @bullet_switch[@enemy_num] = true
  347.       @enemy_num += 1
  348.     end
  349.     if @process == 700
  350.       @enemy[@enemy_num] = Enemy_Green.new(100,-80)
  351.       @enemy_switch[@enemy_num] = true
  352.       @bullet_switch[@enemy_num] = true
  353.       @enemy_num += 1
  354.     end
  355.  
  356.     if @process <= 900 and @process >= 800 and @process % 100 == 0
  357.       @enemy[@enemy_num] = Enemy_Li.new(-80,100)
  358.       @enemy_switch[@enemy_num] = true
  359.       @bullet_switch[@enemy_num] = true
  360.       @enemy_num += 1
  361.       @enemy[@enemy_num] = Enemy_Li.new(640,100)
  362.       @enemy_switch[@enemy_num] = true
  363.       @bullet_switch[@enemy_num] = true
  364.       @enemy_num += 1
  365.     end
  366.  
  367.     if @process == 920
  368.       @enemy[@enemy_num] = Enemy_Jit.new(100,-80)
  369.       @enemy_switch[@enemy_num] = true
  370.       @bullet_switch[@enemy_num] = true
  371.       @enemy_num += 1
  372.       @enemy[@enemy_num] = Enemy_Jit.new(500,-80)
  373.       @enemy_switch[@enemy_num] = true
  374.       @bullet_switch[@enemy_num] = true
  375.       @enemy_num += 1
  376.     end
  377.     if @process == 950
  378.       @enemy[@enemy_num] = Enemy_God.new(-80,100)
  379.       @enemy_switch[@enemy_num] = true
  380.       @bullet_switch[@enemy_num] = true
  381.       @enemy_num += 1
  382.       @enemy[@enemy_num] = Enemy_God.new(640,100)
  383.       @enemy_switch[@enemy_num] = true
  384.       @bullet_switch[@enemy_num] = true
  385.       @enemy_num += 1
  386.     end
  387.  
  388.     if @process == 1100
  389.       @enemy[@enemy_num] = Enemy_X.new(100,-80)
  390.       @enemy_switch[@enemy_num] = true
  391.       @bullet_switch[@enemy_num] = true
  392.       @enemy_num += 1
  393.       @enemy[@enemy_num] = Enemy_X.new(500,-80)
  394.       @enemy_switch[@enemy_num] = true
  395.       @bullet_switch[@enemy_num] = true
  396.       @enemy_num += 1
  397.     end   
  398.  
  399.  
  400.     if @process <= 1350 and @process >= 1250 and @process % 50 == 0
  401.       @enemy[@enemy_num] = Enemy_Green.new(-80,200)
  402.       @enemy_switch[@enemy_num] = true
  403.       @bullet_switch[@enemy_num] = true
  404.       @enemy_num += 1
  405.       @enemy[@enemy_num] = Enemy_Green.new(640,200)
  406.       @enemy_switch[@enemy_num] = true
  407.       @bullet_switch[@enemy_num] = true
  408.       @enemy_num += 1
  409.     end
  410.  
  411.     if @process <= 1450 and @process >= 1400 and @process % 50 == 0
  412.       @enemy[@enemy_num] = Enemy_Li.new(-80,100)
  413.       @enemy_switch[@enemy_num] = true
  414.       @bullet_switch[@enemy_num] = true
  415.       @enemy_num += 1
  416.       @enemy[@enemy_num] = Enemy_Li.new(640,100)
  417.       @enemy_switch[@enemy_num] = true
  418.       @bullet_switch[@enemy_num] = true
  419.       @enemy_num += 1
  420.     end
  421.  
  422.     if @process == 1600
  423.       @enemy[@enemy_num] = Enemy_Red.new(-80,100)
  424.       @enemy_switch[@enemy_num] = true
  425.       @bullet_switch[@enemy_num] = true
  426.       @enemy_num += 1
  427.       @enemy[@enemy_num] = Enemy_Red.new(640,100)
  428.       @enemy_switch[@enemy_num] = true
  429.       @bullet_switch[@enemy_num] = true
  430.       @enemy_num += 1
  431.     end
  432.  
  433.     if @process <= 1750 and @process >= 1650 and @process % 50 == 0
  434.       @enemy[@enemy_num] = Enemy_Ye.new(-80,-80)
  435.       @enemy_switch[@enemy_num] = true
  436.       @bullet_switch[@enemy_num] = true
  437.       @enemy_num += 1
  438.       @enemy[@enemy_num] = Enemy_Ye.new(640,-80)
  439.       @enemy_switch[@enemy_num] = true
  440.       @bullet_switch[@enemy_num] = true
  441.       @enemy_num += 1
  442.     end
  443.  
  444.     if @process == 1900
  445.       @enemy[@enemy_num] = Enemy_Jp.new(-80,50)
  446.       @enemy_switch[@enemy_num] = true
  447.       @bullet_switch[@enemy_num] = true
  448.       @enemy_num += 1
  449.       @enemy[@enemy_num] = Enemy_Jp.new(640,50)
  450.       @enemy_switch[@enemy_num] = true
  451.       @bullet_switch[@enemy_num] = true
  452.       @enemy_num += 1
  453.     end
  454.  
  455.     if @process == 2000
  456.       @enemy[@enemy_num] = Enemy_Red.new(100,500)
  457.       @enemy_switch[@enemy_num] = true
  458.       @bullet_switch[@enemy_num] = true
  459.       @enemy_num += 1
  460.       @enemy[@enemy_num] = Enemy_Red.new(400,500)
  461.       @enemy_switch[@enemy_num] = true
  462.       @bullet_switch[@enemy_num] = true
  463.       @enemy_num += 1
  464.     end
  465.  
  466.     if @process <= 2100 and @process >= 2000 and @process % 100 == 0
  467.       @enemy[@enemy_num] = Enemy_God.new(-80,150)
  468.       @enemy_switch[@enemy_num] = true
  469.       @bullet_switch[@enemy_num] = true
  470.       @enemy_num += 1
  471.       @enemy[@enemy_num] = Enemy_God.new(640,250)
  472.       @enemy_switch[@enemy_num] = true
  473.       @bullet_switch[@enemy_num] = true
  474.       @enemy_num += 1
  475.     end
  476.  
  477.     if @process == 2200
  478.       @enemy[@enemy_num] = Enemy_LX.new(250,-80)
  479.       @enemy_switch[@enemy_num] = true
  480.       @bullet_switch[@enemy_num] = true
  481.       @enemy_num += 1
  482.     end
  483.  
  484.     if @process <= 2350 and @process >= 2250 and @process % 50 == 0
  485.       @enemy[@enemy_num] = Enemy_Green.new(-80,200)
  486.       @enemy_switch[@enemy_num] = true
  487.       @bullet_switch[@enemy_num] = true
  488.       @enemy_num += 1
  489.       @enemy[@enemy_num] = Enemy_Green.new(640,200)
  490.       @enemy_switch[@enemy_num] = true
  491.       @bullet_switch[@enemy_num] = true
  492.       @enemy_num += 1
  493.     end
  494.  
  495.     if @process <= 2600 and @process >= 2500 and @process % 100 == 0
  496.       @enemy[@enemy_num] = Enemy_Li.new(-80,200)
  497.       @enemy_switch[@enemy_num] = true
  498.       @bullet_switch[@enemy_num] = true
  499.       @enemy_num += 1
  500.       @enemy[@enemy_num] = Enemy_Li.new(640,200)
  501.       @enemy_switch[@enemy_num] = true
  502.       @bullet_switch[@enemy_num] = true
  503.       @enemy_num += 1
  504.     end
  505.     if @process == 2700
  506.       @enemy[@enemy_num] = Enemy_LX.new(-80,50)
  507.       @enemy_switch[@enemy_num] = true
  508.       @bullet_switch[@enemy_num] = true
  509.       @enemy_num += 1
  510.       @enemy[@enemy_num] = Enemy_LX.new(640,50)
  511.       @enemy_switch[@enemy_num] = true
  512.       @bullet_switch[@enemy_num] = true
  513.       @enemy_num += 1
  514.     end
  515.     if @process <= 2800 and @process >= 2750 and @process % 50 == 0
  516.       @enemy[@enemy_num] = Enemy_Toon.new(-80,250)
  517.       @enemy_switch[@enemy_num] = true
  518.       @bullet_switch[@enemy_num] = true
  519.       @enemy_num += 1
  520.       @enemy[@enemy_num] = Enemy_Toon.new(640,250)
  521.       @enemy_switch[@enemy_num] = true
  522.       @bullet_switch[@enemy_num] = true
  523.       @enemy_num += 1
  524.     end
  525.  
  526.     if @process < 3100 and @process>= 3000
  527.     @window_show.refresh(1)
  528.     elsif @process == 3100
  529.       @window_show.contents.clear
  530.       Audio.bgm_stop
  531.       Audio.se_play("Audio/SE/warning")
  532.     end
  533.  
  534.     if @process == 3200
  535.       @enemy[@enemy_num] = Enemy_Boss.new(150,-120)
  536.       @enemy_switch[@enemy_num] = true
  537.       @bullet_switch[@enemy_num] = true
  538.       @boss_switch = true
  539.       @enemy_num += 1
  540.       Audio.bgm_play("Audio/BGM/action_world2")
  541.     end
  542.     if @victory and @record == 0
  543.       Audio.me_play("Audio/ME/victory")
  544.       @record = @process
  545.     end
  546.  
  547.     if @victory
  548.       if @process != @record + 100
  549.         @window_show.refresh(2)
  550.       else
  551.          $scene = Scene_Map.new
  552.       end
  553.     end
  554.   end
  555.  
  556.  
  557.   def hit_myself(turn)
  558.     if @bullet_switch[turn]
  559.       for i in 0..@enemy[turn].bullet_num
  560.         if @enemy[turn].attack[i]
  561.           if(@me.hit(@enemy[turn].bullet[i].pic.x,@enemy[turn].bullet[i].pic.y,@enemy[turn].bullet[i].power))
  562.             if @me.hp > 0 and @my_blast_hit_switch == false
  563.               @my_blast_hit_switch = true
  564.               @my_blast_hit = Blast_Hit.new(@me.pic.x - 30 ,@me.pic.y - 30)
  565.             end
  566.             @enemy[turn].bullet[i].dispose
  567.             @enemy[turn].attack[i] = false   
  568.           end
  569.         end
  570.       end
  571.     end
  572.   end
  573.  
  574.   def game_over
  575.     Audio.se_play("Audio/SE/Explosion04")
  576.     @my_blast = Blast_Explosion.new(@me.pic.x - 25,@me.pic.y - 25)
  577.     @my_blast_switch = true
  578.     @judge_over = false
  579.   end
  580.  
  581.  
  582.   def hit_enemy(turn)
  583.     for i in [email]0..@me.bullet_num[/email]
  584.       if  @me.attack[i]
  585.         if(@enemy[turn].hit(@me.bullet[i].pic.x,@me.bullet[i].pic.y,@me.power))
  586.           if @enemy[turn].hp > 0 and @blast_hit_switch[turn] == false
  587.             @blast_hit[turn] = Blast_Hit.new(@enemy[turn].pic.x- 20 ,@enemy[turn].pic.y)
  588.             @blast_hit_switch[turn] = true
  589.           end
  590.           @me.bullet[i].dispose
  591.           @me.attack[i] = false
  592.         end
  593.       end
  594.     end
  595.  
  596.     if @enemy[turn].hp <= 0
  597.       @score += 10 * @enemy[turn].level
  598.       @destroy += 1
  599.       Audio.se_play("Audio/SE/Explosion01")
  600.       @blast[turn] = Blast_Explosion.new(@enemy[turn].pic.x - 30,@enemy[turn].pic.y)
  601.       @blast_switch[turn] = true
  602.       @enemy_switch[turn] = false
  603.       if turn == 4 or turn == 21 or turn == 53 or turn == 64
  604.         @bomb = Bomb.new(@enemy[turn].pic.x + 50,@enemy[turn].pic.y + 40)
  605.         @bomb_switch = true
  606.       end
  607.       if turn == 12 or  turn == 34 or turn == 47 or turn == 65
  608.         @level = Level.new(@enemy[turn].pic.x + 50,@enemy[turn].pic.y + 40)
  609.         @level_switch = true
  610.       end
  611.       if turn == 33
  612.         @power = Power.new(@enemy[turn].pic.x + 50,@enemy[turn].pic.y + 40)
  613.         @power_switch = true
  614.       end
  615.       if turn == 30 or turn == 66
  616.         @food = Food.new(@enemy[turn].pic.x + 50,@enemy[turn].pic.y + 40)
  617.         @food_switch = true
  618.       end
  619.       if turn == 70
  620.         @victory = true
  621.       end
  622.     end
  623.   end
  624.  
  625.  
  626.   def enemy_bullet_move(turn)
  627.     if @bullet_switch[turn]
  628.       for i in 0..@enemy[turn].bullet_num
  629.          if @enemy[turn].attack[i]
  630.            if  @enemy[turn].bullet[i].type == 0
  631.              @enemy[turn].bullet[i].down_fly
  632.            end
  633.            if  @enemy[turn].bullet[i].type == 1
  634.              @enemy[turn].bullet[i].search_fly(1)
  635.            end
  636.            if  @enemy[turn].bullet[i].type == 2
  637.              @enemy[turn].bullet[i].search_fly(1)
  638.            end           
  639.            if @enemy[turn].bullet[i].pic.y >=500
  640.              @enemy[turn].attack[i]=false
  641.              @enemy[turn].bullet[i].dispose
  642.            end            
  643.          end
  644.       end
  645.     end
  646.   end
  647.  
  648.  
  649.   def my_bullet_move
  650.     for i in @[email]count..@me.bullet_num[/email]
  651.       if  @me.attack[i]
  652.         @me.bullet[i].search_fly(2)
  653.         if @me.bullet[i].pic.y <= -60
  654.           @me.attack[i]=false
  655.           @me.bullet[i].dispose
  656.           @count += 1
  657.         end
  658.       end
  659.     end
  660.   end
  661.  
  662.   def pl_move
  663.     if Input.trigger?(Input::UP) or Input.repeat?(Input::UP)
  664.        if @me.pic.y>=0
  665.          @me.pic.y-=20
  666.        end
  667.     end
  668.     if Input.trigger?(Input::RIGHT) or Input.repeat?(Input::RIGHT)
  669.        if @me.pic.x<=520
  670.          @me.pic.x+=20
  671.        end
  672.     end
  673.     if Input.trigger?(Input::DOWN) or Input.repeat?(Input::DOWN)
  674.        if @me.pic.y <=380
  675.          @me.pic.y+=20
  676.        end
  677.     end
  678.     if Input.trigger?(Input::LEFT) or Input.repeat?(Input::LEFT)
  679.        if @me.pic.x>=0
  680.          @me.pic.x-=20
  681.        end
  682.     end
  683.   end
  684. end
  685.  
  686.  
  687.  
  688. class My_Plane
  689.   attr_accessor :pic
  690.   attr_accessor :hp
  691.   attr_accessor :power
  692.   attr_accessor :level
  693.   attr_accessor :bullet
  694.   attr_accessor :bullet_num
  695.   attr_accessor :attack
  696.   def initialize
  697.     @hp = 200
  698.     @attack  = false
  699.     @level = 0
  700.     @power = 1
  701.     @pic = Sprite.new
  702.     @pic.x = 300
  703.     @pic.y = 360
  704.     @pic.bitmap = RPG::Cache.picture("BluePlane")
  705.     @attack = []
  706.     @bullet = []
  707.     @bullet_num = 0
  708.   end
  709.  
  710.  
  711.   def eat_bomb(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/eatbomb")
  714.       return true
  715.     else
  716.       return false
  717.     end
  718.   end
  719.  
  720.   def eat_level(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/eatlevel")
  723.       return true
  724.     else
  725.       return false
  726.     end
  727.   end
  728.  
  729.   def eat_power(x,y)
  730.     if x <= @pic.x + 80 and x >= @pic.x + 20 and y <= @pic.y + 70 and y >= @pic.y
  731.       Audio.se_play("Audio/SE/eatpower")
  732.       return true
  733.     else
  734.       return false
  735.     end
  736.   end
  737.  
  738.   def eat_food(x,y)
  739.     if x <= @pic.x + 80 and x >= @pic.x + 20 and y <= @pic.y + 70 and y >= @pic.y
  740.       Audio.se_play("Audio/SE/eatlevel")
  741.       return true
  742.     else
  743.       return false
  744.     end
  745.   end
  746.  
  747.   def shotn_spread
  748.     for i in 0..@level
  749.       shot_spread(i)
  750.     end
  751.   end
  752.  
  753.   def shot_spread(place)
  754.     Audio.se_play("Audio/SE/destroyer_lazer1")
  755.     @bullet[@bullet_num] = My_Bullet.new(@power)
  756.     angle = Math::PI * (place + 1) / (@level + 2)  
  757.     x = Math.cos(angle)
  758.     y = Math.sin(angle)
  759.     if x  == 0
  760.       @bullet[@bullet_num].ratiox = 0
  761.       @bullet[@bullet_num].ratio = 1
  762.       @bullet[@bullet_num].ratioy = -1
  763.     else
  764.       @bullet[@bullet_num].ratio = y / x
  765.       if @bullet[@bullet_num].ratio > 0
  766.         @bullet[@bullet_num].ratiox =  -1
  767.         @bullet[@bullet_num].ratioy = -1
  768.       else
  769.         @bullet[@bullet_num].ratiox = 1
  770.         @bullet[@bullet_num].ratioy = 1
  771.       end
  772.     end
  773.     if @power == 1
  774.       @bullet[@bullet_num].pic.x = @pic.x - 40 * Math.cos(angle) + 30
  775.       @bullet[@bullet_num].pic.y = @pic.y + 40 * Math.sin(angle) - 30
  776.     elsif @power ==2
  777.       @bullet[@bullet_num].pic.x = @pic.x - 40 * Math.cos(angle)
  778.       @bullet[@bullet_num].pic.y = @pic.y + 40 * Math.sin(angle) - 60
  779.     end
  780.     @attack[@bullet_num] = true
  781.     @bullet_num += 1
  782.   end  
  783.  
  784.  
  785.  
  786.  
  787.   def hit(x,y,power)
  788.     if x >= @pic.x  and x <= @pic.x + 70 and y >= @pic.y and y <= @pic.y + 40
  789.       @hp -= power
  790.       Audio.se_play("Audio/SE/lazer_hit")
  791.       return true
  792.     end
  793.     return false
  794.   end
  795.  
  796.   def dispose
  797.     @pic.dispose
  798.   end
  799. end
  800.  
  801.  
  802. class  Enemy_Plane
  803.   attr_accessor :pic
  804.   attr_accessor :boss_suit
  805.   attr_accessor :width
  806.   attr_accessor :hp
  807.   attr_accessor :power
  808.   attr_accessor :level
  809.   attr_accessor :speed
  810.   attr_accessor :attack_type
  811.   attr_accessor :bullet
  812.   attr_accessor :bullet_size
  813.   attr_accessor :bullet_num
  814.   attr_accessor :attack
  815.   def initialize(x,y)
  816.     @pic = Sprite.new
  817.     @pic.x = x  
  818.     @pic.y = y
  819.     @level = 1
  820.     @power = 1
  821.     @boss_suit = 0
  822.     @speed = 1
  823.     @bullet_size = 0
  824.     @attack_type = 0
  825.     @bullet_num = 0
  826.     @width = 128
  827.     @bullet = []
  828.     @attack  = []
  829.   end
  830.  
  831.   def shot_forward(place,num)
  832.     Audio.se_play("Audio/SE/117-Fire01")
  833.     @bullet[@bullet_num] = Enemy_Bullet.new(@power)
  834.     @bullet[@bullet_num].type = 0
  835.     if @power == 1
  836.       @bullet[@bullet_num].pic.x = @pic.x + (place + 1) * @width/ (num + 2) - 30 + @boss_suit
  837.     else
  838.       @bullet[@bullet_num].pic.x = @pic.x + (place + 1) * @width/ (num + 2) - 60+ @boss_suit
  839.     end
  840.     @bullet[@bullet_num].pic.y = @pic.y + @width / 3+ @boss_suit
  841.     @attack[@bullet_num] = true
  842.     @bullet_num += 1
  843.   end
  844.  
  845.   def shotn(num)
  846.     for i in 0..num
  847.       shot_forward(i,num)
  848.     end
  849.   end
  850.  
  851.   def shotn_me(plane,num)
  852.     for i in 0..num
  853.       shot_me(plane,i,num)
  854.     end
  855.   end
  856.  
  857.   def shot_me(plane,place,num)
  858.     Audio.se_play("Audio/SE/117-Fire01")
  859.     @bullet[@bullet_num] = Enemy_Bullet.new(@power)
  860.     @bullet[@bullet_num].type = 1
  861.     x = (plane.pic.x - pic.x) *1.0
  862.     y = plane.pic.y - pic.y
  863.     if x == 0
  864.       @bullet[@bullet_num].ratiox = 0
  865.       if y >= 0
  866.         @bullet[@bullet_num].ratio = 1
  867.       else
  868.         @bullet[@bullet_num].ratio = -1
  869.       end
  870.     else
  871.       @bullet[@bullet_num].ratio = y / x
  872.       if @bullet[@bullet_num].ratio == 0
  873.         if x >= 0
  874.           @bullet[@bullet_num].ratiox = 1
  875.         else
  876.           @bullet[@bullet_num].ratiox = -1
  877.         end
  878.       else
  879.         if x > 0
  880.           @bullet[@bullet_num].ratiox = 1
  881.         else
  882.           @bullet[@bullet_num].ratiox = -1
  883.           @bullet[@bullet_num].ratioy = -1
  884.         end
  885.       end
  886.     end
  887.     if @power == 1
  888.       @bullet[@bullet_num].pic.x = @pic.x + (place + 1) * width/ (num + 2) - 30+ @boss_suit
  889.     elsif @power == 4
  890.       @bullet[@bullet_num].pic.x = @pic.x + (place + 1) * width/ (num + 2) - 60+ @boss_suit
  891.     else
  892.       @bullet[@bullet_num].pic.x = @pic.x + (place + 1) * width/ (num + 2) - 100+ @boss_suit
  893.     end
  894.     @bullet[@bullet_num].pic.y = @pic.y + 60+ @boss_suit
  895.     @attack[@bullet_num] = true
  896.     @bullet_num += 1
  897.   end
  898.  
  899.   def shotn_spread(num)
  900.     for i in 0..num
  901.       shot_spread(i,num)
  902.     end
  903.   end
  904.  
  905.   def shot_spread(place,num)
  906.     Audio.se_play("Audio/SE/117-Fire01")
  907.     @bullet[@bullet_num] = Enemy_Bullet.new(@power)
  908.     @bullet[@bullet_num].type = 2
  909.     angle = Math::PI * (place + 1) / (num + 2)  
  910.     x = Math.cos(angle)
  911.     y = Math.sin(angle)
  912.     if x  == 0
  913.       @bullet[@bullet_num].ratiox = 0
  914.       @bullet[@bullet_num].ratio = 1
  915.     else
  916.       @bullet[@bullet_num].ratio = y / x
  917.       if @bullet[@bullet_num].ratio > 0
  918.         @bullet[@bullet_num].ratiox = - 1
  919.       else
  920.         @bullet[@bullet_num].ratiox = 1
  921.         @bullet[@bullet_num].ratioy = -1
  922.       end
  923.     end
  924.     if @power == 1 or @power == 4
  925.       @bullet[@bullet_num].pic.x = @pic.x - 40 * Math.cos(angle) + 30+ @boss_suit
  926.     else
  927.       @bullet[@bullet_num].pic.x = @pic.x - 40 * Math.cos(angle) + @boss_suit
  928.     end
  929.     @bullet[@bullet_num].pic.y = @pic.y + 40 * Math.sin(angle) + 40+ @boss_suit
  930.     @attack[@bullet_num] = true
  931.     @bullet_num += 1
  932.   end
  933.  
  934.   def hit(x,y,power)
  935.     if x >= @pic.x- 10  and x <= @pic.x + 80  and y >= @pic.y and y <= @pic.y + 40
  936.       @hp -= power
  937.       Audio.se_play("Audio/SE/lazer_hit")
  938.       return true
  939.     end
  940.     return false
  941.   end
  942.  
  943.   def dispose
  944.     @pic.dispose
  945.   end
  946. end
  947.  
  948. class Enemy_Li < Enemy_Plane
  949.   def initialize(x,y)
  950.     super(x,y)
  951.     @attack_type = -1
  952.     @bullet_size = 0
  953.     @speed = 2
  954.     @level= 1
  955.     @hp = 2
  956.     @pic.bitmap = RPG::Cache.picture("LiPlane")
  957.   end
  958. end
  959.  
  960. class Enemy_Green < Enemy_Plane
  961.   def initialize(x,y)
  962.     super(x,y)
  963.     @attack_type = 0
  964.     @bullet_size = 0
  965.     @speed = 2
  966.     @power = 1
  967.     @level= 2
  968.     @hp = 2
  969.     @pic.bitmap = RPG::Cache.picture("GreenPlane")
  970.   end
  971. end
  972.  
  973. class Enemy_God < Enemy_Plane
  974.   def initialize(x,y)
  975.     super(x,y)
  976.     @attack_type = 1
  977.     @bullet_size = 0
  978.     @level = 4
  979.     @power = 1
  980.     @speed = 2
  981.     @hp = 5
  982.     @pic.bitmap = RPG::Cache.picture("GodPlane")
  983.   end
  984. end
  985. class Enemy_X < Enemy_Plane
  986.   def initialize(x,y)
  987.     super(x,y)
  988.     @attack_type = 1
  989.     @bullet_size = 2
  990.     @level = 6
  991.     @power = 1
  992.     @speed = 1
  993.     @hp = 10
  994.     @pic.bitmap = RPG::Cache.picture("XPlane")
  995.   end
  996. end
  997.  
  998. class Enemy_Jit < Enemy_Plane
  999.   def initialize(x,y)
  1000.     super(x,y)
  1001.     @attack_type = 0
  1002.     @bullet_size = 1
  1003.     @power = 2
  1004.     @level = 5
  1005.     @speed = 1
  1006.     @hp = 15
  1007.     @pic.bitmap = RPG::Cache.picture("JitPlane")
  1008.   end
  1009. end
  1010.  
  1011. class Enemy_Jp < Enemy_Plane
  1012.   def initialize(x,y)
  1013.     super(x,y)
  1014.     @attack_type = 2
  1015.     @bullet_size = 3
  1016.     @level = 6
  1017.     @speed = 1
  1018.     @power = 3
  1019.     @hp = 15
  1020.     @pic.bitmap = RPG::Cache.picture("JpPlane")
  1021.   end
  1022. end
  1023.  
  1024. class Enemy_LX < Enemy_Plane
  1025.   def initialize(x,y)
  1026.     super(x,y)
  1027.     @attack_type = 1
  1028.     @bullet_size = 4
  1029.     @level = 10
  1030.     @power = 4
  1031.     @speed = 1
  1032.     @hp = 30
  1033.     @pic.bitmap = RPG::Cache.picture("LXPlane")
  1034.   end
  1035. end
  1036. class Enemy_Red < Enemy_Plane
  1037.   def initialize(x,y)
  1038.     super(x,y)
  1039.     @attack_type = 2
  1040.     @bullet_size = 1
  1041.     @level = 5
  1042.     @power = 3
  1043.     @speed = 1
  1044.     @hp = 20
  1045.     @pic.bitmap = RPG::Cache.picture("RedPlane")
  1046.   end
  1047. end
  1048. class Enemy_Toon < Enemy_Plane
  1049.   def initialize(x,y)
  1050.     super(x,y)
  1051.     @attack_type = 1
  1052.     @bullet_size = 0
  1053.     @level = 3
  1054.     @power = 1
  1055.     @speed = 2
  1056.     @hp = 2
  1057.     @pic.bitmap = RPG::Cache.picture("ToonPlane")
  1058.   end
  1059. end
  1060. class Enemy_Ye < Enemy_Plane
  1061.   def initialize(x,y)
  1062.     super(x,y)
  1063.     @attack_type = 0
  1064.     @bullet_size = 1
  1065.     @power = 1
  1066.     @level = 6
  1067.     @speed = 2.5
  1068.     @hp = 5
  1069.     @pic.bitmap = RPG::Cache.picture("YePlane")
  1070.   end
  1071. end
  1072.  
  1073.  
  1074. class Enemy_Boss < Enemy_Plane
  1075.   attr_accessor :mode_switch
  1076.   def initialize(x,y)
  1077.     super(x,y)
  1078.     @mode_switch = false
  1079.     @attack_type = 1
  1080.     @boss_suit = 50
  1081.     @bullet_size = 5
  1082.     @power = 3
  1083.     @level = 100
  1084.     @width = 240
  1085.     @speed = 1
  1086.     @hp = 1000
  1087.     @pic.bitmap = RPG::Cache.picture("boss")
  1088.   end
  1089.  
  1090.   def attack_mode
  1091.     @attack_type = rand(3)
  1092.     mode_switch = false
  1093.     case @attack_type
  1094.       when 0
  1095.         @power = 4
  1096.         @bullet_size = 6
  1097.       when 1
  1098.         @power = 3
  1099.         @bullet_size = 5
  1100.       when 2
  1101.         @power = 2
  1102.         @bullet_size = 10
  1103.     end
  1104.   end
  1105.   def hit(x,y,power)
  1106.     if x >= @pic.x - 40 and x <= @pic.x + 280 and y >= @pic.y and y <=  @pic.y + 140
  1107.       @hp -= power
  1108.       Audio.se_play("Audio/SE/lazer_hit")
  1109.       return true
  1110.     end
  1111.     return false
  1112.   end
  1113. end
  1114.  
  1115.  
  1116. class Blast
  1117.   attr_accessor :pic
  1118.   attr_accessor :control
  1119.   attr_accessor :speed
  1120.   def initialize(x,y)
  1121.     @control = 0
  1122.     @speed =0
  1123.     @pic = Sprite.new
  1124.     @pic.x = x
  1125.     @pic.y = y
  1126.     @pic.bitmap = Bitmap.new(192,192)
  1127.   end  
  1128.  
  1129.   def dispose
  1130.     @pic.dispose
  1131.   end
  1132. end
  1133.  
  1134.  
  1135. class Blast_Explosion <  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 == 5
  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("Explosion01"),Rect.new(192*@control,0,192,192))
  1147.         @control +=1
  1148.       elsif @control > 4 and @control <= 5
  1149.         @pic.bitmap.blt(0,0,RPG::Cache.picture("Explosion01"),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.  
  1160. class Blast_Explosion2 <  Blast
  1161.   def initialize(x,y)
  1162.     super(x,y)
  1163.   end
  1164.   def animation
  1165.     if  @speed == 5
  1166.       if @control == 2  or @control == 4  or  @control == 6 or   @control == 9
  1167.         @pic.bitmap.dispose
  1168.         @pic.bitmap = Bitmap.new(192,192)
  1169.       end
  1170.       if @control <= 4
  1171.         @pic.bitmap.blt(0,0,RPG::Cache.picture("Explosion02"),Rect.new(192*@control,0,192,192))
  1172.         @control +=1
  1173.       elsif @control > 4 and @control <= 9
  1174.         @pic.bitmap.blt(0,0,RPG::Cache.picture("Explosion02"),Rect.new(192*(@control - 4),192,192,192))
  1175.         @control +=1
  1176.       else
  1177.         @control = -1
  1178.       end
  1179.       @speed = 0
  1180.     end
  1181.     @speed += 1   
  1182.   end
  1183. end
  1184.  
  1185. class Blast_Hit <  Blast
  1186.   def initialize(x,y)
  1187.     super(x,y)
  1188.   end
  1189.   def animation
  1190.     if @speed == 2
  1191.       if @control ==2  or @control == 4  or @control == 6 or @control == 9
  1192.         @pic.bitmap.dispose
  1193.         @pic.bitmap = Bitmap.new(192,192)      
  1194.       end
  1195.       if  @control <= 4
  1196.         @pic.bitmap.blt(0,0,RPG::Cache.picture("011-Weapon06"),Rect.new(192*@control,0,192,192))
  1197.         @control +=1
  1198.       elsif  @control > 4 and @control <= 9
  1199.         @pic.bitmap.blt(0,0,RPG::Cache.picture("011-Weapon06"),Rect.new(192*(@control - 4),192,192,192))
  1200.         @control +=1
  1201.       else
  1202.         @control = -1
  1203.       end
  1204.       @speed = 0
  1205.     end
  1206.     @speed += 1
  1207.   end
  1208. end
  1209.  
  1210.  
  1211. class Fly_Pattern
  1212.   attr_accessor :control
  1213.   attr_accessor :direction
  1214.   def initialize
  1215.     @control = []
  1216.     @direction = 1
  1217.     for i in 0..100
  1218.       @control[i] = 0
  1219.     end
  1220.   end
  1221.  
  1222.   def pattern(plane,turn)
  1223.     case turn
  1224.       when 21
  1225.         pattern_0(plane,turn)
  1226.       when 22
  1227.         pattern_1(plane,turn)
  1228.       when 10,11,12,15,16,25,26,53
  1229.         pattern_2(plane)
  1230.       when 47,48
  1231.         pattern_3(plane)
  1232.       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
  1233.         pattern_4(plane)
  1234.       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
  1235.         pattern_5(plane)
  1236.       when 39,41,43
  1237.         pattern_6(plane)
  1238.       when 40,42,44
  1239.         pattern_7(plane)
  1240.       when 45,64
  1241.         pattern_8(plane,turn)
  1242.       when 46,65
  1243.         pattern_9(plane,turn)
  1244.       when 70
  1245.         pattern_boss(plane,turn)
  1246.       else
  1247.         pattern_0(plane,turn)
  1248.     end
  1249.   end
  1250.  
  1251.   def pattern_0(plane,turn)
  1252.     @control[turn] += 1
  1253.     if @control[turn]< 40
  1254.        plane.pic.y += 5*plane.speed
  1255.     end
  1256.     if @control[turn]>= 40 and @control[turn] <= 100
  1257.        plane.pic.x += 5*plane.speed
  1258.     end
  1259.     if @control[turn] > 100
  1260.        plane.pic.y -= 5*plane.speed
  1261.     end
  1262.   end
  1263.  
  1264.   def pattern_1(plane,turn)
  1265.     @control[turn] += 1
  1266.     if @control[turn]< 40
  1267.        plane.pic.y += 5*plane.speed
  1268.     end
  1269.     if @control[turn]>= 40 and @control[turn] <= 100
  1270.        plane.pic.x -= 5*plane.speed
  1271.     end
  1272.     if @control[turn] > 100
  1273.        plane.pic.y -= 5*plane.speed
  1274.     end
  1275.   end
  1276.  
  1277.  
  1278.   def pattern_2(plane)
  1279.     plane.pic.y +=5*plane.speed
  1280.   end
  1281.  
  1282.   def pattern_3(plane)
  1283.     plane.pic.y -=5*plane.speed
  1284.   end
  1285.  
  1286.   def pattern_4(plane)
  1287.     plane.pic.x +=5*plane.speed
  1288.   end
  1289.   def pattern_5(plane)
  1290.     plane.pic.x -= 5*plane.speed
  1291.   end
  1292.  
  1293.   def pattern_6(plane)
  1294.     plane.pic.x += 4*plane.speed
  1295.     plane.pic.y += 4*plane.speed
  1296.   end
  1297.  
  1298.   def pattern_7(plane)
  1299.     plane.pic.x -= 4*plane.speed
  1300.     plane.pic.y += 4*plane.speed
  1301.   end
  1302.  
  1303.   def pattern_8(plane,turn)
  1304.     @control[turn] += 1
  1305.     if @control[turn] <= 60
  1306.        plane.pic.x += 4 *plane.speed
  1307.     end
  1308.     if @control[turn] <= 100 and @control[turn] > 60
  1309.        plane.pic.y += 3*plane.speed
  1310.     end
  1311.     if @control[turn] <=160 and @control[turn] >100
  1312.        plane.pic.x -= 4*plane.speed
  1313.      end
  1314.     if @control[turn] <=200 and @control[turn] >160
  1315.        plane.pic.y += 3*plane.speed
  1316.     end
  1317.     if @control[turn] >200
  1318.       plane.pic.x += 4 * plane.speed
  1319.     end
  1320.   end
  1321.  
  1322.   def pattern_9(plane,turn)
  1323.     @control[turn] += 1
  1324.     if @control[turn] <= 60
  1325.        plane.pic.x -= 4 *plane.speed
  1326.     end
  1327.     if @control[turn] <= 100 and @control[turn] > 60
  1328.        plane.pic.y += 3*plane.speed
  1329.     end
  1330.     if @control[turn] <=160 and @control[turn] >100
  1331.        plane.pic.x += 4 * plane.speed
  1332.      end
  1333.     if @control[turn] <=200 and @control[turn] >160
  1334.        plane.pic.y += 3*plane.speed
  1335.     end
  1336.     if @control[turn] >200
  1337.       plane.pic.x -= 4 * plane.speed
  1338.     end
  1339.   end
  1340.  
  1341.  
  1342.   def pattern_boss(plane,turn)
  1343.     @control[turn] += 1
  1344.     if @control[turn] <= 30
  1345.        plane.pic.y += 5 *plane.speed
  1346.     end
  1347.     if @control[turn] > 30 and @control[turn] <= 60
  1348.        plane.pic.x -= 5 * plane.speed
  1349.     end
  1350.     if @control[turn] > 60
  1351.       plane.pic.x += 5 *plane.speed * @direction
  1352.       if (@control[turn] - 120) % 60 == 0
  1353.         @direction = - @direction
  1354.       end
  1355.     end
  1356.   end  
  1357. end
  1358.  
  1359. class Attack_Pattern
  1360.   attr_accessor :control
  1361.   def initialize
  1362.     @control = []
  1363.     for i in 0..100
  1364.       @control[i] = 0
  1365.     end
  1366.   end
  1367.   def pattern(me,turn,plane)
  1368.     case plane.attack_type
  1369.       when 0
  1370.         forward(turn,plane)
  1371.       when 1
  1372.         search(me,turn,plane)
  1373.       when 2
  1374.         spread(turn,plane)
  1375.     end
  1376.   end  
  1377.  
  1378.  
  1379.   def forward(turn,plane)
  1380.     case turn
  1381.       when 10,11,12,15,16
  1382.         forward_1(turn,plane)
  1383.       when 21,22
  1384.         forward_2(turn,plane)
  1385.       when 39,40,41,42,43,44  
  1386.         forward_3(turn,plane)
  1387.       when 70
  1388.         forward_boss(turn,plane)
  1389.       else
  1390.         forward_1(turn,plane)
  1391.     end
  1392.   end
  1393.  
  1394.   def forward_1(turn,plane)
  1395.     @control[turn] += 1
  1396.     if @control[turn] % 10 == 0
  1397.       plane.shotn(plane.bullet_size)
  1398.     end
  1399.   end
  1400.  
  1401.   def forward_2(turn,plane)
  1402.     @control[turn] += 1
  1403.     if @control[turn] % 15 == 0
  1404.       plane.shotn(plane.bullet_size)
  1405.     end
  1406.     if @control[turn] % 15 == 1
  1407.       plane.shotn(plane.bullet_size)
  1408.     end
  1409.     if @control[turn] % 15 == 2
  1410.       plane.shotn(plane.bullet_size)
  1411.     end   
  1412.   end
  1413.  
  1414.   def forward_3(turn,plane)
  1415.     @control[turn] += 1
  1416.     if @control[turn] % 15 == 0
  1417.       plane.shotn(plane.bullet_size)
  1418.     end
  1419.     if @control[turn] % 15 == 1
  1420.       plane.shotn(plane.bullet_size)
  1421.     end
  1422.   end
  1423.  
  1424.   def forward_boss(turn,plane)
  1425.     @control[turn] += 1
  1426.     if @control[turn] % 15 == 0
  1427.       plane.shotn(plane.bullet_size)
  1428.     end
  1429.     if @control[turn] % 15 == 3
  1430.       plane.shotn(plane.bullet_size)
  1431.     end
  1432.     if @control[turn] == 60
  1433.       @control[turn] == 0
  1434.       plane.mode_switch = true
  1435.     end
  1436.   end   
  1437.  
  1438.   def search(me,turn,plane)
  1439.     case turn
  1440.       when 13,14,66,67,68,69
  1441.         search_1(me,turn,plane)
  1442.       when 23,24,25,26,49,50,51,52
  1443.         search_2(me,turn,plane)
  1444.       when 53,64,65
  1445.         search_3(me,turn,plane)
  1446.       when 70
  1447.         search_boss(me,turn,plane)
  1448.       else
  1449.         search_1(me,turn,plane)
  1450.     end
  1451.   end
  1452.  
  1453.   def search_1(me,turn,plane)
  1454.     @control[turn] += 1
  1455.     if @control[turn] % 10 == 0
  1456.       plane.shotn_me(me,plane.bullet_size)
  1457.     end
  1458.   end
  1459.   def search_2(me,turn,plane)
  1460.     @control[turn] += 1
  1461.     if @control[turn] % 15 == 0
  1462.       plane.shotn_me(me,plane.bullet_size)
  1463.     end
  1464.     if @control[turn] % 15 == 1
  1465.       plane.shotn_me(me,plane.bullet_size)
  1466.     end
  1467.     if @control[turn] % 15 == 2
  1468.       plane.shotn_me(me,plane.bullet_size)
  1469.     end
  1470.   end
  1471.  
  1472.   def search_3(me,turn,plane)
  1473.     @control[turn] += 1
  1474.     if @control[turn] % 15 == 0
  1475.       plane.shotn_me(me,plane.bullet_size)
  1476.     end
  1477.     if @control[turn] % 15 == 3
  1478.       plane.shotn_me(me,plane.bullet_size - 1)
  1479.     end
  1480.   end
  1481.  
  1482.   def search_boss(me,turn,plane)
  1483.     @control[turn] += 1
  1484.     if @control[turn] % 10 == 0
  1485.       plane.shotn_me(me,plane.bullet_size)
  1486.     end
  1487.     if @control[turn] % 10 == 1
  1488.       plane.shotn_me(me,plane.bullet_size)
  1489.     end
  1490.     if @control[turn] % 10 == 2
  1491.       plane.shotn_me(me,plane.bullet_size)
  1492.     end
  1493.  
  1494.     if @control[turn]  == 30
  1495.       @control[turn] == 0
  1496.       plane.mode_switch = true
  1497.     end  
  1498.   end
  1499.  
  1500.   def spread(turn,plane)
  1501.     case turn
  1502.       when 45,46
  1503.         spread_1(turn,plane)
  1504.       when 37,38,47,48
  1505.         spread_2(turn,plane)
  1506.       when 70
  1507.         spread_boss(turn,plane)
  1508.       else
  1509.         spread_1(turn,plane)
  1510.     end
  1511.   end
  1512.  
  1513.   def spread_1(turn,plane)
  1514.     @control[turn] += 1
  1515.     if @control[turn] % 15 == 0
  1516.       plane.shotn_spread(plane.bullet_size)
  1517.     end
  1518.     if @control[turn] % 15 == 1
  1519.       plane.shotn_spread(plane.bullet_size - 1)
  1520.     end
  1521.     if @control[turn] % 15 == 2
  1522.       plane.shotn_spread(plane.bullet_size)
  1523.     end
  1524.     if @control[turn] % 15 == 3
  1525.       plane.shotn_spread(plane.bullet_size - 1)
  1526.     end
  1527.   end  
  1528.   def spread_2(turn,plane)
  1529.     @control[turn] += 1
  1530.     if @control[turn] % 10 == 0
  1531.       plane.shotn_spread(plane.bullet_size)
  1532.     end
  1533.   end  
  1534.  
  1535.   def spread_boss(turn,plane)
  1536.     @control[turn] += 1
  1537.     if @control[turn] % 15 == 0
  1538.       plane.shotn_spread(plane.bullet_size)
  1539.     end
  1540.     if @control[turn] % 15 == 2
  1541.       plane.shotn_spread(plane.bullet_size - 1)
  1542.     end
  1543.     if @control[turn] % 15 == 4
  1544.       plane.shotn_spread(plane.bullet_size)
  1545.     end
  1546.     if @control[turn] % 15 == 6
  1547.       plane.shotn_spread(plane.bullet_size - 1)
  1548.     end
  1549.     if control[turn] == 60
  1550.       @control[turn] == 0
  1551.       plane.mode_switch = true
  1552.     end
  1553.   end
  1554. end
  1555.  
  1556.  
  1557. class Bullet
  1558.   attr_accessor :pic
  1559.   attr_accessor :power
  1560.   attr_accessor :type
  1561.   attr_accessor :ratio
  1562.   attr_accessor :ratiox
  1563.   attr_accessor :ratioy
  1564.   def initialize(x)
  1565.     @ratio = 1
  1566.     @power = 1
  1567.     @ratiox = 0
  1568.     @ratioy = 1
  1569.     @type = 0
  1570.     @pic = Sprite.new
  1571.   end
  1572.  
  1573.   def down_fly
  1574.     @pic.y += 10
  1575.   end
  1576.  
  1577.   def up_fly
  1578.     @pic.y -= 20
  1579.   end
  1580.  
  1581.   def search_fly(speed)
  1582.     @pic.x += 10 *speed * @ratiox / Math.hypot(@ratio, 1)
  1583.     @pic.y += 10 *speed * @ratio *@ratioy / Math.hypot(@ratio, 1)
  1584.   end
  1585.  
  1586.  
  1587.   def dispose
  1588.     @pic.dispose
  1589.   end
  1590. end
  1591.  
  1592. class My_Bullet < Bullet
  1593.   def initialize(x)
  1594.     super(x)
  1595.     if x == 1
  1596.       @pic.bitmap = RPG::Cache.picture("bullet_1")
  1597.     elsif x == 2
  1598.       @pic.bitmap = RPG::Cache.picture("bullet_2")
  1599.     end
  1600.   end
  1601. end
  1602.  
  1603. class Enemy_Bullet < Bullet
  1604.   def initialize(x)
  1605.     super(x)
  1606.     if x == 1
  1607.       @power = 1
  1608.       @pic.bitmap = Bitmap.new(64,64)
  1609.       @pic.bitmap.blt(0,0,RPG::Cache.picture("EnemyFire_03"),Rect.new(0,0,64,64))
  1610.     elsif x == 2
  1611.       @power = 2
  1612.       @pic.bitmap = Bitmap.new(128,128)
  1613.       @pic.bitmap.blt(0,0,RPG::Cache.picture("EnemyFire_01"),Rect.new(256,0,128,128))
  1614.     elsif x == 3
  1615.       @power = 3
  1616.       @pic.bitmap = Bitmap.new(128,128)
  1617.       @pic.bitmap.blt(0,0,RPG::Cache.picture("EnemyFire_02"),Rect.new(256,0,128,128))
  1618.     elsif x == 4
  1619.       @power = 4
  1620.       @pic.bitmap = Bitmap.new(128,128)
  1621.       @pic.bitmap.blt(0,0,RPG::Cache.picture("bullet_3"),Rect.new(0,0,128,128))
  1622.     end
  1623.   end
  1624. end
  1625.  
  1626. class Items
  1627.   attr_accessor :pic
  1628.   def initialize(x,y)
  1629.     @pic = Sprite.new
  1630.     @pic.x = x
  1631.     @pic.y = y
  1632.   end
  1633.  
  1634.   def move
  1635.     @pic.y += 1
  1636.   end
  1637.  
  1638.   def dispose
  1639.     @pic.dispose
  1640.   end
  1641. end
  1642.  
  1643. class Bomb < Items
  1644.   attr_accessor :pic
  1645.   def initialize(x,y)
  1646.     super(x,y)
  1647.     @pic.bitmap = RPG::Cache.picture("bomb")
  1648.   end
  1649. end
  1650.  
  1651. class Level < Items
  1652.   attr_accessor :pic
  1653.   def initialize(x,y)
  1654.     super(x,y)
  1655.     @pic.bitmap = RPG::Cache.picture("level")
  1656.   end
  1657. end
  1658.  
  1659. class Power < Items
  1660.   attr_accessor :pic
  1661.   def initialize(x,y)
  1662.     super(x,y)
  1663.     @pic.bitmap = RPG::Cache.picture("power")
  1664.   end
  1665. end
  1666.  
  1667. class Food < Items
  1668.   attr_accessor :pic
  1669.   def initialize(x,y)
  1670.     super(x,y)
  1671.     @pic.bitmap = RPG::Cache.picture("food")
  1672.   end
  1673. end
  1674.  
  1675.  
  1676. class Window_Result < Window_Base
  1677.   def initialize
  1678.     super(20, 400, 500, 100)
  1679.     self.contents = Bitmap.new(width - 32, height - 32)
  1680.     self.contents.font.name = ["方正粗活意简体","方正粗活意简体"]
  1681.     self.opacity = 0
  1682.   end
  1683.  
  1684.   def refresh(hp,score,destroy,bomb)
  1685.     self.contents.clear
  1686.     self.contents.font.size = 22
  1687.     self.contents.font.color = Color.new(255,20,20)
  1688.     self.contents.font.bold = false
  1689.     self.contents.draw_text(0,20,64,32,"生命:")
  1690.     self.contents.draw_text(240,20,64,32,"分数:#{score}")
  1691.     self.contents.draw_text(320,20,64,32,"灭敌数:#{destroy}")
  1692.     self.contents.draw_text(400,20,64,32,"炸弹数:#{bomb}")
  1693.     if hp >= 70
  1694.       self.contents.fill_rect(55, 27, hp * 0.8, 20,Color.new(84,121,241))
  1695.     elsif hp >= 40
  1696.       self.contents.fill_rect(55, 27, hp * 0.8, 20,Color.new(240,200,64))
  1697.     else
  1698.       self.contents.fill_rect(55, 27, hp * 0.8, 20,Color.new(231,81,81))
  1699.     end
  1700.   end
  1701. end
  1702.  
  1703. class Window_Show < Window_Base
  1704.   def initialize
  1705.     super(230, 140, 300, 300)
  1706.     self.contents = Bitmap.new(width - 32, height - 32)
  1707.     self.contents.font.name = ["方正粗活意简体","方正粗活意简体"]
  1708.     self.opacity = 0
  1709.   end
  1710.  
  1711.   def refresh(turn)
  1712.     self.contents.clear
  1713.     self.contents.font.size = 80
  1714.     self.contents.font.color = Color.new(255,80,20)
  1715.     self.contents.font.bold = false
  1716.     case turn
  1717.       when 0
  1718.         self.contents.draw_text(0,0,150,150,"开始")
  1719.       when 1
  1720.         self.contents.draw_text(0,0,150,150,"警告")
  1721.       when 2
  1722.         self.contents.draw_text(0,0,150,150,"胜利")
  1723.     end
  1724.   end
  1725. end
  1726.  
  1727. class Window_Boss < Window_Base
  1728.   def initialize
  1729.     super(20, 0, 500, 100)
  1730.     self.contents = Bitmap.new(width - 32, height - 32)
  1731.     self.contents.font.name = ["方正粗活意简体","方正粗活意简体"]
  1732.     self.opacity = 0
  1733.   end
  1734.  
  1735.   def refresh(hp)
  1736.     self.contents.clear
  1737.     self.contents.font.size = 22
  1738.     self.contents.font.color = Color.new(255,20,20)
  1739.     self.contents.font.bold = false
  1740.     self.contents.draw_text(0,20,64,32,"Boss:")
  1741.     if hp >= 230
  1742.       self.contents.fill_rect(55, 27, 0.4* hp ,20,Color.new(73,188,46))
  1743.     elsif hp >= 200
  1744.       self.contents.fill_rect(55, 27, 0.4* hp,20,Color.new(240,200,64))
  1745.     else
  1746.       self.contents.fill_rect(55, 27, 0.4* hp ,20,Color.new(231,81,81))
  1747.     end
  1748.   end
  1749. end

Lv3.寻梦者

梦石
0
星屑
1232
在线时间
1017 小时
注册时间
2011-4-30
帖子
1516
2
发表于 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 认可答案

查看全部评分

回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
50
在线时间
41 小时
注册时间
2014-8-7
帖子
67
3
 楼主| 发表于 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
回复 支持 反对

使用道具 举报

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

本版积分规则

拿上你的纸笔,建造一个属于你的梦想世界,加入吧。
 注册会员
找回密码

站长信箱:[email protected]|手机版|小黑屋|无图版|Project1游戏制作

GMT+8, 2024-9-23 01:39

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

快速回复 返回顶部 返回列表