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

Project1

 找回密码
 注册会员
搜索
12
返回列表 发新帖
楼主: TheRebirth
打印 上一主题 下一主题

[已经过期] 为什么我这里的PUSH不能用?

 关闭 [复制链接]

Lv1.梦旅人

梦石
0
星屑
49
在线时间
177 小时
注册时间
2011-7-3
帖子
235
11
 楼主| 发表于 2011-11-5 20:41:28 | 只看该作者
...........#%*^*&@YR&*@&**...缺少文件还可能和脚本有关系吗...
代码在这里
范例
  1. #==============================================================================
  2. # ■ Game_Temp
  3. #------------------------------------------------------------------------------
  4. #  セーブデータに含まれない、一時的なデータを扱うクラスです。このクラスのイン
  5. # スタンスは $game_temp で参照されます。
  6. #==============================================================================

  7. class Game_Temp
  8.   #--------------------------------------------------------------------------
  9.   # ● 公開インスタンス変数
  10.   #--------------------------------------------------------------------------
  11.   attr_accessor :tshoot_p_name            # プレイヤーキャラのファイル名
  12.   attr_accessor :tshoot_p_index           # プレイヤーキャラの画像インデックス
  13.   attr_accessor :tshoot_p_speed           # 自機の移動速度
  14.   attr_accessor :tshoot_p_speed_slow      # 自機の低速移動速度
  15.   attr_accessor :tshoot_bgm               # ゲームで使用するBGM
  16.   attr_accessor :tshoot_ground            # ゲームで使用する背景
  17.   attr_accessor :tshoot_stage             # ステージデータ
  18.   attr_accessor :tshoot_life              # 初期ライフ
  19.   attr_accessor :tshoot_bomb              # 初期ボム
  20.   attr_accessor :tshoot_bomb_reset        # 被弾時ボム回復フラグ
  21.   #--------------------------------------------------------------------------
  22.   # ● オブジェクト初期化
  23.   #--------------------------------------------------------------------------
  24.   alias tshoot_game_temp_initialize initialize
  25.   def initialize
  26.     tshoot_game_temp_initialize
  27.     @tshoot_p_name = "Actor2"
  28.     @tshoot_p_index = 7
  29.     @tshoot_p_speed = 4096
  30.     @tshoot_p_speed_slow = 2048
  31.     @tshoot_bgm = "Audio/BGM/Scene2.mid"
  32.     @tshoot_ground = "Graphic/System/ground。jpg"
  33.     @tshoot_stage = TShoot_Stage.new
  34.     @tshoot_life = 4
  35.     @tshoot_bomb = 2
  36.     @tshoot_bomb_reset = true
  37.   end
  38. end
复制代码
  1. #==============================================================================
  2. # ■ TShoot_Player
  3. #------------------------------------------------------------------------------
  4. #  シューティングの自機クラス
  5. #==============================================================================
  6. class TShoot_Player < Sprite
  7.   #--------------------------------------------------------------------------
  8.   # ● 公開インスタンス変数
  9.   #--------------------------------------------------------------------------
  10.   attr_reader :sx
  11.   attr_reader :sy
  12.   #--------------------------------------------------------------------------
  13.   # ● オブジェクト初期化
  14.   #--------------------------------------------------------------------------
  15.   def initialize(x, y)
  16.     super(nil)
  17.     self.x = x + 32
  18.     self.y = y + 32
  19.     self.ox = 16
  20.     self.oy = 16
  21.     self.z = 100
  22.     self.bitmap = Cache.character($game_temp.tshoot_p_name)
  23.     self.src_rect = Rect.new($game_temp.tshoot_p_index % 4 * 96 + 32,
  24.       $game_temp.tshoot_p_index / 4 * 128 + 96, 32, 32)
  25.     @sx = x << 10
  26.     @sy = y << 10
  27.     @reload = 0     # リロードタイマー
  28.     @throw = 0      # 無敵タイマー
  29.     @anime = 0      # アニメタイマー
  30.   end
  31.   #--------------------------------------------------------------------------
  32.   # ● 更新
  33.   #--------------------------------------------------------------------------
  34.   def update
  35.     if @throw > 0
  36.       @throw -= 1
  37.       self.opacity = 128 if @throw == 120
  38.       self.opacity = 255 if @throw == 0
  39.     end
  40.     if @throw < 120
  41.       update_move
  42.       update_shot
  43.       update_anime
  44.     end
  45.   end
  46.   #--------------------------------------------------------------------------
  47.   # ● 更新(ショット)
  48.   #--------------------------------------------------------------------------
  49.   def update_shot
  50.     @reload -= 1 if @reload > 0
  51.     if Input.press?(Input::C) or      # ショット
  52.        ($game_switches[TSHOOT::SW_MOUSE_INPUT] and Input.mouse_press?("MLB"))
  53.       if @reload == 0
  54.         if TSHOOT::USE_SHOT_PATTERN
  55.           for shot in TSHOOT::SHOT_PATTERN[$scene.info.power / TSHOOT::ITEM_NEED]
  56.             d = shot[2]
  57.             d = d - ( shot[1] * ( shot[0] - 1 ) / 2 )
  58.             for i in 0...shot[0]
  59.               $scene.add_pbullet(self.x, self.y - 6, d, shot[3], shot[4], shot[5])
  60.               d += shot[1]
  61.             end
  62.             @reload = shot[6]
  63.           end
  64.         else
  65.           if $scene.info.power < TSHOOT::ITEM_NEED
  66.             $scene.add_pbullet(self.x, self.y - 6, TSHOOT::ANGLE_UP, 4096, 0, 0)
  67.           elsif $scene.info.power < TSHOOT::ITEM_NEED * 2
  68.             $scene.add_pbullet(self.x - 6, self.y - 6, TSHOOT::ANGLE_UP, 4096, 0, 0)
  69.             $scene.add_pbullet(self.x + 6, self.y - 6, TSHOOT::ANGLE_UP, 4096, 0, 0)
  70.           else
  71.             $scene.add_pbullet(self.x - 12, self.y - 6, TSHOOT::ANGLE_UP, 4096, 0, 0)
  72.             $scene.add_pbullet(self.x,      self.y - 8, TSHOOT::ANGLE_UP, 4096, 0, 0)
  73.             $scene.add_pbullet(self.x + 12, self.y - 6, TSHOOT::ANGLE_UP, 4096, 0, 0)
  74.           end
  75.           @reload = 8
  76.         end
  77.       end
  78.     end
  79.     if Input.trigger?(Input::B) or    # ボム
  80.        ($game_switches[TSHOOT::SW_MOUSE_INPUT] and Input.mouse_trigger?("MRB"))
  81.       if $scene.info.bomb > 0
  82.         $scene.se_flag[4] = true
  83.         $scene.info.add_bomb(-1)
  84.         $scene.clear_bullet
  85.         $scene.back_ground.shake(true, 32)
  86.         $scene.back_ground.shake(false, 32)
  87.         $scene.back_ground.flash
  88.       end
  89.     end
  90.   end
  91.   
  92.   #--------------------------------------------------------------------------
  93.   # ● 更新(移動処理)
  94.   #--------------------------------------------------------------------------
  95.   def update_move
  96.     if $game_switches[TSHOOT::SW_MOUSE_INPUT]
  97.       x, y = Input.mouse_pos(true)
  98.       self.x = [[x, 32].max, 320].min
  99.       self.y = [[y, 32].max, 384].min
  100.       @sx = self.x - 32 << 10
  101.       @sy = self.y - 32 << 10
  102.     else
  103.       vx = 0
  104.       vy = 0
  105.       speed = (Input.press?(Input::A) ? $game_temp.tshoot_p_speed_slow : $game_temp.tshoot_p_speed)
  106.       if Input.press?(Input::LEFT)
  107.         vx = -speed
  108.       elsif Input.press?(Input::RIGHT)
  109.         vx = speed
  110.       end
  111.       if Input.press?(Input::UP)
  112.         vy = -speed
  113.       elsif Input.press?(Input::DOWN)
  114.         vy = speed
  115.       end
  116.       if vx != 0 and vy != 0
  117.         vx = vx * 7 / 10
  118.         vy = vy * 7 / 10
  119.       end
  120.       @sx += vx
  121.       @sy += vy
  122.       @sx -= vx if @sx < 0 or @sx > (288 << 10)
  123.       @sy -= vy if @sy < 0 or @sy > (352 << 10)
  124.       self.x = (@sx >> 10) + 32
  125.       self.y = (@sy >> 10) + 32
  126.     end
  127.   end
  128.   #--------------------------------------------------------------------------
  129.   # ● 更新(アニメーション)
  130.   #--------------------------------------------------------------------------
  131.   def update_anime
  132.     @anime = (@anime + 1) % 60
  133.     index = $game_temp.tshoot_p_index
  134.     pattern = @anime / 15
  135.     pattern = pattern < 3 ? pattern : 1
  136.     self.src_rect.set((index % 4 * 3 + pattern) * 32, index / 4 * 128 + 96, 32, 32)
  137.   end
  138.   #--------------------------------------------------------------------------
  139.   # ● ダメージ
  140.   #   返り値 : プレイヤーがダメージを受けたかどうかを返す
  141.   #--------------------------------------------------------------------------
  142.   def damage
  143.     return false if throw?
  144.     $scene.se_flag[3] = true
  145.     $scene.back_ground.shake(true, 32)
  146.     $scene.back_ground.shake(false, 32)
  147.     $scene.info.add_life(-1)
  148.     $scene.info.add_power(TSHOOT::ITEM_LOST)
  149.     $scene.info.set_bomb($game_temp.tshoot_bomb) if $game_temp.tshoot_bomb_reset
  150.     @throw = 180
  151.     self.opacity = 0
  152.     @sx = 144 << 10   # 初期位置のX座標
  153.     @sy = 336 << 10   # 初期位置のY座標
  154.     a = 0.0
  155.     d = Math::PI * 2 / 8
  156.     for i in 0...8
  157.       $scene.add_effect(1, self.x - 16, self.y - 16, (Math.cos(a) * 2048).to_i,
  158.         (Math.sin(a) * 2048).to_i)
  159.       a += d
  160.     end
  161.     self.x = (@sx >> 10) + 32
  162.     self.y = (@sy >> 10) + 32
  163.     return true
  164.   end
  165.   #--------------------------------------------------------------------------
  166.   # ● 角度を返す
  167.   #--------------------------------------------------------------------------
  168.   def get_angle(sx, sy)
  169.                 return Math.atan2( @sy - sy, @sx - sx )
  170.   end
  171.   #--------------------------------------------------------------------------
  172.   # ● スルー状態を返す
  173.   #--------------------------------------------------------------------------
  174.   def throw?
  175.     return @throw > 0
  176.   end
  177. end

复制代码


TheRebirth于2011-11-5 20:42补充以下内容:
  1. #==============================================================================
  2. # ■ TShoot_PBullet
  3. #------------------------------------------------------------------------------
  4. #  シューティングの自機弾クラス
  5. #==============================================================================
  6. class TShoot_PBullet < Sprite
  7.   #--------------------------------------------------------------------------
  8.   # ● オブジェクト初期化
  9.   #--------------------------------------------------------------------------
  10.   def initialize(x, y, angle, speed, index, type)
  11.     super(nil)
  12.     self.x = x - 6
  13.     self.y = y
  14.     self.z = 100
  15.     self.bitmap = Cache.system("pbullet")
  16.     self.src_rect = Rect.new(index * 12, 0, 12, 12)
  17.     self.opacity = TSHOOT::PBULLET_OPACITY
  18.     self.blend_type = TSHOOT::PBULLET_BLEND
  19.     @real_x = self.x << 8
  20.     @real_y = self.y << 8
  21.     @vx = (Math.cos(angle) * speed).to_i
  22.     @vy = (Math.sin(angle) * speed).to_i
  23.     @speed = speed
  24.     @type = type
  25.     @count = rand(3) + 1
  26.   end
  27.   #--------------------------------------------------------------------------
  28.   # ● 更新
  29.   #--------------------------------------------------------------------------
  30.   def update
  31.     if @type == 1
  32.       @count -= 1
  33.       if @count == 0
  34.         @count = 5
  35.         d, id = 9999, -1
  36.         for i in 0...$scene.enemy.size
  37.           next if $scene.enemy[i] == nil
  38.           d2 = (self.x - $scene.enemy[i].x).abs + (self.y - $scene.enemy[i].y).abs
  39.           d, id = d2, i if d > d2
  40.         end
  41.         if id >= 0
  42.           angle = Math.atan2($scene.enemy[id].y - self.y, $scene.enemy[id].x - self.x)
  43.           @vx = (Math.cos(angle) * @speed).to_i
  44.           @vy = (Math.sin(angle) * @speed).to_i
  45.         end
  46.       end
  47.     end
  48.     @real_x += @vx
  49.     @real_y += @vy
  50.     self.x = @real_x >> 8
  51.     self.y = @real_y >> 8
  52.     for i in 0...$scene.enemy.size
  53.       next if $scene.enemy[i] == nil
  54.       if self.y <= $scene.enemy[i].y + 32 and self.y + 12 >= $scene.enemy[i].y
  55.       if self.x <= $scene.enemy[i].x + 32 and self.x + 12 >= $scene.enemy[i].x
  56.         $scene.enemy[i].damage
  57.         $scene.add_effect(2, self.x + self.width / 2, self.y + self.height / 2, 0, 0)
  58.         dispose
  59.         return
  60.       end
  61.       end
  62.     end
  63.     dispose if self.x < -16 or self.x > 336 or self.y < -16 or self.y > 400
  64.   end
  65. end

复制代码
  1. #==============================================================================
  2. # ■ TShoot_Enemy
  3. #------------------------------------------------------------------------------
  4. #  シューティングの敵機クラス
  5. #==============================================================================
  6. class TShoot_Enemy < Sprite
  7.   #--------------------------------------------------------------------------
  8.   # ● 公開インスタンス変数
  9.   #--------------------------------------------------------------------------
  10.   attr_reader :sx
  11.   attr_reader :sy
  12.   #--------------------------------------------------------------------------
  13.   # ● オブジェクト初期化
  14.   #--------------------------------------------------------------------------
  15.   def initialize(x, y, shot, move)
  16.     super(nil)
  17.     self.x = x + 16
  18.     self.y = y + 16
  19.     self.z = 90
  20.     @sx = x << 10
  21.     @sy = y << 10
  22.     @vx = 0
  23.     @vy = 0
  24.     @shot = shot            # ショットオプション値
  25.     @move = move            # 移動オプション値
  26.     @cnt_move = 0           # 移動用タイマー
  27.     @cnt_shot = 0           # ショット用タイマー
  28.     @cnt_shot_reset = 180   # ショットのループ間隔
  29.     @angle_shot = 0.0
  30.     @anime = 0              # アニメタイマー
  31.     @dir = 2                # 向き
  32.     @hp = 5
  33.     @score = 1              # 所持しているスコアアイテム数
  34.     @power = 0              # 同パワーアイテム数
  35.     @life = 0               # 同ライフアイテム数
  36.     @bomb = 0               # 同ボムアイテム数
  37.     set_type
  38.     self.bitmap = Cache.character(@file_name)
  39.     self.src_rect = Rect.new(@file_index % 4 * 96 + 32,
  40.       @file_index / 4 * 128 + ((@dir - 2) / 2) * 32, 32, 32)
  41.   end
  42.   #--------------------------------------------------------------------------
  43.   # ● 更新
  44.   #--------------------------------------------------------------------------
  45.   def update
  46.     if @hp <= 0
  47.       $scene.se_flag[2] = true
  48.       $scene.back_ground.shake(false, 16)
  49.       set_item
  50.       $scene.add_effect(3, self.x + 16, self.y + 16, 0, 0)
  51.       dispose
  52.       return
  53.     end
  54.     action
  55.     @sx += @vx
  56.     @sy += @vy
  57.     self.x = (@sx >> 10) + 16
  58.     self.y = (@sy >> 10) + 16
  59.     if $scene.player.y > self.y and $scene.player.y < self.y + 32
  60.     if $scene.player.x > self.x and $scene.player.x < self.x + 32
  61.       $scene.player.damage
  62.     end
  63.     end
  64.     update_anime
  65.     if self.x < -16 or self.x > 352 or self.y < -16 or self.y > 400
  66.       dispose
  67.     end
  68.   end
  69.   #--------------------------------------------------------------------------
  70.   # ● 更新(アニメーション)
  71.   #--------------------------------------------------------------------------
  72.   def update_anime
  73.     @anime = (@anime + 1) % 60
  74.     pattern = @anime / 15
  75.     pattern = pattern < 3 ? pattern : 1
  76.     self.src_rect.set((@file_index % 4 * 3 + pattern) * 32,
  77.       @file_index / 4 * 128 + ((@dir - 2) / 2) * 32, 32, 32)
  78.   end
  79.   #--------------------------------------------------------------------------
  80.   # ● 下を向く
  81.   #--------------------------------------------------------------------------
  82.   def turn_down
  83.     @dir = 2
  84.   end
  85.   #--------------------------------------------------------------------------
  86.   # ● 左を向く
  87.   #--------------------------------------------------------------------------
  88.   def turn_right
  89.     @dir = 4
  90.   end
  91.   #--------------------------------------------------------------------------
  92.   # ● 右を向く
  93.   #--------------------------------------------------------------------------
  94.   def turn_left
  95.     @dir = 6
  96.   end
  97.   #--------------------------------------------------------------------------
  98.   # ● 上を向く
  99.   #--------------------------------------------------------------------------
  100.   def turn_up
  101.     @dir = 8
  102.   end
  103.   #--------------------------------------------------------------------------
  104.   # ● ダメージ
  105.   #--------------------------------------------------------------------------
  106.   def damage
  107.     @hp -= 2
  108.     $scene.se_flag[1] = true
  109.   end
  110.   #--------------------------------------------------------------------------
  111.   # ● 自機のいる角度を取得
  112.   #--------------------------------------------------------------------------
  113.   def get_angle
  114.     return $scene.player.get_angle(@sx, @sy)
  115.   end
  116.   #--------------------------------------------------------------------------
  117.   # ● アイテムセット
  118.   #--------------------------------------------------------------------------
  119.   def set_item
  120.     n = @score + @power + @life + @bomb
  121.     return if n == 0
  122.     a = -Math::PI / 2
  123.     d = Math::PI * 2 / n
  124.     for i in 0...n
  125.       index = 3
  126.       if i < @score
  127.         index = 0
  128.       elsif i < @score + @power
  129.         index = 1
  130.       elsif i < n - @bomb
  131.         index = 2
  132.       end
  133.       $scene.add_item((@sx >> 10) + 8, self.y + 8, (Math.cos(a) * 768).to_i,
  134.         (Math.sin(a) * 768).to_i, index)
  135.       a += d
  136.     end
  137.   end
  138.   #--------------------------------------------------------------------------
  139.   # ● n方向ショット
  140.   #--------------------------------------------------------------------------
  141.   def nway_shot(n, space, angle, speed, aim, index, type = 1)
  142.     d = angle
  143.     d += get_angle if aim
  144.            d = d - ( space * ( n - 1 ) / 2 )
  145.     for i in 0...n
  146.       $scene.add_ebullet(@sx, @sy, (Math.cos(d) * speed).to_i,
  147.         (Math.sin(d) * speed).to_i, index, type)
  148.       d += space
  149.     end
  150.   end
  151.   #--------------------------------------------------------------------------
  152.   # ● 全方位ショット
  153.   #--------------------------------------------------------------------------
  154.   def nall_shot(n, angle, speed, aim, index, type = 1)
  155.     a = angle
  156.     a += get_angle if aim
  157.     d = Math::PI * 2 / n
  158.     for i in 0...n
  159.       $scene.add_ebullet(@sx, @sy, (Math.cos(a) * speed).to_i,
  160.         (Math.sin(a) * speed).to_i, index, type)
  161.       a += d
  162.     end
  163.   end
  164.   #--------------------------------------------------------------------------
  165.   # ● 行動処理(中身は継承先に)
  166.   #--------------------------------------------------------------------------
  167.   def action
  168.   end
  169. end
复制代码
  1. #==============================================================================
  2. # ■ TShoot_EBullet
  3. #------------------------------------------------------------------------------
  4. #  シューティングの敵機弾クラス
  5. #==============================================================================
  6. class TShoot_EBullet < Sprite
  7.   #--------------------------------------------------------------------------
  8.   # ● 公開インスタンス変数
  9.   #--------------------------------------------------------------------------
  10.   attr_reader :last_vx
  11.   attr_reader :last_vy
  12.   #--------------------------------------------------------------------------
  13.   # ● オブジェクト初期化
  14.   #   x = 敵機のx方向中心
  15.   #   y = 敵機のy方向中心
  16.   #--------------------------------------------------------------------------
  17.   def initialize(x, y, vx, vy, index, id)
  18.     super(nil)
  19.     @index = index
  20.     @graze = true
  21.     set_type
  22.     @sx = x + ((16 -  self.width / 2) << 10)
  23.     @sy = y + ((16 -  self.height / 2) << 10)
  24.     self.x = (@sx >> 10) + 16
  25.     self.y = (@sy >> 10) + 16
  26.     self.z = 110 + id
  27.     @vx = vx
  28.     @vy = vy
  29.   end
  30.   #--------------------------------------------------------------------------
  31.   # ● 更新
  32.   #--------------------------------------------------------------------------
  33.   def update
  34.     @sx += @vx
  35.     @sy += @vy
  36.     self.x = (@sx >> 10) + 16
  37.     self.y = (@sy >> 10) + 16
  38.     # 接触判定
  39.     if $scene.player.y < self.y + self.width + 16 and $scene.player.y > self.y - 16
  40.       if $scene.player.x > self.x - 16 and $scene.player.x < self.x + self.height + 16
  41.         if @graze and not $scene.player.throw?
  42.           $scene.add_effect(4, $scene.player.x - 4, $scene.player.y - 4,
  43.           rand(4096) - 2048, rand(4096) - 2048)
  44.           $scene.se_flag[9] = true if TSHOOT::USE_GRAZE_SE
  45.           $scene.info.add_graze
  46.           @graze = false
  47.         end
  48.         if $scene.player.y > self.y and $scene.player.y < self.y + (self.width / 2)
  49.           if $scene.player.x > self.x and $scene.player.x < self.x + (self.height / 2)
  50.             self.x = -32 if $scene.player.damage
  51.           end
  52.         end
  53.       end
  54.     end
  55.     dispose if self.x < -16 or self.x > 336 or self.y < -16 or self.y > 400
  56.   end
  57.   #--------------------------------------------------------------------------
  58.   # ● 自機狙いに変更
  59.   #--------------------------------------------------------------------------
  60.   def change_aim(speed)
  61.     x = @sx + ((self.width / 2 - 16) << 10)
  62.     y = @sy + ((self.height / 2 - 16) << 10)
  63.     angle = $scene.player.get_angle(x, y)
  64.     @vx = (Math.cos(angle) * speed).to_i
  65.     @vy = (Math.sin(angle) * speed).to_i
  66.   end
  67.   #--------------------------------------------------------------------------
  68.   # ● ご主人様を設定
  69.   #--------------------------------------------------------------------------
  70.   def set_master(id)
  71.     @master = id
  72.   end
  73. end

复制代码


TheRebirth于2011-11-5 20:42补充以下内容:
  1. #==============================================================================
  2. # ■ TShoot_Item
  3. #------------------------------------------------------------------------------
  4. #  シューティングのアイテムクラス
  5. #==============================================================================
  6. class TShoot_Item < Sprite
  7.   #--------------------------------------------------------------------------
  8.   # ● オブジェクト初期化
  9.   #--------------------------------------------------------------------------
  10.   def initialize(x, y, vx, vy, type)
  11.     super(nil)
  12.     self.x = x + 32
  13.     self.y = y
  14.     self.z = 80
  15.     self.bitmap = Cache.system("item")
  16.     self.src_rect = Rect.new(type * 16, 0, 16, 16)
  17.     self.opacity = TSHOOT::ITEM_OPACITY
  18.     self.blend_type = TSHOOT::ITEM_BLEND
  19.     @type = type
  20.     @sx = x << 10
  21.     @sy = y << 10
  22.     @vx = vx
  23.     @vy = vy
  24.     @cnt = 0
  25.   end
  26.   #--------------------------------------------------------------------------
  27.   # ● 更新
  28.   #--------------------------------------------------------------------------
  29.   def update
  30.     if @cnt < 30
  31.       @cnt += 1
  32.       @vy = 1024 if @cnt == 30
  33.       @sx += @vx
  34.       @sx = 0 if @sx < 0
  35.       @sx = 303 << 10 if @sx > (303 << 10)
  36.       self.x = (@sx >> 10) + 32
  37.     end
  38.     @sy += @vy
  39.     self.y = @sy >> 10
  40.     if $scene.player.y - 32 <= self.y + 32 and $scene.player.y + 32 >= self.y
  41.     if $scene.player.x - 32 <= self.x + 32 and $scene.player.x + 32 >= self.x
  42.       if @type == 0
  43.         $scene.se_flag[5] = true
  44.         n = 10 * ($scene.info.graze + 1)
  45.       elsif @type == 1
  46.         $scene.se_flag[6] = true
  47.         n = 5 * ($scene.info.graze + 1)
  48.         $scene.info.add_power(1)
  49.       elsif @type == 2
  50.         $scene.se_flag[7] = true
  51.         n = 8 * ($scene.info.graze + 1)
  52.         $scene.info.add_life(1)
  53.       elsif @type == 3
  54.         $scene.se_flag[8] = true
  55.         n = 8 * ($scene.info.graze + 1)
  56.         $scene.info.add_bomb(1)
  57.       end
  58.         $scene.info.add_score(n)
  59.         $scene.add_popup(self.x + 8, self.y, n.to_s)
  60.       self.y = 416
  61.     end
  62.     end
  63.     dispose if self.y >= 416
  64.   end
  65. end

复制代码
  1. #==============================================================================
  2. # ■ TShoot_Stage
  3. #------------------------------------------------------------------------------
  4. #  シューティングのステージクラス
  5. #==============================================================================
  6. class TShoot_Stage
  7.   #--------------------------------------------------------------------------
  8.   # ● リセット
  9.   #--------------------------------------------------------------------------
  10.   def reset
  11.     @time = []
  12.     @type = []
  13.     @data = []
  14.     @pos = 0
  15.     @cnt = 0
  16.   end
  17.   #--------------------------------------------------------------------------
  18.   # ● 更新
  19.   #--------------------------------------------------------------------------
  20.   def update
  21.     while(1)
  22.       break if @time[@pos] != @cnt
  23.       if @type[@pos] < 200       # キャラクター配置
  24.         $scene.add_enemy(@type[@pos], @data[@pos][0], @data[@pos][1], @data[@pos][2], @data[@pos][3])
  25.       elsif @type[@pos] == 200   # メッセージ
  26.         $game_message.face_name = @data[@pos][0]
  27.         $game_message.face_index = @data[@pos][1]
  28.         $game_message.background = @data[@pos][2]
  29.         $game_message.position = @data[@pos][3]
  30.         $game_message.texts.push(@data[@pos][4])
  31.       elsif @type[@pos] == 201   # ピクチャの表示
  32.         $scene.back_ground.show_picture(@data[@pos][0], @data[@pos][1],
  33.         @data[@pos][2], @data[@pos][3], @data[@pos][4], @data[@pos][5],
  34.         @data[@pos][6], @data[@pos][7], @data[@pos][8])
  35.       elsif @type[@pos] == 202   # ピクチャの消去
  36.         $scene.back_ground.erase_picture(@data[@pos][0])
  37.       elsif @type[@pos] == 203   # 全削除
  38.         $scene.clear_all
  39.       elsif @type[@pos] == 204   # 敵数ストッパー
  40.         if $scene.enemy_num > @data[@pos][0]
  41.           @cnt -= 1
  42.           break
  43.         end
  44.       elsif @type[@pos] == 205   # ステージ終了
  45.         $scene.state = 1
  46.         Audio.me_play("Audio/ME/Victory1.mid", 100, 100)  # 撃破時にME再生
  47.       end
  48.       @pos += 1
  49.     end
  50.     @cnt += 1
  51.     if TSHOOT::GC_COUNT > 0
  52.       GC.start if @cnt % TSHOOT::GC_COUNT == 0
  53.     end
  54.   end
  55.   #--------------------------------------------------------------------------
  56.   # ● データの追加
  57.   #--------------------------------------------------------------------------
  58.   def add(time, type, data)
  59.     @time.push(time)
  60.     @type.push(type)
  61.     @data.push(data)
  62.   end
  63.   #--------------------------------------------------------------------------
  64.   # ● データのソート
  65.   #--------------------------------------------------------------------------
  66.   def sort
  67.     while(1)
  68.       flag = false
  69.       for i in [email protected] - 1
  70.         if @time[i] > @time[i + 1]
  71.           time = @time[i]
  72.           type = @type[i]
  73.           data = @data[i].dup
  74.           @time[i] = @time[i + 1]
  75.           @type[i] = @type[i + 1]
  76.           @data[i] = @data[i + 1].dup
  77.           @time[i + 1] = time
  78.           @type[i + 1] = type
  79.           @data[i + 1] = data.dup
  80.           flag = true
  81.         end
  82.       end
  83.       break unless flag
  84.     end
  85.   end
  86. end
复制代码
  1. #==============================================================================
  2. # ■ TShoot_Ground
  3. #------------------------------------------------------------------------------
  4. #  シューティングの背景クラス
  5. #==============================================================================
  6. class TShoot_Ground < Sprite
  7.   #--------------------------------------------------------------------------
  8.   # ● オブジェクト初期化
  9.   #--------------------------------------------------------------------------
  10.   def initialize
  11.     super(nil)
  12.     self.bitmap = Cache.system("ground")
  13.     self.x = -16
  14.     self.y = -32
  15.     self.z = 25
  16.     @flash = 0
  17.     @shake_x = 0
  18.     @angle_x = 0.0
  19.     # スクロール用に背景をもう1枚作成
  20.     @back_sub = Sprite.new
  21.     @back_sub.bitmap = self.bitmap
  22.     @back_sub.x = self.x
  23.     @back_sub.y = self.y - self.bitmap.height
  24.     # フレーム部分の作成
  25.     @viewport1 = Viewport.new(0, 0, 544, 416)
  26.     @viewport1.z = 9000
  27.     bitmap = Cache.system("frame")
  28.     rect = Rect.new(16, 0, 320, 16)
  29.     @back_top = Sprite.new(@viewport1)
  30.     @back_top.bitmap = Bitmap.new(320, 16)
  31.     @back_top.bitmap.blt(0, 0, bitmap, rect)
  32.     @back_top.x = 16
  33.     rect = Rect.new(16, 400, 320, 16)
  34.     @back_bottom = Sprite.new(@viewport1)
  35.     @back_bottom.bitmap = Bitmap.new(320, 16)
  36.     @back_bottom.bitmap.blt(0, 0, bitmap, rect)
  37.     @back_bottom.x = 16
  38.     @back_bottom.y = 400
  39.     rect = Rect.new(0, 0, 16, 416)
  40.     @back_left = Sprite.new(@viewport1)
  41.     @back_left.bitmap = Bitmap.new(16, 416)
  42.     @back_left.bitmap.blt(0, 0, bitmap, rect)
  43.     rect = Rect.new(336, 0, 208, 416)
  44.     @back_right = Sprite.new(@viewport1)
  45.     @back_right.bitmap = Bitmap.new(208, 416)
  46.     @back_right.bitmap.blt(0, 0, bitmap, rect)
  47.     @back_right.bitmap.font.size = 20
  48.     @back_right.bitmap.font.bold = true
  49.     @back_right.bitmap.font.shadow = true
  50.     @back_right.bitmap.font.color = Color.new(255, 255, 255, 255)
  51.     @back_right.bitmap.draw_text(16, 16, 176, 20, "HiScore")
  52.     @back_right.bitmap.draw_text(16, 44, 176, 20, "Score")
  53.     @back_right.bitmap.draw_text(16, 84, 176, 20, "Life")
  54.     @back_right.bitmap.draw_text(16, 108, 176, 20, "Bomb")
  55.     @back_right.bitmap.draw_text(48, 136, 176, 20, "Power")
  56.     @back_right.bitmap.draw_text(48, 164, 176, 20, "Graze")
  57.     @back_right.x = 336
  58.     bitmap.dispose
  59.     # ピクチャの作成
  60.     @viewport2 = Viewport.new(16, 16, 320, 384)
  61.     @viewport2.z = 8900
  62.     @pictures = []
  63.     for i in 0..20
  64.       @pictures.push(Game_Picture.new(i))
  65.     end
  66.     @picture_sprites = []
  67.     for i in 1..20
  68.       @picture_sprites.push(Sprite_Picture.new(@viewport2, @pictures[i]))
  69.     end
  70.   end
  71.   #--------------------------------------------------------------------------
  72.   # ● 解放
  73.   #--------------------------------------------------------------------------
  74.   def dispose
  75.     @back_top.dispose
  76.     @back_bottom.dispose
  77.     @back_right.dispose
  78.     @back_left.dispose
  79.     @back_sub.dispose
  80.     for sprite in @picture_sprites
  81.       sprite.dispose
  82.     end
  83.     @viewport1.dispose
  84.     @viewport2.dispose
  85.     super
  86.   end
  87.   #--------------------------------------------------------------------------
  88.   # ● ピクチャの表示
  89.   #--------------------------------------------------------------------------
  90.   def show_picture(number, name, origin, x, y, zoom_x, zoom_y, opacity, blend_type)
  91.     @pictures[number].show(name, origin, x, y, zoom_x, zoom_y, opacity, blend_type)
  92.   end
  93.   #--------------------------------------------------------------------------
  94.   # ● ピクチャの消去
  95.   #--------------------------------------------------------------------------
  96.   def erase_picture(number)
  97.     @pictures[number].erase
  98.   end
  99.   #--------------------------------------------------------------------------
  100.   # ● 揺らす
  101.   #   dir    : trueなら横揺れ、falseなら縦揺れ
  102.   #   power  : 揺れの強さ
  103.   #--------------------------------------------------------------------------
  104.   def shake(dir, power = 16)
  105.     @shake_x = power
  106.     @angle_x = 0.0
  107.   end
  108.   #--------------------------------------------------------------------------
  109.   # ● フラッシュ
  110.   #--------------------------------------------------------------------------
  111.   def flash
  112.     @flash = 255
  113.   end
  114.   #--------------------------------------------------------------------------
  115.   # ● 更新
  116.   #--------------------------------------------------------------------------
  117.   def update
  118.     if @shake_x > 0
  119.       @angle_x += 0.7
  120.       @shake_x -= 1
  121.       self.x = (Math.cos(@angle_x) * @shake_x).to_i - 16
  122.     end
  123.     if @flash > 0
  124.       @flash -= 32
  125.       self.color.set(255, 255, 255, @flash)
  126.     end
  127.     self.y += TSHOOT::BG_SCROLL_SPEED
  128.     self.y -= self.bitmap.height * 2 if self.y >= self.bitmap.height
  129.     @back_sub.y += TSHOOT::BG_SCROLL_SPEED
  130.     @back_sub.y -= self.bitmap.height * 2 if @back_sub.y >= self.bitmap.height
  131.     @back_sub.x = self.x
  132.     @back_sub.color.set(255, 255, 255, @flash)
  133.     for picture in @pictures
  134.       picture.update
  135.     end
  136.     for sprite in @picture_sprites
  137.       sprite.update
  138.     end
  139.   end
  140. end

复制代码
  1. #==============================================================================
  2. # ■ TShoot_Message
  3. #------------------------------------------------------------------------------
  4. #  シューティング用のメッセージウィンドウです。
  5. #==============================================================================

  6. class TShoot_Message < Window_Selectable
  7.   #--------------------------------------------------------------------------
  8.   # ● 定数
  9.   #--------------------------------------------------------------------------
  10.   MAX_LINE = 2                            # 最大行数
  11.   #--------------------------------------------------------------------------
  12.   # ● オブジェクト初期化
  13.   #--------------------------------------------------------------------------
  14.   def initialize
  15.     super(16, 320, 320, 80)
  16.     self.z = 8950
  17.     self.active = false
  18.     self.index = -1
  19.     self.openness = 0
  20.     @opening = false            # ウィンドウのオープン中フラグ
  21.     @closing = false            # ウィンドウのクローズ中フラグ
  22.     @text = nil                 # 表示すべき残りの文章
  23.     @contents_x = 0             # 次の文字を描画する X 座標
  24.     @contents_y = 0             # 次の文字を描画する Y 座標
  25.     @line_count = 0             # 現在までに描画した行数
  26.     @wait_count = 0             # ウェイトカウント
  27.     @background = 0             # 背景タイプ
  28.     @position = 2               # 表示位置
  29.     @show_fast = false          # 早送りフラグ
  30.     @line_show_fast = false     # 行単位早送りフラグ
  31.     @pause_skip = false         # 入力待ち省略フラグ
  32.     create_gold_window
  33.     create_number_input_window
  34.     create_back_sprite
  35.   end
  36.   #--------------------------------------------------------------------------
  37.   # ● 解放
  38.   #--------------------------------------------------------------------------
  39.   def dispose
  40.     super
  41.     dispose_gold_window
  42.     dispose_number_input_window
  43.     dispose_back_sprite
  44.   end
  45.   #--------------------------------------------------------------------------
  46.   # ● フレーム更新
  47.   #--------------------------------------------------------------------------
  48.   def update
  49.     super
  50.     update_gold_window
  51.     update_number_input_window
  52.     update_back_sprite
  53.     update_show_fast
  54.     unless @opening or @closing             # ウィンドウの開閉中以外
  55.       if @wait_count > 0                    # 文章内ウェイト中
  56.         @wait_count -= 1
  57.       elsif self.pause                      # 文章送り待機中
  58.         input_pause
  59.       elsif self.active                     # 選択肢入力中
  60.         input_choice
  61.       elsif @number_input_window.visible    # 数値入力中
  62.         input_number
  63.       elsif @text != nil                    # 残りの文章が存在
  64.         update_message                        # メッセージの更新
  65.       elsif continue?                       # 続ける場合
  66.         start_message                         # メッセージの開始
  67.         open                                  # ウィンドウを開く
  68.         $game_message.visible = true
  69.       else                                  # 続けない場合
  70.         close                                 # ウィンドウを閉じる
  71.         $game_message.visible = @closing
  72.       end
  73.     end
  74.   end
  75.   #--------------------------------------------------------------------------
  76.   # ● 所持金ウィンドウの作成
  77.   #--------------------------------------------------------------------------
  78.   def create_gold_window
  79.     @gold_window = Window_Gold.new(384, 0)
  80.     @gold_window.openness = 0
  81.   end
  82.   #--------------------------------------------------------------------------
  83.   # ● 数値入力ウィンドウの作成
  84.   #--------------------------------------------------------------------------
  85.   def create_number_input_window
  86.     @number_input_window = Window_NumberInput.new
  87.     @number_input_window.visible = false
  88.   end
  89.   #--------------------------------------------------------------------------
  90.   # ● 背景スプライトの作成
  91.   #--------------------------------------------------------------------------
  92.   def create_back_sprite
  93.     @back_sprite = Sprite.new
  94.     @back_sprite.bitmap = Cache.system("MessageBack")
  95.     @back_sprite.visible = (@background == 1)
  96.     @back_sprite.x = 16
  97.     @back_sprite.z = 8940
  98.     @back_sprite.src_rect.width = 320
  99.     @back_sprite.src_rect.height = 96
  100.   end
  101.   #--------------------------------------------------------------------------
  102.   # ● 所持金ウィンドウの解放
  103.   #--------------------------------------------------------------------------
  104.   def dispose_gold_window
  105.     @gold_window.dispose
  106.   end
  107.   #--------------------------------------------------------------------------
  108.   # ● 数値入力ウィンドウの解放
  109.   #--------------------------------------------------------------------------
  110.   def dispose_number_input_window
  111.     @number_input_window.dispose
  112.   end
  113.   #--------------------------------------------------------------------------
  114.   # ● 背景スプライトの解放
  115.   #--------------------------------------------------------------------------
  116.   def dispose_back_sprite
  117.     @back_sprite.dispose
  118.   end
  119.   #--------------------------------------------------------------------------
  120.   # ● 所持金ウィンドウの更新
  121.   #--------------------------------------------------------------------------
  122.   def update_gold_window
  123.     @gold_window.update
  124.   end
  125.   #--------------------------------------------------------------------------
  126.   # ● 数値入力ウィンドウの更新
  127.   #--------------------------------------------------------------------------
  128.   def update_number_input_window
  129.     @number_input_window.update
  130.   end
  131.   #--------------------------------------------------------------------------
  132.   # ● 背景スプライトの更新
  133.   #--------------------------------------------------------------------------
  134.   def update_back_sprite
  135.     @back_sprite.visible = (@background == 1)
  136.     @back_sprite.y = y - 16
  137.     @back_sprite.opacity = openness
  138.     @back_sprite.update
  139.   end
  140.   #--------------------------------------------------------------------------
  141.   # ● 早送りフラグの更新
  142.   #--------------------------------------------------------------------------
  143.   def update_show_fast
  144.     if self.pause or self.openness < 255
  145.       @show_fast = false
  146.     elsif Input.trigger?(Input::C) and @wait_count < 2
  147.       @show_fast = true
  148.     elsif not Input.press?(Input::C)
  149.       @show_fast = false
  150.     end
  151.     if @show_fast and @wait_count > 0
  152.       @wait_count -= 1
  153.     end
  154.   end
  155.   #--------------------------------------------------------------------------
  156.   # ● 次のメッセージを続けて表示するべきか判定
  157.   #--------------------------------------------------------------------------
  158.   def continue?
  159.     return true if $game_message.num_input_variable_id > 0
  160.     return false if $game_message.texts.empty?
  161.     if self.openness > 0 and not $game_temp.in_battle
  162.       return false if @background != $game_message.background
  163.       return false if @position != $game_message.position
  164.     end
  165.     return true
  166.   end
  167.   #--------------------------------------------------------------------------
  168.   # ● メッセージの開始
  169.   #--------------------------------------------------------------------------
  170.   def start_message
  171.     @text = ""
  172.     for i in 0...$game_message.texts.size
  173.       @text += "  " if i >= $game_message.choice_start
  174.       @text += $game_message.texts[i].clone + "x00"
  175.     end
  176.     @item_max = $game_message.choice_max
  177.     convert_special_characters
  178.     reset_window
  179.     new_page
  180.   end
  181.   #--------------------------------------------------------------------------
  182.   # ● 改ページ処理
  183.   #--------------------------------------------------------------------------
  184.   def new_page
  185.     contents.clear
  186.     if $game_message.face_name.empty?
  187.       @contents_x = 0
  188.     else
  189.       name = $game_message.face_name
  190.       index = $game_message.face_index
  191.       draw_face(name, index, 0, 0)
  192.       @contents_x = 112
  193.     end
  194.     @contents_y = 0
  195.     @line_count = 0
  196.     @show_fast = false
  197.     @line_show_fast = false
  198.     @pause_skip = false
  199.     contents.font.color = text_color(0)
  200.   end
  201.   #--------------------------------------------------------------------------
  202.   # ● 改行処理
  203.   #--------------------------------------------------------------------------
  204.   def new_line
  205.     if $game_message.face_name.empty?
  206.       @contents_x = 0
  207.     else
  208.       @contents_x = 112
  209.     end
  210.     @contents_y += WLH
  211.     @line_count += 1
  212.     @line_show_fast = false
  213.   end
  214.   #--------------------------------------------------------------------------
  215.   # ● 特殊文字の変換
  216.   #--------------------------------------------------------------------------
  217.   def convert_special_characters
  218.     @text.gsub!(/V[([0-9]+)]/i) { $game_variables[$1.to_i] }
  219.     @text.gsub!(/V[([0-9]+)]/i) { $game_variables[$1.to_i] }
  220.     @text.gsub!(/N[([0-9]+)]/i) { $game_actors[$1.to_i].name }
  221.     @text.gsub!(/C[([0-9]+)]/i) { "x01[#{$1}]" }
  222.     @text.gsub!(/G/)              { "x02" }
  223.     @text.gsub!(/./)             { "x03" }
  224.     @text.gsub!(/|/)             { "x04" }
  225.     @text.gsub!(/!/)              { "x05" }
  226.     @text.gsub!(/>/)              { "x06" }
  227.     @text.gsub!(/</)              { "x07" }
  228.     @text.gsub!(/^/)             { "x08" }
  229.     @text.gsub!(/\/)             { "" }
  230.     @text.gsub!(/
  231. /)               { "" }
  232.   end
  233.   #--------------------------------------------------------------------------
  234.   # ● ウィンドウの背景と位置の設定
  235.   #--------------------------------------------------------------------------
  236.   def reset_window
  237.     @background = $game_message.background
  238.     @position = $game_message.position
  239.     if @background == 0   # 通常ウィンドウ
  240.       self.opacity = 255
  241.     else                  # 背景を暗くする、透明にする
  242.       self.opacity = 0
  243.     end
  244.     case @position
  245.     when 0  # 上
  246.       self.y = 16
  247.       @gold_window.y = 360
  248.     when 1  # 中
  249.       self.y = 144
  250.       @gold_window.y = 0
  251.     when 2  # 下
  252.       self.y = 320
  253.       @gold_window.y = 0
  254.     end
  255.   end
  256.   #--------------------------------------------------------------------------
  257.   # ● メッセージの終了
  258.   #--------------------------------------------------------------------------
  259.   def terminate_message
  260.     self.active = false
  261.     self.pause = false
  262.     self.index = -1
  263.     @gold_window.close
  264.     @number_input_window.active = false
  265.     @number_input_window.visible = false
  266.     $game_message.main_proc.call if $game_message.main_proc != nil
  267.     $game_message.clear
  268.   end
  269.   #--------------------------------------------------------------------------
  270.   # ● メッセージの更新
  271.   #--------------------------------------------------------------------------
  272.   def update_message
  273.     loop do
  274.       c = @text.slice!(/./m)            # 次の文字を取得
  275.       case c
  276.       when nil                          # 描画すべき文字がない
  277.         finish_message                  # 更新終了
  278.         break
  279.       when "x00"                       # 改行
  280.         new_line
  281.         if @line_count >= MAX_LINE      # 行数が最大のとき
  282.           unless @text.empty?           # さらに続きがあるなら
  283.             self.pause = true           # 入力待ちを入れる
  284.             break
  285.           end
  286.         end
  287.       when "x01"                       # C[n]  (文字色変更)
  288.         @text.sub!(/[([0-9]+)]/, "")
  289.         contents.font.color = text_color($1.to_i)
  290.         next
  291.       when "x02"                       # G  (所持金表示)
  292.         @gold_window.refresh
  293.         @gold_window.open
  294.       when "x03"                       # .  (ウェイト 1/4 秒)
  295.         @wait_count = 15
  296.         break
  297.       when "x04"                       # |  (ウェイト 1 秒)
  298.         @wait_count = 60
  299.         break
  300.       when "x05"                       # !  (入力待ち)
  301.         self.pause = true
  302.         break
  303.       when "x06"                       # >  (瞬間表示 ON)
  304.         @line_show_fast = true
  305.       when "x07"                       # <  (瞬間表示 OFF)
  306.         @line_show_fast = false
  307.       when "x08"                       # ^  (入力待ちなし)
  308.         @pause_skip = true
  309.       else                              # 普通の文字
  310.         contents.draw_text(@contents_x, @contents_y, 40, WLH, c)
  311.         c_width = contents.text_size(c).width
  312.         @contents_x += c_width
  313.       end
  314.       break unless @show_fast or @line_show_fast
  315.     end
  316.   end
  317.   #--------------------------------------------------------------------------
  318.   # ● メッセージの更新終了
  319.   #--------------------------------------------------------------------------
  320.   def finish_message
  321.     if $game_message.choice_max > 0
  322.       start_choice
  323.     elsif $game_message.num_input_variable_id > 0
  324.       start_number_input
  325.     elsif @pause_skip
  326.       terminate_message
  327.     else
  328.       self.pause = true
  329.     end
  330.     @wait_count = 10
  331.     @text = nil
  332.   end
  333.   #--------------------------------------------------------------------------
  334.   # ● 選択肢の開始
  335.   #--------------------------------------------------------------------------
  336.   def start_choice
  337.     self.active = true
  338.     self.index = 0
  339.   end
  340.   #--------------------------------------------------------------------------
  341.   # ● 数値入力の開始
  342.   #--------------------------------------------------------------------------
  343.   def start_number_input
  344.     digits_max = $game_message.num_input_digits_max
  345.     number = $game_variables[$game_message.num_input_variable_id]
  346.     @number_input_window.digits_max = digits_max
  347.     @number_input_window.number = number
  348.     if $game_message.face_name.empty?
  349.       @number_input_window.x = x
  350.     else
  351.       @number_input_window.x = x + 112
  352.     end
  353.     @number_input_window.y = y + @contents_y
  354.     @number_input_window.active = true
  355.     @number_input_window.visible = true
  356.     @number_input_window.update
  357.   end
  358.   #--------------------------------------------------------------------------
  359.   # ● カーソルの更新
  360.   #--------------------------------------------------------------------------
  361.   def update_cursor
  362.     if @index >= 0
  363.       x = $game_message.face_name.empty? ? 0 : 112
  364.       y = ($game_message.choice_start + @index) * WLH
  365.       self.cursor_rect.set(x, y, contents.width - x, WLH)
  366.     else
  367.       self.cursor_rect.empty
  368.     end
  369.   end
  370.   #--------------------------------------------------------------------------
  371.   # ● 文章送りの入力処理
  372.   #--------------------------------------------------------------------------
  373.   def input_pause
  374.     if Input.trigger?(Input::B) or Input.trigger?(Input::C)
  375.       self.pause = false
  376.       if @text != nil and not @text.empty?
  377.         new_page if @line_count >= MAX_LINE
  378.       else
  379.         terminate_message
  380.       end
  381.     end
  382.   end
  383.   #--------------------------------------------------------------------------
  384.   # ● 選択肢の入力処理
  385.   #--------------------------------------------------------------------------
  386.   def input_choice
  387.     if Input.trigger?(Input::B)
  388.       if $game_message.choice_cancel_type > 0
  389.         Sound.play_cancel
  390.         $game_message.choice_proc.call($game_message.choice_cancel_type - 1)
  391.         terminate_message
  392.       end
  393.     elsif Input.trigger?(Input::C)
  394.       Sound.play_decision
  395.       $game_message.choice_proc.call(self.index)
  396.       terminate_message
  397.     end
  398.   end
  399.   #--------------------------------------------------------------------------
  400.   # ● 数値入力の処理
  401.   #--------------------------------------------------------------------------
  402.   def input_number
  403.     if Input.trigger?(Input::C)
  404.       Sound.play_decision
  405.       $game_variables[$game_message.num_input_variable_id] =
  406.         @number_input_window.number
  407.       $game_map.need_refresh = true
  408.       terminate_message
  409.     end
  410.   end
  411. end
复制代码


TheRebirth于2011-11-5 20:43补充以下内容:
  1. #==============================================================================
  2. # ■ TShoot_Info
  3. #------------------------------------------------------------------------------
  4. #  シューティングの情報表示クラス
  5. #==============================================================================
  6. class TShoot_Info < Sprite
  7.   #--------------------------------------------------------------------------
  8.   # ● 公開インスタンス変数
  9.   #--------------------------------------------------------------------------
  10.   attr_reader :hi_score
  11.   attr_reader :score
  12.   attr_reader :life
  13.   attr_reader :bomb
  14.   attr_reader :power
  15.   attr_reader :graze
  16.   #--------------------------------------------------------------------------
  17.   # ● オブジェクト初期化
  18.   #--------------------------------------------------------------------------
  19.   def initialize
  20.     super(nil)
  21.     @hi_score = $game_variables[TSHOOT::HI_SCORE_ID]
  22.     @score = 0
  23.     @life = $game_temp.tshoot_life
  24.     @bomb = $game_temp.tshoot_bomb
  25.     @power = 0
  26.     @graze = 0
  27.     self.x = 336
  28.     self.y = 0
  29.     self.z = 9100
  30.     self.bitmap = Bitmap.new(208, 192)
  31.     @flag_hi = true    # 再描画フラグ
  32.     @flag_score = true    # 再描画フラグ
  33.     @flag_life = true    # 再描画フラグ
  34.     @flag_bomb = true    # 再描画フラグ
  35.     @flag_power = true    # 再描画フラグ
  36.     @flag_graze = true    # 再描画フラグ
  37.     @bitmap_number = Cache.system("number")
  38.     redraw
  39.   end
  40.   #--------------------------------------------------------------------------
  41.   # ● 解放
  42.   #--------------------------------------------------------------------------
  43.   def dispose
  44.     @bitmap_number.dispose
  45.     super
  46.   end
  47.   #--------------------------------------------------------------------------
  48.   # ● スコアを加算
  49.   #--------------------------------------------------------------------------
  50.   def add_score(n)
  51.     @score += n
  52.     if @hi_score < @score
  53.       @hi_score = @score
  54.       @flag_hi = true
  55.     end
  56.     @flag_score = true
  57.   end
  58.   #--------------------------------------------------------------------------
  59.   # ● ライフを加算
  60.   #--------------------------------------------------------------------------
  61.   def add_life(n)
  62.     @life += n
  63.     if @life < 0
  64.       @life = 0
  65.       $scene.state = 2
  66.       Audio.me_play("Audio/ME/Shock.mid", 100, 100)
  67.     end
  68.     @flag_life = true
  69.   end
  70.   #--------------------------------------------------------------------------
  71.   # ● ボムを代入
  72.   #--------------------------------------------------------------------------
  73.   def set_bomb(n)
  74.     @bomb = n
  75.     @flag_bomb = true
  76.   end
  77.   #--------------------------------------------------------------------------
  78.   # ● ボムを加算
  79.   #--------------------------------------------------------------------------
  80.   def add_bomb(n)
  81.     @bomb += n
  82.     @flag_bomb = true
  83.   end
  84.   #--------------------------------------------------------------------------
  85.   # ● パワーを加算
  86.   #--------------------------------------------------------------------------
  87.   def add_power(n)
  88.     @power = [[@power + n, 0].max, TSHOOT::POWER_MAX].min
  89.     @flag_power = true
  90.   end
  91.   #--------------------------------------------------------------------------
  92.   # ● グレイズを加算
  93.   #--------------------------------------------------------------------------
  94.   def add_graze
  95.     @graze += 1
  96.     @flag_graze = true
  97.   end
  98.   #--------------------------------------------------------------------------
  99.   # ● 再描画
  100.   #--------------------------------------------------------------------------
  101.   def redraw
  102.     draw_number(16, 17, 176, 20, @hi_score) if @flag_hi
  103.     draw_number(16, 45, 176, 20, @score) if @flag_score
  104.     draw_star(68, 85, 124, 20, @life) if @flag_life
  105.     draw_star(68, 109, 124, 20, @bomb) if @flag_bomb
  106.     draw_number(16, 137, 176, 20, @power) if @flag_power
  107.     draw_number(16, 165, 176, 20, @graze) if @flag_graze
  108.     @flag_hi = false
  109.     @flag_score = false
  110.     @flag_life = false
  111.     @flag_bomb = false
  112.     @flag_power = false
  113.     @flag_graze = false
  114.   end
  115.   #--------------------------------------------------------------------------
  116.   # ● 数字の描画
  117.   #--------------------------------------------------------------------------
  118.   def draw_number(x, y, width, height, value)
  119.     self.bitmap.clear_rect(x, y, width, height)
  120.     x = x + width - 8
  121.     rect = Rect.new(value % 10 * 8, 0, 8, 16)
  122.     while(1)
  123.       self.bitmap.blt(x, y, @bitmap_number, rect)
  124.       value /= 10
  125.       break if value == 0
  126.       x -= 8
  127.       rect.set(value % 10 * 8, 0, 8, 16)
  128.     end
  129.   end
  130.   #--------------------------------------------------------------------------
  131.   # ● 星アイコンの描画
  132.   #--------------------------------------------------------------------------
  133.   def draw_star(x, y, width, height, value)
  134.     self.bitmap.clear_rect(x, y, width, height)
  135.     rect = Rect.new(96, 0, 16, 16)
  136.     for i in 0...8
  137.       rect.set(80, 0, 16, 16) if i == value
  138.       self.bitmap.blt(x, y, @bitmap_number, rect)
  139.       x += 16
  140.     end
  141.   end
  142. end
复制代码
  1. #==============================================================================
  2. # ■ TShoot_Popup
  3. #------------------------------------------------------------------------------
  4. #  シューティングのポップアップクラス
  5. #==============================================================================
  6. class TShoot_Popup < Sprite
  7.   #--------------------------------------------------------------------------
  8.   # ● オブジェクト初期化
  9.   #--------------------------------------------------------------------------
  10.   def initialize(x, y, text, color = Color.new(255, 255, 255))
  11.     super()
  12.     self.x = x
  13.     self.y = y
  14.     self.z = 80
  15.     bitmap = Bitmap.new(32, 20)
  16.     bitmap.font.size = 16
  17.     w = bitmap.text_size(text).width
  18.     bitmap.dispose
  19.     self.x -= w / 2
  20.     bitmap = Bitmap.new(w, 20)
  21.     bitmap.font.size = 16
  22.     bitmap.font.color = color
  23.     bitmap.draw_text(0, 0, w, 24, text, 0)
  24.     self.bitmap = bitmap
  25.     @cnt = 64
  26.   end
  27.   #--------------------------------------------------------------------------
  28.   # ● フレーム更新
  29.   #--------------------------------------------------------------------------
  30.   def update
  31.     @cnt -= 1
  32.     self.opacity = @cnt << 3# if @cnt < 32
  33.     dispose if @cnt == 0
  34.   end
  35. end

复制代码
  1. #==============================================================================
  2. # ■ TShoot_Effect
  3. #------------------------------------------------------------------------------
  4. #  シューティングのエフェクトクラス
  5. #==============================================================================
  6. class TShoot_Effect < Sprite
  7.   #--------------------------------------------------------------------------
  8.   # ● オブジェクト初期化
  9.   #--------------------------------------------------------------------------
  10.   def initialize(x, y, vx, vy)
  11.     super()
  12.     self.x = x
  13.     self.y = y
  14.     @sx = x << 10
  15.     @sy = y << 10
  16.     @vx = vx
  17.     @vy = vy
  18.     set_type
  19.   end
  20.   #--------------------------------------------------------------------------
  21.   # ● フレーム更新
  22.   #--------------------------------------------------------------------------
  23.   def update
  24.     update_type
  25.     @sx += @vx
  26.     @sy += @vy
  27.     self.x = @sx >> 10
  28.     self.y = @sy >> 10
  29.     @cnt -= 1
  30.     self.x = 352 if @cnt == 0
  31.     if self.x < -self.width or self.x >= 352 or self.y < -self.height or self.y >= 416
  32.       dispose
  33.       return
  34.     end
  35.   end
  36. end

  37. #==============================================================================
  38. # ■ 爆発エフェクト
  39. #==============================================================================
  40. class TShoot_Effect1 < TShoot_Effect
  41.   def set_type
  42.     self.bitmap = Cache.system("effect1")
  43.     self.opacity = 128
  44.     self.z = 105
  45.     @cnt = 2048
  46.   end
  47.   def update_type
  48.     self.opacity -= 1
  49.   end
  50. end

  51. #==============================================================================
  52. # ■ 弾ヒットエフェクト
  53. #==============================================================================
  54. class TShoot_Effect2 < TShoot_Effect
  55.   def set_type
  56.     self.bitmap = Cache.system("effect1")
  57.     self.opacity = 255
  58.     self.ox = 16
  59.     self.oy = 16
  60.     self.z = 105
  61.     self.zoom_x = 0.5
  62.     self.zoom_y = 0.5
  63.     @cnt = 32
  64.   end
  65.   def update_type
  66.     self.opacity -= 8
  67.     self.zoom_x += 0.01
  68.     self.zoom_y += 0.01
  69.   end
  70. end

  71. #==============================================================================
  72. # ■ 敵爆発エフェクト
  73. #==============================================================================
  74. class TShoot_Effect3 < TShoot_Effect
  75.   def set_type
  76.     self.bitmap = Cache.system("effect1")
  77.     self.opacity = 255
  78.     self.ox = 16
  79.     self.oy = 16
  80.     self.z = 105
  81.     self.zoom_x = 0.5
  82.     self.zoom_y = 0.5
  83.     @cnt = 32
  84.   end
  85.   def update_type
  86.     self.opacity -= 8
  87.     self.zoom_x += 0.14
  88.     self.zoom_y += 0.14
  89.   end
  90. end

  91. #==============================================================================
  92. # ■ グレイズエフェクト
  93. #==============================================================================
  94. class TShoot_Effect4 < TShoot_Effect
  95.   def set_type
  96.     self.bitmap = Cache.system("effect2")
  97.     self.z = 105
  98.     @cnt = 48
  99.   end
  100.   def update_type
  101.     self.opacity -= 6
  102.   end
  103. end
复制代码
  1. #==============================================================================
  2. # ■ TShoot_Scene
  3. #------------------------------------------------------------------------------
  4. #  シューティングのシーンクラス
  5. #==============================================================================
  6. class TShoot_Scene < Scene_Base
  7.   #--------------------------------------------------------------------------
  8.   # ● 公開インスタンス変数
  9.   #--------------------------------------------------------------------------
  10.   attr_reader :back_ground
  11.   attr_reader :info
  12.   attr_reader :player
  13.   attr_reader :enemy
  14.   attr_reader :bullet
  15.   attr_reader :enemy_num
  16.   attr_accessor :state
  17.   attr_accessor :se_flag
  18.   #--------------------------------------------------------------------------
  19.   # ● 開始処理
  20.   #--------------------------------------------------------------------------
  21.   def start
  22.     $game_temp.map_bgm = RPG::BGM.last
  23.     $game_temp.map_bgs = RPG::BGS.last
  24.     RPG::BGM.stop
  25.     RPG::BGS.stop
  26.     Audio.bgm_play($game_temp.tshoot_bgm, 100, 100)
  27.     @state = 0    # シーンの状態
  28.     $game_temp.tshoot_stage.sort    # ステージデータをソート
  29.     @stage = $game_temp.tshoot_stage
  30.     @player = TShoot_Player.new(144, 336)
  31.     @enemy = []
  32.     @bullet = []
  33.     @item = []
  34.     @back_ground = TShoot_Ground.new
  35.     @info = TShoot_Info.new
  36.     @popup = []
  37.     @se_flag = []
  38.     for i in 0...16 do @se_flag[i] = false end
  39.     @message_window = TShoot_Message.new
  40.     @enemy_num = 0
  41.   end
  42.   #--------------------------------------------------------------------------
  43.   # ● 終了処理
  44.   #--------------------------------------------------------------------------
  45.   def terminate
  46.     $game_temp.map_bgm.play
  47.     $game_temp.map_bgs.play
  48.     $game_variables[TSHOOT::RESULT_SCORE_ID] = @info.score
  49.     $game_switches[TSHOOT::RESULT_CLEAR_ID] = (@state == 1)
  50.     @player.dispose
  51.     clear_all
  52.     @back_ground.dispose
  53.     @info.dispose
  54.     for i in [email protected]
  55.       @popup[i].dispose if @popup[i] != nil
  56.     end
  57.     @message_window.dispose
  58.   end
  59.   #--------------------------------------------------------------------------
  60.   # ● フレーム更新
  61.   #--------------------------------------------------------------------------
  62.   def update
  63.     Input.mouse_update
  64.     @back_ground.update
  65.     for i in [email protected]
  66.       next if @popup[i] == nil
  67.       @popup[i].update
  68.       @popup[i] = nil if @popup[i].disposed?
  69.     end
  70.     @message_window.update    # メッセージウィンドウを更新
  71.     return if $game_message.visible
  72.     case @state
  73.     when 0
  74.       update_game
  75.     when 1
  76.       update_result
  77.     when 2
  78.       update_gameover
  79.     end
  80.     @info.redraw
  81.     for i in 0...16
  82.       if @se_flag[i]
  83.         Audio.se_play("Audio/SE/"+TSHOOT::SE_NAME[i][0], TSHOOT::SE_NAME[i][1],
  84.           TSHOOT::SE_NAME[i][2])
  85.         @se_flag[i] = false
  86.         break
  87.       end
  88.     end
  89.   end
  90.   #--------------------------------------------------------------------------
  91.   # ● ゲームのフレーム更新
  92.   #--------------------------------------------------------------------------
  93.   def update_game
  94.     @stage.update
  95.     @player.update
  96.     for i in [email protected]
  97.       next if @enemy[i] == nil
  98.       @enemy[i].update
  99.       if @enemy[i].disposed?
  100.         @enemy_num -= 1
  101.         @enemy[i] = nil
  102.       end
  103.     end
  104.     for i in [email protected]
  105.       next if @bullet[i] == nil
  106.       @bullet[i].update
  107.       @bullet[i] = nil if @bullet[i].disposed?
  108.     end
  109.     for i in [email protected]
  110.       next if @item[i] == nil
  111.       @item[i].update
  112.       @item[i] = nil if @item[i].disposed?
  113.     end
  114.     if Input.trigger?(Input::Z)
  115.       @state = 2
  116.       Audio.me_play("Audio/ME/Shock.mid", 100, 100)
  117.     end
  118.   end
  119.   #--------------------------------------------------------------------------
  120.   # ● リザルトのフレーム更新
  121.   #--------------------------------------------------------------------------
  122.   def update_result
  123.     if Input.trigger?(Input::C) or
  124.        ($game_switches[TSHOOT::SW_MOUSE_INPUT] and Input.mouse_trigger?("MLB"))
  125.       $scene = Scene_Map.new
  126.     end
  127.   end
  128.   #--------------------------------------------------------------------------
  129.   # ● ゲームオーバーのフレーム更新
  130.   #--------------------------------------------------------------------------
  131.   def update_gameover
  132.     if Input.trigger?(Input::C) or
  133.        ($game_switches[TSHOOT::SW_MOUSE_INPUT] and Input.mouse_trigger?("MLB"))
  134.       $scene = Scene_Map.new
  135.     end
  136.   end
  137.   #--------------------------------------------------------------------------
  138.   # ● 自機弾の追加処理
  139.   #--------------------------------------------------------------------------
  140.   def add_pbullet(x, y, angle, speed, index, type)
  141.     i = @bullet.index(nil)
  142.     i = @bullet.size if i == nil
  143.     @bullet[i] = TShoot_PBullet.new(x, y, angle, speed, index, type)
  144.   end
  145.   #--------------------------------------------------------------------------
  146.   # ● 敵機弾の追加処理
  147.   #--------------------------------------------------------------------------
  148.   def add_ebullet(x, y, vx, vy, index, type)
  149.     i = @bullet.index(nil)
  150.     i = @bullet.size if i == nil
  151.     @bullet[i] = __send__(ADD_EBULLET_TYPE[ type ], x, y, vx, vy, index, i)
  152.     return i
  153.   end
  154.   #--------------------------------------------------------------------------
  155.   # ● 弾の全削除
  156.   #--------------------------------------------------------------------------
  157.   def clear_bullet
  158.     for i in [email protected]
  159.       @bullet[i].dispose if @bullet[i] != nil
  160.       @bullet[i] = nil
  161.     end
  162.   end
  163.   #--------------------------------------------------------------------------
  164.   # ● 全削除
  165.   #--------------------------------------------------------------------------
  166.   def clear_all
  167.     for i in [email protected]
  168.       @enemy[i].dispose if @enemy[i] != nil
  169.       @enemy[i] = nil
  170.     end
  171.     clear_bullet
  172.     for i in [email protected]
  173.       @item[i].dispose if @item[i] != nil
  174.       @item[i] = nil
  175.     end
  176.     @enemy_num = 0
  177.   end
  178.   #--------------------------------------------------------------------------
  179.   # ● アイテムの追加処理
  180.   #--------------------------------------------------------------------------
  181.   def add_item(x, y, vx, vy, type)
  182.     i = @item.index(nil)
  183.     i = @item.size if i == nil
  184.     @item[i] = TShoot_Item.new(x, y, vx, vy, type)
  185.   end
  186.   #--------------------------------------------------------------------------
  187.   # ● エフェクトの追加処理
  188.   #--------------------------------------------------------------------------
  189.   def add_effect(type, x, y, vx, vy)
  190.     i = @popup.index(nil)
  191.     i = @popup.size if i == nil
  192.     if type == 1
  193.       @popup[i] = TShoot_Effect1.new(x, y, vx, vy)
  194.     elsif type == 2
  195.       @popup[i] = TShoot_Effect2.new(x, y, vx, vy)
  196.     elsif type == 3
  197.       @popup[i] = TShoot_Effect3.new(x, y, vx, vy)
  198.     elsif type == 4
  199.       @popup[i] = TShoot_Effect4.new(x, y, vx, vy)
  200.     end
  201.   end
  202.   #--------------------------------------------------------------------------
  203.   # ● ポップアップの追加処理
  204.   #--------------------------------------------------------------------------
  205.   def add_popup(x, y, text, color = Color.new(255, 255, 255))
  206.     i = @popup.index(nil)
  207.     i = @popup.size if i == nil
  208.     @popup[i] = TShoot_Popup.new(x, y, text, color)
  209.   end
  210.   #--------------------------------------------------------------------------
  211.   # ● エネミーの追加処理
  212.   #--------------------------------------------------------------------------
  213.   def add_enemy(type, x, y, shot, move)
  214.     i = @enemy.index(nil)
  215.     i = @enemy.size if i == nil
  216.     @enemy[i] = __send__(ADD_ENEMY_TYPE[ type ], x, y, shot, move)
  217.     @enemy_num += 1
  218.   end
  219. end
复制代码


TheRebirth于2011-11-5 20:44补充以下内容:
......代码发不出去了,明天来

点评

嗯,太长,得找高手看  发表于 2011-11-5 20:49
回复

使用道具 举报

Lv3.寻梦者 (暗夜天使)

精灵族の天使

梦石
0
星屑
1702
在线时间
3038 小时
注册时间
2007-3-16
帖子
33731

开拓者贵宾

12
发表于 2011-11-5 22:02:44 | 只看该作者
下次要记得压缩文件啊,孩纸
回复

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
49
在线时间
177 小时
注册时间
2011-7-3
帖子
235
13
 楼主| 发表于 2011-11-6 10:49:04 | 只看该作者
  1. #==============================================================================
  2. # ■ 設定項目
  3. #==============================================================================
  4. module TSHOOT
  5.   RESULT_SCORE_ID = 1           # 結果のスコアを代入する変数のID
  6.   HI_SCORE_ID     = 2           # ハイスコアとして参照する変数のID
  7.   RESULT_CLEAR_ID = 1           # クリアしたかどうかを代入するスイッチのID
  8.   SW_MOUSE_INPUT  = 2           # マウス入力切替に使うゲームスイッチID
  9.   EBULLET_BLEND   = 0           # 敵機弾のブレンドモード(0=通常,1=加算,2=減算)
  10.   ITEM_OPACITY    = 160         # アイテムの透明度
  11.   ITEM_BLEND      = 0           # アイテムのブレンドモード(0=通常,1=加算,2=減算)
  12.   BG_SCROLL_SPEED = 8           # スクロール速度(ドット/フレーム)
  13.   USE_GRAZE_SE     = false      # 重くてもグレイズ効果音を鳴らすか
  14.   GC_COUNT = 120                # GCを実行する間隔(フレーム数)
  15.   INFO_FONT = ["Arial Black", "UmePlus Gothic", "MS Pゴシック"] # フォント

  16.   SE_NAME = []
  17.   SE_NAME[1] = ["Ice9.ogg", 80, 150]       # 敵ダメージ効果音
  18.   SE_NAME[2] = ["Explosion1.ogg", 80, 100] # 敵撃破効果音
  19.   SE_NAME[3] = ["Thunder6.ogg", 80, 100]   # 自機爆発効果音
  20.   SE_NAME[4] = ["Flash2.ogg", 80, 100]     # ボム効果音
  21.   SE_NAME[5] = ["Ice4.ogg", 80, 150]       # スコアアイテム効果音
  22.   SE_NAME[6] = ["Up.ogg", 80, 100]         # パワーアイテム効果音
  23.   SE_NAME[7] = ["Up.ogg", 80, 100]         # ライフアイテム効果音
  24.   SE_NAME[8] = ["Up.ogg", 80, 100]         # ボムアイテム効果音
  25.   SE_NAME[9] = ["Evasion.ogg", 60, 150]    # グレイズ効果音

  26.   # 自機ショット関連の設定
  27.   PBULLET_OPACITY = 128         # 自機弾の透明度
  28.   PBULLET_BLEND   = 1           # 自機弾のブレンドモード(0=通常,1=加算,2=減算)
  29.   ITEM_NEED       = 5           # パワーアップに必要なパワーアイテム数
  30.   POWER_MAX       = 25          # パワーアイテムの最大蓄積量
  31.   ITEM_LOST       = -5          # 被弾時に失うパワーアイテム数
  32.   USE_SHOT_PATTERN = true       # ショットパターンを使うか
  33.   # 自機のショットパターン
  34.   # [way数, way間隔, 発射方向, 速度, 画像インデックス, タイプ, 発射間隔]
  35.   # タイプを 1 にすると誘導弾になります……が、挙動が怪しいです。
  36.   # USE_SHOT_PATTERN が true のときのみ有効となります。
  37.   ANGLE_UP = Math::PI * 3 / 2
  38.   SHOT_PATTERN = [
  39.     [[1, 0.0,   ANGLE_UP, 4096, 0, 0, 8]], # レベル0
  40.     [[2, 0.1,   ANGLE_UP, 4096, 0, 0, 8]],  # レベル1
  41.     [[3, 0.1,   ANGLE_UP, 4096, 0, 0, 8]], # レベル2
  42.     [[4, 0.1,   ANGLE_UP, 4096, 0, 0, 8]],  # レベル3
  43.     [[5, 0.175, ANGLE_UP, 4096, 0, 0, 8]],  # レベル4
  44.     [[5, 0.15,  ANGLE_UP, 4096, 0, 0, 8],   # レベル5
  45.      [5, 0.6,   ANGLE_UP, 4096, 2, 1, 8]]
  46.   ]
  47. end

  48. class TShoot_Scene < Scene_Base
  49.   #--------------------------------------------------------------------------
  50.   # ● 敵機追加メソッド
  51.   #--------------------------------------------------------------------------
  52.   ADD_ENEMY_TYPE = {
  53.     1 => :add_enemy1, 2 => :add_enemy2, 3 => :add_enemy3, 4 => :add_enemy4,
  54.     5 => :add_enemy5, 6 => :add_enemy6, 7 => :add_enemy7, 8 => :add_enemy8,
  55.     9 => :add_enemy9, 10 => :add_enemy10, 11 => :add_enemy11, 12 => :add_enemy12,
  56.     13 => :add_enemy13, 14 => :add_enemy14, 15 => :add_enemy15, 16 => :add_enemy16
  57.   }
  58.   def add_enemy1(x, y, shot, move) TShoot_Enemy1.new(x, y, shot, move) end
  59.   def add_enemy2(x, y, shot, move) TShoot_Enemy2.new(x, y, shot, move) end
  60.   def add_enemy3(x, y, shot, move) TShoot_Enemy3.new(x, y, shot, move) end
  61.   def add_enemy4(x, y, shot, move) TShoot_Enemy4.new(x, y, shot, move) end
  62.   def add_enemy5(x, y, shot, move) TShoot_Enemy5.new(x, y, shot, move) end
  63.   def add_enemy6(x, y, shot, move) TShoot_Enemy6.new(x, y, shot, move) end
  64.   def add_enemy7(x, y, shot, move) TShoot_Enemy7.new(x, y, shot, move) end
  65.   def add_enemy8(x, y, shot, move) TShoot_Enemy8.new(x, y, shot, move) end
  66.   def add_enemy9(x, y, shot, move) TShoot_Enemy9.new(x, y, shot, move) end
  67.   def add_enemy10(x, y, shot, move) TShoot_Enemy10.new(x, y, shot, move) end
  68.   def add_enemy11(x, y, shot, move) TShoot_Enemy11.new(x, y, shot, move) end
  69.   def add_enemy12(x, y, shot, move) TShoot_Enemy12.new(x, y, shot, move) end
  70.   def add_enemy13(x, y, shot, move) TShoot_Enemy13.new(x, y, shot, move) end
  71.   def add_enemy14(x, y, shot, move) TShoot_Enemy14.new(x, y, shot, move) end
  72.   def add_enemy15(x, y, shot, move) TShoot_Enemy15.new(x, y, shot, move) end
  73.   def add_enemy16(x, y, shot, move) TShoot_Enemy16.new(x, y, shot, move) end
  74.   #--------------------------------------------------------------------------
  75.   # ● 敵弾追加メソッド
  76.   #--------------------------------------------------------------------------
  77.   ADD_EBULLET_TYPE = {
  78.     1 => :add_ebullet1, 2 => :add_ebullet2, 3 => :add_ebullet3,
  79.     4 => :add_ebullet4, 5 => :add_ebullet5, 6 => :add_ebullet6,
  80.     7 => :add_ebullet7, 8 => :add_ebullet8, 9 => :add_ebullet9,
  81.     10 => :add_ebullet10
  82.   }
  83.   def add_ebullet1(x, y, vx, vy, index, i) TShoot_EBullet1.new(x, y, vx, vy, index, i) end
  84.   def add_ebullet2(x, y, vx, vy, index, i) TShoot_EBullet2.new(x, y, vx, vy, index, i) end
  85.   def add_ebullet3(x, y, vx, vy, index, i) TShoot_EBullet3.new(x, y, vx, vy, index, i) end
  86.   def add_ebullet4(x, y, vx, vy, index, i) TShoot_EBullet4.new(x, y, vx, vy, index, i) end
  87.   def add_ebullet5(x, y, vx, vy, index, i) TShoot_EBullet5.new(x, y, vx, vy, index, i) end
  88.   def add_ebullet6(x, y, vx, vy, index, i) TShoot_EBullet6.new(x, y, vx, vy, index, i) end
  89.   def add_ebullet7(x, y, vx, vy, index, i) TShoot_EBullet7.new(x, y, vx, vy, index, i) end
  90.   def add_ebullet8(x, y, vx, vy, index, i) TShoot_EBullet8.new(x, y, vx, vy, index, i) end
  91.   def add_ebullet9(x, y, vx, vy, index, i) TShoot_EBullet9.new(x, y, vx, vy, index, i) end
  92.   def add_ebullet10(x, y, vx, vy, index, i) TShoot_EBullet10.new(x, y, vx, vy, index, i) end
  93. end
  94.   
  95. #==============================================================================
  96. # 設定項目はここまで
  97. #==============================================================================

  98. #==============================================================================
  99. # ■コマンド(これは設定項目ではありません)
  100. #==============================================================================
  101. module TSHOOT
  102.   module Commands
  103.     module_function
  104.     #--------------------------------------------------------------------------
  105.     # ● ステージデータの初期化
  106.     #--------------------------------------------------------------------------
  107.     def reset_stage
  108.       $game_temp.tshoot_stage.reset
  109.     end
  110.     #--------------------------------------------------------------------------
  111.     # ● 背景画像の指定
  112.     #--------------------------------------------------------------------------
  113.     def set_ground(file)
  114.       $game_temp.tshoot_ground = file
  115.     end
  116.     #--------------------------------------------------------------------------
  117.     # ● BGMの指定
  118.     #--------------------------------------------------------------------------
  119.     def set_bgm(file)
  120.       $game_temp.tshoot_bgm = file
  121.     end
  122.     #--------------------------------------------------------------------------
  123.     # ● ステージデータの追加(敵機)
  124.     #--------------------------------------------------------------------------
  125.     def set_enemy(time, type, x, y, shot, move)
  126.       $game_temp.tshoot_stage.add(time, type, [x, y, shot, move])
  127.     end
  128.     #--------------------------------------------------------------------------
  129.     # ● ステージデータの追加(ストッパー)
  130.     #--------------------------------------------------------------------------
  131.     def set_stop(time, num = 0)
  132.       $game_temp.tshoot_stage.add(time, 204, [num])
  133.     end
  134.     #--------------------------------------------------------------------------
  135.     # ● ステージデータの追加(ステージ終了)
  136.     #--------------------------------------------------------------------------
  137.     def set_end(time)
  138.       $game_temp.tshoot_stage.add(time, 205, [0])
  139.     end
  140.     #--------------------------------------------------------------------------
  141.     # ● ステージデータの追加(メッセージ)
  142.     #--------------------------------------------------------------------------
  143.     def set_message(time, message)
  144.       $game_temp.tshoot_stage.add(time, 200, ["", 0, 1, 2, message])
  145.     end
  146.     #--------------------------------------------------------------------------
  147.     # ● ステージデータの追加(ピクチャの表示)
  148.     #--------------------------------------------------------------------------
  149.     def set_picture(time, number, name, origin, x, y, zoom_x, zoom_y, opacity, blend_type)
  150.       $game_temp.tshoot_stage.add(time, 201, [number, name, origin, x, y, zoom_x, zoom_y, opacity, blend_type])
  151.     end
  152.     #--------------------------------------------------------------------------
  153.     # ● ステージデータの追加(会話用ピクチャの表示)
  154.     #--------------------------------------------------------------------------
  155.     def set_face(time, name1, name2, flag = false)
  156.       if name1 != ""
  157.         x = flag ? -96 : -64
  158.         opacity = flag ? 128 : 255
  159.         $game_temp.tshoot_stage.add(time, 201, [1, name1, 0, x, 96, 100, 100, opacity, 0])
  160.       else
  161.         $game_temp.tshoot_stage.add(time, 202, [1])
  162.       end
  163.       if name2 != ""
  164.         x = flag ? 144 : 176
  165.         opacity = flag ? 255 : 128
  166.         $game_temp.tshoot_stage.add(time, 201, [2, name2, 0, x, 96, 100, 100, opacity, 0])
  167.       else
  168.         $game_temp.tshoot_stage.add(time, 202, [2])
  169.       end
  170.     end
  171.     #--------------------------------------------------------------------------
  172.     # ● ステージデータの追加(ピクチャの消去)
  173.     #--------------------------------------------------------------------------
  174.     def erase_picture(time, number)
  175.       $game_temp.tshoot_stage.add(time, 202, [number])
  176.     end
  177.     #--------------------------------------------------------------------------
  178.     # ● ステージデータの追加(全削除)
  179.     #--------------------------------------------------------------------------
  180.     def erase_all(time)
  181.       $game_temp.tshoot_stage.add(time, 203, [0])
  182.     end
  183.   end
  184. end
  185.   
  186. class Game_Interpreter
  187.   include TSHOOT::Commands
  188. end
复制代码
  1. #==============================================================================
  2. # ■ 敵の作成について
  3. #------------------------------------------------------------------------------
  4. #  まずはデフォルトの敵をいろいろいじって試してみてください
  5. #   "敵弾設定と雛形" に基本的な弾幕と移動パターンを用意しました
  6. #   デフォルトのタイプ4のように laser_shot(0) と書くだけで
  7. #   折れ曲がるレーザーが撃てます。
  8. #
  9. #   nway_shot(n, space, angle, speed, aim, index, type, blend)
  10. #     n : 発射する弾数
  11. #     space : 弾同士の間隔
  12. #     angle : 弾を発射する方向(0.0~6.28)
  13. #     speed : 弾の移動速度
  14. #     aim : 自機狙いフラグ、trueで自機狙い、falseで無効
  15. #     index : 弾の色
  16. #     type : 弾のタイプ(1~7)、省略可
  17. #
  18. #   nall_shot(n, angle, speed, aim, index, type, blend)
  19. #     nway_shotと同じです、弾の間隔は自動的に算出されます
  20. #
  21. #   turn_up / turn_down / turn_left / turn_right
  22. #     向きを変えます、変わるのは画像の向きだけで
  23. #     ショットや移動方向にはまったく影響しません
  24. #
  25. #   その他初期状態で使えるメソッド
  26. #   使用例はデフォルトの敵機タイプ1~12を参照してください
  27. #     basic_move1
  28. #     basic_move2(stop_time = 300)
  29. #     chain_shot(n, way, speed, index, type = 1)
  30. #     wide_shot(n, way, speed, index, type = 1)
  31. #     winder_shot(way, index, type = 1)
  32. #     whirl_shot(way, index, type = 1)
  33. #     whirl_shot2(way, index, type = 1)
  34. #     laser_shot(index)
  35. #     whip_shot(way, index, type = 1)
  36. #     machine_shot(way, speed, index, type = 1)
  37. #
  38. #   初期状態で設定されている弾のタイプ(type の値として使用)
  39. #   ただし、レーザー弾は特殊な使い方となります。
  40. #     1 … 通常弾
  41. #     2 … 大きい通常弾
  42. #     3 … レーザー弾(親)
  43. #     4 … レーザー弾(子)
  44. #     5 … 壁で一度跳ね返る弾
  45. #     6 … 自機狙いに変化する弾
  46. #     7 … 自機狙いに変化する大きい弾
  47. #==============================================================================

  48. #==============================================================================
  49. # ■ 敵機タイプ1
  50. #------------------------------------------------------------------------------
  51. #  画面上部でうろうろしながら後退、自機狙いのnWAY3連ショット
  52. #   @shot = ショットのway数
  53. #   @move = 未使用
  54. #==============================================================================
  55. class TShoot_Enemy1 < TShoot_Enemy
  56.   # 出現時の処理
  57.   def set_type
  58.     @hp = 6                       # 敵の耐久力(省略時5)
  59.     @score = 2                    # 持っているスコアアイテムの数(省略時1)
  60.     @power = 5                    # 持っているパワーアイテムの数(省略時0)
  61.     @life = 0                     # 持っているライフアイテムの数(省略時0)
  62.     @bomb = 0                     # 持っているボムアイテムの数(省略時0)
  63.     @file_name = "Monster"        # 敵機の画像ファイル
  64.     @file_index = 2               # 敵機の画像インデックス
  65.     @vx = 0                       # x方向の初期速度(省略時0)
  66.     @vy = 2 << 10                 # y方向の初期速度(省略時0)
  67.     @cnt_shot = 150               # 出現から攻撃開始までの時間(省略時0)
  68.     @cnt_shot_reset = 180         # 攻撃間隔(省略時180)
  69.   end
  70.   # 毎フレーム実行される処理
  71.   def action
  72.     basic_move1                   # 移動の処理
  73.     chain_shot(3, @shot, 1500, 1) # ショットの処理(連射数, way数, 弾速, 弾色)
  74.   end
  75. end

  76. #==============================================================================
  77. # ■ 敵機タイプ2
  78. #------------------------------------------------------------------------------
  79. #  ワインダー(@cnt_chotは使えません)
  80. #   @shot = way数
  81. #   @move = 攻撃時間
  82. #==============================================================================
  83. class TShoot_Enemy2 < TShoot_Enemy
  84.   def set_type
  85.     @hp = 25
  86.     @file_name = "Monster"
  87.     @file_index = 0
  88.     @vy = 2 << 10
  89.   end
  90.   def action
  91.     basic_move2(@move)
  92.     winder_shot(@shot, 2) if @vy == 0   # (way数, 弾色)
  93.   end
  94. end

  95. #==============================================================================
  96. # ■ 敵機タイプ3
  97. #------------------------------------------------------------------------------
  98. #  回転砲台
  99. #   @shot = way数
  100. #   @move = 攻撃時間
  101. #==============================================================================
  102. class TShoot_Enemy3 < TShoot_Enemy
  103.   def set_type
  104.     @hp = 25
  105.     @file_name = "Monster"
  106.     @file_index = 0
  107.     @vy = 2 << 10
  108.     @angle_shot = Math::PI if self.x < 144     # 左右対称にするしかけ
  109.   end
  110.   def action
  111.     basic_move2(@move)
  112.     whirl_shot(@shot, 3) if @vy == 0      # (way数, 弾色)
  113.   end
  114. end

  115. #==============================================================================
  116. # ■ 敵機タイプ4
  117. #------------------------------------------------------------------------------
  118. #  画面上部でうろうろしながら後退、折れ曲がるレーザー発射
  119. #   @shot = ショットのway数
  120. #   @move = 未使用
  121. #==============================================================================
  122. class TShoot_Enemy4 < TShoot_Enemy
  123.   def set_type
  124.     @hp = 10
  125.     @file_name = "Monster"
  126.     @file_index = 2
  127.     @vy = 2 << 10
  128.     @cnt_shot_reset = 180
  129.   end
  130.   def action
  131.     basic_move1
  132.     laser_shot(0)       # (弾色)
  133.   end
  134. end

  135. #==============================================================================
  136. # ■ 敵機タイプ5
  137. #------------------------------------------------------------------------------
  138. #  画面上部でうろうろしながら後退、鞭ショットを発射
  139. #   @shot = ショットのway数
  140. #   @move = 未使用
  141. #==============================================================================
  142. class TShoot_Enemy5 < TShoot_Enemy
  143.   def set_type
  144.     @hp = 10
  145.     @file_name = "Monster"
  146.     @file_index = 2
  147.     @vy = 2 << 10
  148.     @cnt_shot_reset = 180
  149.   end
  150.   def action
  151.     basic_move1
  152.     whip_shot(@shot, 4)   # (way数, 弾色)
  153.   end
  154. end

  155. #==============================================================================
  156. # ■ 敵機タイプ6
  157. #------------------------------------------------------------------------------
  158. #  画面上部でうろうろしながら後退、自機狙いの全方位4連ショット壁反射
  159. #   @shot = ショットのway数
  160. #   @move = 未使用
  161. #==============================================================================
  162. class TShoot_Enemy6 < TShoot_Enemy
  163.   def set_type
  164.     @hp = 25
  165.     @file_name = "Monster"
  166.     @file_index = 2
  167.     @vy = 2 << 10
  168.     @cnt_shot_reset = 180
  169.   end
  170.   def action
  171.     basic_move1
  172.     wide_shot(4, @shot, 1500, 1, 5) # (連射数, way数, 弾速, 弾色, 弾種)
  173.   end
  174. end

  175. #==============================================================================
  176. # ■ 敵機タイプ7
  177. #------------------------------------------------------------------------------
  178. #  画面上部でうろうろしながら後退、撃破時爆発
  179. #   @shot = ショットのway数
  180. #   @move = 未使用
  181. #==============================================================================
  182. class TShoot_Enemy7 < TShoot_Enemy
  183.   def set_type
  184.     @hp = 1
  185.     @file_name = "Monster"
  186.     @file_index = 2
  187.     @vy = 3 << 10
  188.   end
  189.   def action
  190.     basic_move1
  191.   end
  192.   # ダメージを受けたときの処理
  193.   def damage
  194.     super       # 親クラス(TShoot_Enemy)の同メソッドを呼ぶ
  195.     nall_shot(@shot, 0.0, 2048, false, 3) if @hp == 0
  196.   end
  197. end

  198. #==============================================================================
  199. # ■ 敵機タイプ8
  200. #------------------------------------------------------------------------------
  201. #  ばらまきショット
  202. #   @shot = way数
  203. #   @move = 攻撃時間
  204. #==============================================================================
  205. class TShoot_Enemy8 < TShoot_Enemy
  206.   def set_type
  207.     @hp = 25
  208.     @file_name = "Monster"
  209.     @file_index = 0
  210.     @vy = 2 << 10
  211.     @cnt_shot_reset = 180
  212.   end
  213.   def action
  214.     basic_move2(@move)
  215.     machine_shot(@shot, 1500, 2)  # (way数, 弾速, 弾色)
  216.   end
  217. end

  218. #==============================================================================
  219. # ■ 敵機タイプ9
  220. #------------------------------------------------------------------------------
  221. #  くねくね移動、自機狙いのnWAY3連ショット
  222. #   @shot = ショットのway数
  223. #   @move = 移動方向(0 = 下、1 = 右、2 = 左)
  224. #==============================================================================
  225. class TShoot_Enemy9 < TShoot_Enemy
  226.   def set_type
  227.     @hp = 8
  228.     @file_name = "Monster"
  229.     @file_index = 3
  230.     @angle_move = 0.0
  231.     if @move == 0
  232.       @base_pos = @sx
  233.       @vy = 1024
  234.     else
  235.       @base_pos = @sy
  236.       @vx = (@move == 1 ? 1024 : -1024)
  237.     end
  238.     @cnt_shot_reset = 180
  239.   end
  240.   def action
  241.     @angle_move += Math::PI / 120
  242.     if @move == 0
  243.       @sx = (Math.sin(@angle_move) * (32 << 10)).to_i + @base_pos
  244.     else
  245.       @sy = (Math.sin(@angle_move) * (32 << 10)).to_i + @base_pos
  246.     end
  247.     chain_shot(3, @shot, 1500, 1) # ショットの処理(連射数, way数, 弾速, 弾色)
  248.   end
  249. end

  250. #==============================================================================
  251. # ■ 敵機タイプ10
  252. #------------------------------------------------------------------------------
  253. #  回転砲台(弾が自機狙いに変化する)
  254. #   @shot = way数
  255. #   @move = 攻撃時間
  256. #==============================================================================
  257. class TShoot_Enemy10 < TShoot_Enemy
  258.   def set_type
  259.     @hp = 25
  260.     @file_name = "Monster"
  261.     @file_index = 0
  262.     @vy = 2 << 10
  263.     @angle_shot = Math::PI if self.x < 144     # 左右対称にするしかけ
  264.   end
  265.   def action
  266.     basic_move2(@move)
  267.     whirl_shot2(@shot, 3, 6) if @vy == 0      # (way数, 弾色, 弾種)
  268.   end
  269. end

  270. #==============================================================================
  271. # ■ 敵機タイプ11
  272. #------------------------------------------------------------------------------
  273. #   ただまっすぐに移動するだけ
  274. #   @shot = 未使用
  275. #   @move = 移動方向(0.0 ~ 6.283184)
  276. #==============================================================================
  277. class TShoot_Enemy11 < TShoot_Enemy
  278.   def set_type
  279.     @hp = 1
  280.     @file_name = "Monster"
  281.     @file_index = 2
  282.     @vx = (Math.cos(@move) * 1536).to_i    # x方向の初期速度
  283.     @vy = (Math.sin(@move) * 1536).to_i    # y方向の初期速度
  284.   end
  285. end

  286. #==============================================================================
  287. # ■ 敵機タイプ12
  288. #------------------------------------------------------------------------------
  289. #  ボス、直進→停止→ひたすら攻撃+撃破でゲーム終了
  290. #   @shot = 未使用
  291. #   @move = 未使用
  292. #==============================================================================
  293. class TShoot_Enemy12 < TShoot_Enemy
  294.   def set_type
  295.     @hp = 100
  296.     @score = 0
  297.     @file_name = "Spiritual"
  298.     @file_index = 4
  299.     @angle_shot = 0.0
  300.     Audio.bgm_play("Audio/BGM/Battle1.mid", 100, 100)   # 登場時にBGM変更
  301.   end
  302.   def action
  303.     @cnt_shot += 1
  304.     if @angle_shot < Math::PI / 2
  305.       @angle_shot += 0.01
  306.       @sy = (Math.sin(@angle_shot) * (128 << 10)).to_i - (32 << 10)
  307.       @cnt_shot = 0
  308.     elsif @cnt_shot % 4 == 0
  309.       @cnt_shot = 0 if @cnt_shot == 192
  310.       if @cnt_shot < 32
  311.         nall_shot(32, 0.0, 4096, false, 5)
  312.         nall_shot(16, 0.0, 2048, false, 2, 7) if @cnt_shot % 8 == 0
  313.       elsif @cnt_shot >= 64 and @cnt_shot < 96
  314.         nall_shot(32, Math::PI / 32, 4096, false, 5)
  315.       elsif @cnt_shot >= 128 and @cnt_shot < 160
  316.         nway_shot(5, 0.3, 0.0, 4096, true, 0)
  317.       end
  318.     end
  319.   end
  320. end
复制代码
  1. #==============================================================================
  2. # ■ 敵機弾タイプ1
  3. #------------------------------------------------------------------------------
  4. #  通常弾
  5. #==============================================================================
  6. class TShoot_EBullet1 < TShoot_EBullet
  7.   def set_type
  8.     self.blend_type = TSHOOT::EBULLET_BLEND
  9.     self.bitmap = Cache.system("ebullet1")
  10.     self.src_rect = Rect.new(@index * 12, 0, 12, 12)
  11.   end
  12. end

  13. #==============================================================================
  14. # ■ 敵機弾タイプ2
  15. #------------------------------------------------------------------------------
  16. #  大きい弾
  17. #==============================================================================
  18. class TShoot_EBullet2 < TShoot_EBullet
  19.   def set_type
  20.     self.blend_type = TSHOOT::EBULLET_BLEND
  21.     self.bitmap = Cache.system("ebullet2")
  22.     self.src_rect = Rect.new(@index * 32, 0, 32, 32)
  23.   end
  24. end

  25. #==============================================================================
  26. # ■ 敵機弾タイプ3
  27. #------------------------------------------------------------------------------
  28. #  レーザー用通常弾
  29. #==============================================================================
  30. class TShoot_EBullet3 < TShoot_EBullet
  31.   def set_type
  32.     self.blend_type = 1
  33.     self.bitmap = Cache.system("ebullet1")
  34.     self.src_rect = Rect.new(@index * 12, 0, 12, 12)
  35.     @last_vx = [0, 0]
  36.     @last_vy = [0, 0]
  37.     Audio.se_play("Audio/SE/Thunder10.ogg", 70, 70)
  38.   end
  39.   def update
  40.     if @vy != 0
  41.       if $scene.player.y < self.y + self.width and $scene.player.y > self.y
  42.         @vx = $scene.player.x > self.x ? 2048 : -2048
  43.         @vy = 0
  44.       end
  45.     end
  46.     @last_vx[1] = @last_vx[0]
  47.     @last_vy[1] = @last_vy[0]
  48.     @last_vx[0] = @vx
  49.     @last_vy[0] = @vy
  50.     super
  51.   end
  52. end

  53. #==============================================================================
  54. # ■ 敵機弾タイプ4
  55. #------------------------------------------------------------------------------
  56. #  レーザー用通常弾(ご主人様についていく)
  57. #==============================================================================
  58. class TShoot_EBullet4 < TShoot_EBullet
  59.   def set_type
  60.     self.blend_type = 1
  61.     self.bitmap = Cache.system("ebullet1")
  62.     self.src_rect = Rect.new(@index * 12, 0, 12, 12)
  63.     @last_vx = [0, 0]
  64.     @last_vy = [0, 0]
  65. #~     @graze = false
  66.   end
  67.   def update
  68.     @last_vx[1] = @last_vx[0]
  69.     @last_vy[1] = @last_vy[0]
  70.     @last_vx[0] = @vx
  71.     @last_vy[0] = @vy
  72.     @master = -1 if $scene.bullet[@master] == nil
  73.     if @master >= 0
  74.       @vx = $scene.bullet[@master].last_vx[1]
  75.       @vy = $scene.bullet[@master].last_vy[1]
  76.     end
  77.     super
  78.   end
  79. end

  80. #==============================================================================
  81. # ■ 敵機弾タイプ5
  82. #------------------------------------------------------------------------------
  83. #  画面端で一度だけ跳ね返る弾
  84. #==============================================================================
  85. class TShoot_EBullet5 < TShoot_EBullet
  86.   def set_type
  87.     self.blend_type = TSHOOT::EBULLET_BLEND
  88.     self.bitmap = Cache.system("ebullet1")
  89.     self.src_rect = Rect.new(@index * 12, 0, 12, 12)
  90.     @bound = true
  91.   end
  92.   def update
  93.     if @bound
  94.       if self.x < 16 or self.x > 324
  95.         @vx = 0 - @vx
  96.         @bound = false
  97.       elsif self.y < 16 or self.y > 388
  98.         @vy = 0 - @vy
  99.         @bound = false
  100.       end
  101.     end
  102.     super
  103.   end
  104. end

  105. #==============================================================================
  106. # ■ 敵機弾タイプ6
  107. #------------------------------------------------------------------------------
  108. #  一定時間後、自機狙いに変化する
  109. #==============================================================================
  110. class TShoot_EBullet6 < TShoot_EBullet
  111.   def set_type
  112.     self.blend_type = TSHOOT::EBULLET_BLEND
  113.     self.bitmap = Cache.system("ebullet1")
  114.     self.src_rect = Rect.new(@index * 12, 0, 12, 12)
  115.     @cnt = 120
  116.   end
  117.   def update
  118.     @cnt -= 1
  119.     if @cnt == 60
  120.       @vx = 0
  121.       @vy = 0
  122.     elsif @cnt == 0
  123.       change_aim(1600)
  124.     end
  125.     super
  126.   end
  127. end

  128. #==============================================================================
  129. # ■ 敵機弾タイプ7
  130. #------------------------------------------------------------------------------
  131. #  一定時間後、自機狙いに変化する大きい弾
  132. #==============================================================================
  133. class TShoot_EBullet7 < TShoot_EBullet6
  134.   def set_type
  135.     self.blend_type = TSHOOT::EBULLET_BLEND
  136.     self.bitmap = Cache.system("ebullet2")
  137.     self.src_rect = Rect.new(@index * 32, 0, 32, 32)
  138.     @cnt = 120
  139.   end
  140. end

  141. #==============================================================================
  142. # ■ TShoot_Enemy
  143. #------------------------------------------------------------------------------
  144. #  シューティングの敵機クラス
  145. #==============================================================================
  146. class TShoot_Enemy < Sprite
  147.   #--------------------------------------------------------------------------
  148.   # ● 基本移動(上から出現、左右移動しながら上へ戻る)
  149.   #--------------------------------------------------------------------------
  150.   def basic_move1
  151.     @cnt_move += 1
  152.     @vx += @vx > 0 ? -16 : 16 if @vx != 0
  153.     @vy += @vy > 0 ? -16 : 16 if @vy != 0
  154.     if @cnt_move == 192
  155.       @vx = 1024
  156.       @vy = -512
  157.     elsif @cnt_move == 320
  158.       @vx = -1024
  159.       @vy = -512
  160.       @cnt_move = 64
  161.     end
  162.   end
  163.   #--------------------------------------------------------------------------
  164.   # ● 基本移動(上から出現、しばらくとどまったあと上へ戻る)
  165.   #--------------------------------------------------------------------------
  166.   def basic_move2(stop_time = 300)
  167.     @cnt_move += 1
  168.     @vy -= 16 if @vy > 0
  169.     @vy = -1024 if @cnt_move >= stop_time
  170.   end
  171.   #--------------------------------------------------------------------------
  172.   # ● 自機狙いn連ショット
  173.   #--------------------------------------------------------------------------
  174.   def chain_shot(n, way, speed, index, type = 1)
  175.     @cnt_shot -= 1
  176.     @cnt_shot = @cnt_shot_reset if @cnt_shot <= 0
  177.     for i in 0...n
  178.       if @cnt_shot == i * 10 + 10
  179.         nway_shot(way, 0.9 / way, 0.0, speed, true, index, type)
  180.       end
  181.     end
  182.   end
  183.   #--------------------------------------------------------------------------
  184.   # ● 自機狙いn連全方位ショット
  185.   #--------------------------------------------------------------------------
  186.   def wide_shot(n, way, speed, index, type = 1)
  187.     @cnt_shot -= 1
  188.     @cnt_shot = @cnt_shot_reset if @cnt_shot <= 0
  189.     for i in 0...n
  190.       if @cnt_shot == i * 10 + 10
  191.         nall_shot(way, 0.0, speed, true, index, type)
  192.       end
  193.     end
  194.   end
  195.   #--------------------------------------------------------------------------
  196.   # ● ワインダー
  197.   #--------------------------------------------------------------------------
  198.   def winder_shot(way, index, type = 1)
  199.     @cnt_shot += 1
  200.     @cnt_shot = 0 if @cnt_shot == 540
  201.     if @cnt_shot % 4 == 0
  202.       angle = (Math.sin(Math::PI * 2 * @cnt_shot / 540)) / 2 + Math::PI / 2
  203.       nway_shot(way, 2.8 / way, angle, 4096, false, index, type)
  204.     end
  205.   end
  206.   #--------------------------------------------------------------------------
  207.   # ● 回転砲台
  208.   # 位置が画面左側なら逆回転
  209.   #--------------------------------------------------------------------------
  210.   def whirl_shot(way, index, type = 1)
  211.     @cnt_shot -= 1
  212.     @cnt_shot = @cnt_shot_reset if @cnt_shot <= 0
  213.     if @cnt_shot % 12 == 0
  214.       @angle_shot += self.x < 144 ? -0.2 : 0.2
  215.       nall_shot(way, @angle_shot, 1280, false, index, type)
  216.     end
  217.   end
  218.   #--------------------------------------------------------------------------
  219.   # ● 高速回転砲台
  220.   # 位置が画面左側なら逆回転
  221.   #--------------------------------------------------------------------------
  222.   def whirl_shot2(way, index, type = 1)
  223.     @cnt_shot -= 1
  224.     @cnt_shot = @cnt_shot_reset if @cnt_shot <= 0
  225.     if @cnt_shot % 4 == 0
  226.       @angle_shot += self.x < 144 ? -0.5 : 0.5
  227.       nall_shot(way, @angle_shot, 1280, false, index, type)
  228.     end
  229.   end
  230.   #--------------------------------------------------------------------------
  231.   # ● 直角に折れ曲がるレーザー
  232.   #--------------------------------------------------------------------------
  233.   def laser_shot(index)
  234.     @cnt_shot -= 1
  235.     @cnt_shot = @cnt_shot_reset if @cnt_shot <= 0
  236.     if @cnt_shot == 10
  237.       id = $scene.add_ebullet(@sx, @sy, 0, 2048, index, 3)
  238.       for i in 0...19
  239.         last_id = $scene.add_ebullet(@sx, @sy, 0, 0, index, 4)
  240.         $scene.bullet[last_id].set_master(id)
  241.         id = last_id
  242.       end
  243.     end
  244.   end
  245.   #--------------------------------------------------------------------------
  246.   # ● 自機狙い鞭ショット
  247.   #--------------------------------------------------------------------------
  248.   def whip_shot(way, index, type = 1)
  249.     @cnt_shot -= 1
  250.     @cnt_shot = @cnt_shot_reset if @cnt_shot <= 0
  251.     nway_shot(way, 0.9 / way, 0.0, 3072, true, index, type) if @cnt_shot == 10
  252.     nway_shot(way, 0.9 / way, 0.0, 2048, true, index, type) if @cnt_shot == 20
  253.     nway_shot(way, 0.9 / way, 0.0, 1536, true, index, type) if @cnt_shot == 30
  254.     nway_shot(way, 0.9 / way, 0.0, 1280, true, index, type) if @cnt_shot == 40
  255.     nway_shot(way, 0.9 / way, 0.0, 1024, true, index, type) if @cnt_shot == 50
  256.   end
  257.   #--------------------------------------------------------------------------
  258.   # ● ばらまきショット
  259.   #--------------------------------------------------------------------------
  260.   def machine_shot(way, speed, index, type = 1)
  261.     @cnt_shot -= 1
  262.     @cnt_shot = @cnt_shot_reset if @cnt_shot <= 0
  263.     if @cnt_shot >= 10 and @cnt_shot < 100
  264.       if @cnt_shot % 5 == 0
  265.         angle = rand(512) * (Math::PI / 4) / 512 + (Math::PI * 3 / 8)
  266.         nway_shot(way, 0.9 / way, angle, speed, false, index, type)
  267.       end
  268.     end
  269.   end
  270. end
复制代码
然后就只发我的脚本了...(@#%&*^#*@&%(!!...明明有脚本还要我发...那个SB说的!)
Scripts.rvdata (154.19 KB, 下载次数: 0)
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2025-7-25 12:14

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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