切換
舊版
前往
大廳
主題

【選單腳本】Scene_Menu 1.00 版

先行者 | 2012-07-10 18:44:21 | 巴幣 14 | 人氣 1037

○檢視:
#==============================================================================
#----------------------------------------------------------------------------
# ○  OSD - 腳本討論社
#     Originality RGSS Discuss
#     └http://guild.gamer.com.tw/guild.php?sn=4707
#----------------------------------------------------------------------------
#==============================================================================
#--------------------------------------------------------------------------
# ● 腳本名稱:Scene_Menu
#--------------------------------------------------------------------------
# ● 腳本效果:
#     套用成新的主選單畫面,
#     人物立繪顯示要以資料庫人物名稱為命名,
#     位置要在 Graphics\Pictures 之下。
#     人物圖示顯示要以資料庫人物行走圖名稱為命名,
#     位置要在 Graphics\Pictures 之下。
#--------------------------------------------------------------------------
# ● 腳本版本:1.00 版
#--------------------------------------------------------------------------
# ● 腳本更新區塊:
#     目前並無更新
#--------------------------------------------------------------------------
#==============================================================================
#----------------------------------------------------------------------------
# ○  OSD - 腳本討論社
#     Originality RGSS Discuss
#     └http://guild.gamer.com.tw/guild.php?sn=4707
#----------------------------------------------------------------------------
#==============================================================================
#==============================================================================
# ■ Game_Actor
#------------------------------------------------------------------------------
# 處理角色的類別。
# 使用在 Game_Actors ($game_actors)、Game_Party ($game_party) 類別的內部。
#==============================================================================

○使用方法:
※※※※※※※※※※※※※※※※※※※※
人物立繪
以資料庫人物名稱命名,
放置於 Graphics\Pictures 之下。
※※※※※※※※※※※※※※※※※※※※
人物小圖示
以資料庫人物行走圖名稱命名,
放置於 Graphics\Pictures 之下。
※※※※※※※※※※※※※※※※※※※※
○腳本檢視:

○腳本檢視:
#==============================================================================
#----------------------------------------------------------------------------
# ○  OSD - 腳本討論社
#     Originality RGSS Discuss
#     └http://guild.gamer.com.tw/guild.php?sn=4707
#----------------------------------------------------------------------------
#==============================================================================
#--------------------------------------------------------------------------
# ● 腳本名稱:Scene_Menu
#--------------------------------------------------------------------------
# ● 腳本效果:
#     套用成新的主選單畫面,
#     人物立繪顯示要以資料庫人物名稱為命名,
#     位置要在 Graphics\Pictures 之下。
#     人物圖示顯示要以資料庫人物行走圖名稱為命名,
#     位置要在 Graphics\Pictures 之下。
#--------------------------------------------------------------------------
# ● 腳本版本:1.00 版
#--------------------------------------------------------------------------
# ● 腳本更新區塊:
#     目前並無更新
#--------------------------------------------------------------------------
#==============================================================================
#----------------------------------------------------------------------------
# ○  OSD - 腳本討論社
#     Originality RGSS Discuss
#     └http://guild.gamer.com.tw/guild.php?sn=4707
#----------------------------------------------------------------------------
#==============================================================================
#==============================================================================
# ■ Game_Actor
#------------------------------------------------------------------------------
# 處理角色的類別。
# 使用在 Game_Actors ($game_actors)、Game_Party ($game_party) 類別的內部。
#==============================================================================

class Game_Actor < Game_Battler
  def now_exp
    return @exp - @exp_list[@level]
  end
  def next_exp
    return @exp_list[@level+1] > 0 ? @exp_list[@level+1] - @exp_list[@level] : 0
  end
end

#==============================================================================
# ■ Scene_Menu
#------------------------------------------------------------------------------
# 處理選單畫面的類別。
#==============================================================================

class Scene_Menu
  #--------------------------------------------------------------------------
  # ● 初始化目標
  #     menu_index : 命令游標的初期位置
  #--------------------------------------------------------------------------
  def initialize(menu_index = 0)
    @menu_index = menu_index
    # 獲取角色資料
    @actor = [$game_party.actors[0], $game_party.actors[1],
    $game_party.actors[2], $game_party.actors[3]]
    @direction = 0
    @actor_index = 0
    @command = false
  end
  #--------------------------------------------------------------------------
  # ● 主處理
  #--------------------------------------------------------------------------
  def main
    # 描繪背景
    @sprite = Spriteset_Map.new
    # 繪製背景
    @menu_back = RPG::Sprite.new
    @menu_back.bitmap = Bitmap.new(640, 480)
    (0...50).each {|i|
      @menu_back.bitmap.fill_rect(0, i, 640, 1, Color.new(0, 0, 0, 255 - i * 5))
      @menu_back.bitmap.fill_rect(0, 480 - i, 640, 1, Color.new(0, 0, 0, 255 - i * 5))
    }
    @menu_mask = RPG::Sprite.new
    @menu_mask.bitmap = Bitmap.new(640, 480)
    @menu_mask.bitmap.fill_rect(0, 0, 640, 480, Color.new(0, 0, 0, 160))
    @menu_mask.visible = false
    @menu_mask.z = 999
    # 描繪主選項
    @main_command = Sprite.new
    @main_command.bitmap = Bitmap.new(640, 480)
    @main_command.bitmap.font.size = 25
    @main_command.bitmap.font.bold = true
    @main_command.bitmap.draw_text(186, 0, 160, 74, "物品")
    @main_command.bitmap.draw_text(260, 0, 160, 74, "技能")
    @main_command.bitmap.draw_text(334, 0, 160, 74, "裝備")
    @main_command.bitmap.draw_text(408, 0, 160, 74, "狀態")
    @main_command.bitmap.draw_text(482, 0, 160, 74, "存檔")
    @main_command.bitmap.draw_text(556, 0, 160, 74, "結束")
    @main_command.opacity = 200
    @main_command.z = 100
    # 描繪主選項背景
    @main_command_back = Sprite.new
    @main_command_back.bitmap = Bitmap.new(640, 480)
    (0...16).each {|b|
      (0...500).each {|i|
        # 中間黑色底層
        @main_command_back.bitmap.fill_rect(640 - i * 2, b * 2 + 20, 2, 2, Color.new(0, 0, 0, 255 - i))
        # 上下白色邊框
        @main_command_back.bitmap.fill_rect(640 - i * 2, 18, 2, 2, Color.new(255, 255, 255, 255 - i))
        @main_command_back.bitmap.fill_rect(640 - i * 2, 52, 2, 2, Color.new(255, 255, 255, 255 - i))
      }
    }
    # 建立人物立繪
    @actor_graphic = RPG::Sprite.new
    # 建立人物資訊
    @actor_data = RPG::Sprite.new
    @actor_data.bitmap = Bitmap.new(640, 480)
    # 描繪角色資料
    actor_data_refresh
    # 描繪隊伍資料
    @party_data = RPG::Sprite.new
    @party_data.bitmap = Bitmap.new(640, 480)
    party_data_refresh
    
    # 描繪選項框
    @arrow = RPG::Sprite.new
    @arrow.bitmap = Bitmap.new(640, 480)
    @arrow.bitmap.font.size = 30
    (0...36).each {|i|
      @arrow.bitmap.draw_text(i, 0, 74, 74, "●")
    }
    @arrow.opacity = 150
    @arrow.x = @menu_index * 74 + 180#180
    @arrow.y = -1
    @arrow.z = 90
    
    # 描繪選擇人物資料
    @choose_actor_data = RPG::Sprite.new
    @choose_actor_data.bitmap = Bitmap.new(640, 480)
    @choose_actor_data.z = 1000
    # 執行過渡
    Graphics.transition
    # 主循環
    loop do
      # 更新遊戲畫面
      Graphics.update
      # 更新輸入訊息
      Input.update
      # 更新畫面
      update
      # 如果切換畫面就中斷循環
      if $scene != self
        break
      end
    end
    # 準備過渡
    Graphics.freeze
    @main_command.dispose
    @main_command_back.dispose
    @actor_graphic.dispose
    @actor_data.dispose
    @party_data.dispose
    @arrow.dispose
    @choose_actor_data.dispose
    @menu_mask.dispose
    @menu_back.dispose
  end
  #--------------------------------------------------------------------------
  # ● 更新畫面
  #--------------------------------------------------------------------------
  def update
    if !@command
      update_back
      update_input
      update_enter_input
      update_arrow
      update_actor_change
    else
      update_actor_choose
      update_actor_choose_enter
    end
  end
  #--------------------------------------------------------------------------
  # ● 返回地圖畫面
  #--------------------------------------------------------------------------
  def update_back
    # 按下 B 鍵的情況下
    if Input.trigger?(Input::B)
      # 演奏取消 SE
      $game_system.se_play($data_system.cancel_se)
      # 切換的地圖畫面
      $scene = Scene_Map.new
      return
    end
  end
  #--------------------------------------------------------------------------
  # ● 偵測按鍵
  #--------------------------------------------------------------------------
  def update_input
    # 按下 → 鍵的情況下
    if Input.trigger?(Input::RIGHT)
      # 播放游標移動音效
      $game_system.se_play($data_system.cursor_se)
      @menu_index += 1 if @menu_index < 6
      @menu_index = 0 if @menu_index > 5
      @direction = 1
      return
    end
    # 按下 ← 鍵的情況下
    if Input.trigger?(Input::LEFT)
      # 播放游標移動音效
      $game_system.se_play($data_system.cursor_se)
      @menu_index -= 1 if @menu_index > -1
      @menu_index = 5 if @menu_index < 0
      @direction = 2
      return
    end
  end
  #--------------------------------------------------------------------------
  # ● 更新選項滑動
  #--------------------------------------------------------------------------
  def update_arrow
    case @menu_index
    when 0
      if @direction == 2
        @arrow.x -= 10 if @arrow.x > 180
        @arrow.x = 180 if @arrow.x < 180
      elsif @direction == 1
        @arrow.x -= 30 if @arrow.x > 180
        @arrow.x = 180 if @arrow.x < 180
      end
    when 1
      if @direction == 2
        @arrow.x -= 10 if @arrow.x > 254
        @arrow.x = 254 if @arrow.x < 254
      elsif @direction == 1
        @arrow.x += 10 if @arrow.x < 254
        @arrow.x = 254 if @arrow.x > 254
      end
    when 2
      if @direction == 2
        @arrow.x -= 10 if @arrow.x > 328
        @arrow.x = 328 if @arrow.x < 328
      elsif @direction == 1
        @arrow.x += 10 if @arrow.x < 328
        @arrow.x = 328 if @arrow.x > 328
      end
    when 3
      if @direction == 2
        @arrow.x -= 10 if @arrow.x > 402
        @arrow.x = 402 if @arrow.x < 402
      elsif @direction == 1
        @arrow.x += 10 if @arrow.x < 402
        @arrow.x = 402 if @arrow.x > 402
      end
    when 4
      if @direction == 2
        @arrow.x -= 10 if @arrow.x > 476
        @arrow.x = 476 if @arrow.x < 476
      elsif @direction == 1
        @arrow.x += 10 if @arrow.x < 476
        @arrow.x = 476 if @arrow.x > 476
      end
    when 5
      if @direction == 2
        @arrow.x += 30 if @arrow.x < 550
        @arrow.x = 550 if @arrow.x > 550
      elsif @direction == 1
        @arrow.x += 10 if @arrow.x < 550
        @arrow.x = 550 if @arrow.x > 550
      end
    end
  end
  #--------------------------------------------------------------------------
  # ● 偵測按鍵
  #--------------------------------------------------------------------------
  def update_enter_input
    # 按下 C 鍵的情況下
    if Input.trigger?(Input::C)
      # 同伴人數為 0、存檔、遊戲結束以外的場合
      if $game_party.actors.size == 0 and @command_window.index < 4
        # 演奏凍結 SE
        $game_system.se_play($data_system.buzzer_se)
        return
      end
      # 獲取目前的位置
      case @menu_index
      when 0  # 物品
        # 演奏確定 SE
        $game_system.se_play($data_system.decision_se)
        # 切換到物品畫面
        $scene = Scene_Item.new
      when 1  # 特技
        # 演奏確定 SE
        $game_system.se_play($data_system.decision_se)
        # 啟動狀態視窗
        @command = true
        @menu_mask.visible = true
        actor_choose_refresh(actor = @actor[0])
      when 2  # 裝備
        # 演奏確定 SE
        $game_system.se_play($data_system.decision_se)
        # 啟動狀態視窗
        @command = true
        @menu_mask.visible = true
        actor_choose_refresh(actor = @actor[0])
      when 3  # 狀態
        # 演奏確定 SE
        $game_system.se_play($data_system.decision_se)
        # 啟動狀態視窗
        @command = true
        @menu_mask.visible = true
        actor_choose_refresh(actor = @actor[0])
      when 4  # 存檔
        # 禁止存檔的情況下
        if $game_system.save_disabled
          # 演奏凍結 SE
          $game_system.se_play($data_system.buzzer_se)
          return
        end
        # 演奏確定 SE
        $game_system.se_play($data_system.decision_se)
        # 切換到存檔畫面
        $scene = Scene_Save.new
      when 5  # 遊戲結束
        # 演奏確定 SE
        $game_system.se_play($data_system.decision_se)
        # 切換到遊戲結束畫面
        $scene = Scene_End.new
      end
      return
    end
  end
  #--------------------------------------------------------------------------
  # ● 選擇人物
  #--------------------------------------------------------------------------
  def update_actor_choose
    # 按下 B 鍵的情況下
    if Input.trigger?(Input::B)
      # 演奏取消 SE
      $game_system.se_play($data_system.cancel_se)
      # 切換到主選項
      @command = false
      @menu_mask.visible = false
      set_data
      @choose_actor_data.bitmap.clear
      return
    end
    # 按下 右 鍵的情況下
    if Input.trigger?(Input::RIGHT)
      # 播放游標移動音效
      $game_system.se_play($data_system.cursor_se)
      @actor_index += 1 if @actor_index < 4
      @actor_index = 0 if @actor_index > 3
      actor_choose_refresh(@actor[@actor_index])
      return
    end
    # 按下 左 鍵的情況下
    if Input.trigger?(Input::LEFT)
      # 播放游標移動音效
      $game_system.se_play($data_system.cursor_se)
      @actor_index -= 1 if @actor_index > -1
      @actor_index = 3 if @actor_index < 0
      actor_choose_refresh(@actor[@actor_index])
      return
    end
  end
  #--------------------------------------------------------------------------
  # ● 選擇人物
  #--------------------------------------------------------------------------
  def update_actor_choose_enter
    # 按下 C 鍵的情況下
    if Input.trigger?(Input::C)
      # 演奏確定 SE
      $game_system.se_play($data_system.decision_se)
      # 獲取目前選項
      case @menu_index
      when 1  # 特技
        # 本角色的行動限制在 2 以上的情況下
        if $game_party.actors[@actor_index].restriction >= 2
          # 演奏凍結 SE
          $game_system.se_play($data_system.buzzer_se)
          return
        end
        # 演奏確定 SE
        $game_system.se_play($data_system.decision_se)
        # 切換到特技畫面
        $scene = Scene_Skill.new(@actor_index)
      when 2  # 裝備
        # 演奏確定 SE
        $game_system.se_play($data_system.decision_se)
        # 切換的裝備畫面
        $scene = Scene_Equip.new(@actor_index)
      when 3  # 狀態
        # 演奏確定 SE
        $game_system.se_play($data_system.decision_se)
        # 切換到狀態畫面
        $scene = Scene_Status.new(@actor_index)
      end
      return
    end
  end
  #--------------------------------------------------------------------------
  # ● 偵測按鍵
  #--------------------------------------------------------------------------
  def update_actor_change
    # 按下 Ctrl 鍵的情況下
    if Input.trigger?(Input::CTRL)
      # 獲取以前的隊伍角色
      old_party = @actor
      # 移除所有角色
      $data_actors.each_index {|i|
        $game_party.remove_actor($data_actors[i+1].id)
      }
      # 讀取舊有的角色
      old_party.each_index {|a|
        # 如果倒數 1 人不存在
        if old_party[a-1].nil?
          # 推向下一個人加入角色
          $game_party.add_actor(old_party[a-2].id)
          # 如果倒數 2 人不存在
          if old_party[a-2].nil?
            # 推向下一個人加入角色
            $game_party.add_actor(old_party[a-3].id)
          end
        else
          # 直接加入角色
          $game_party.add_actor(old_party[a-1].id)
        end
      }
      # 重新獲取角色列表
      @actor = [$game_party.actors[0], $game_party.actors[1],
      $game_party.actors[2], $game_party.actors[3]]
      # 清除資料
      delete_data
      # 重新描繪資料
      actor_data_refresh(actor = @actor[0])
      party_data_refresh
      return
    end
  end
  #-------------------------------------------------------------------------
  # ● 清除畫面資料
  #--------------------------------------------------------------------------
  def delete_data
    @actor_data.bitmap.clear
    @party_data.bitmap.clear
  end
  #-------------------------------------------------------------------------
  # ● 清除畫面資料
  #--------------------------------------------------------------------------
  def set_data
    actor_data_refresh
    party_data_refresh
  end
  #--------------------------------------------------------------------------
  # ● 更新角色資料
  #--------------------------------------------------------------------------
  def actor_data_refresh(actor = @actor[0])
    # 描會角色立繪
    @actor_graphic.bitmap = RPG::Cache.picture(actor.name)
    @actor_graphic.ox = @actor_graphic.bitmap.width / 2
    @actor_graphic.oy = @actor_graphic.bitmap.height / 2
    @actor_graphic.x = 150
    @actor_graphic.y = 300
    @actor_graphic.z = 0
    @actor_data.bitmap.font.size = 30
    @actor_data.bitmap.font.bold = true
    # 描繪底框
    (0...135).each {|i|
      @actor_data.bitmap.fill_rect(i / 4 - 60, 320 + i, 250, 1, Color.new(0, 0, 0, 255 - i))
    }
    # 描繪名字
    @actor_data.bitmap.draw_text(20, 300, 192, 96, actor.name)
    (0...180).each {|i|
      @actor_data.bitmap.fill_rect(i, 370, 1, 1, Color.new(255, 255, 255, 255))
    }
    # 獲取角色目前 HP
    line_hp = actor.hp * 96 / actor.maxhp
    @actor_data.bitmap.font.size = 8
    # 描繪底框
    (0...96).each {|i|
      @actor_data.bitmap.font.color = Color.new(100, 0, 0)
      @actor_data.bitmap.draw_text(46 + i, 370, 32, 32, "●")
    }
    @actor_data.bitmap.font.size = 20
    # 描繪內槽
    (0...line_hp).each {|i|
      @actor_data.bitmap.font.color = Color.new(255 - i, 75 + i * 2, i * 1.5)
      @actor_data.bitmap.draw_text(40 + i, 370, 32, 32, "‧")
    }
    @actor_data.bitmap.font.color = Color.new(255, 255, 255)
    @actor_data.bitmap.font.size = 12
    # 描繪比值
    @actor_data.bitmap.draw_text(80, 380, 160, 32, actor.hp.to_s  + " / " + actor.maxhp.to_s)
    # 獲取角色目前 SP
    line_sp = actor.sp * 96 / actor.maxsp
    @actor_data.bitmap.font.size = 8
    # 描繪底框
    (0...96).each {|i|
      @actor_data.bitmap.font.color = Color.new(0, 0, 100)
      @actor_data.bitmap.draw_text(46 + i, 390, 32, 32, "●")
    }
    @actor_data.bitmap.font.size = 20
    # 描繪內槽
    (0...line_sp).each {|i|
      @actor_data.bitmap.font.color = Color.new(i * 1.5, 75 + i * 2, 255 - i)
      @actor_data.bitmap.draw_text(40 + i, 390, 32, 32, "‧")
    }
    @actor_data.bitmap.font.color = Color.new(255, 255, 255)
    @actor_data.bitmap.font.size = 12
    # 描繪比值
    @actor_data.bitmap.draw_text(80, 400, 160, 32, actor.sp.to_s  + " / " + actor.maxsp.to_s)
    # 獲取角色目前 EXP
    line_exp = actor.now_exp * 120 / actor.next_exp
    @actor_data.bitmap.font.size = 8
    # 描繪底框
    (0...120).each {|i|
      @actor_data.bitmap.font.color = Color.new(0, 100, 0)
      @actor_data.bitmap.draw_text(46 + i, 410, 32, 32, "●")
    }
    @actor_data.bitmap.font.size = 20
    # 描繪內槽
    (0...line_exp).each {|i|
      @actor_data.bitmap.font.color = Color.new(50 + i, 175 + i * 0.5, i)
      @actor_data.bitmap.draw_text(40 + i, 410, 32, 32, "‧")
    }
    @actor_data.bitmap.font.color = Color.new(255, 255, 255)
    @actor_data.bitmap.font.size = 12
    # 描繪比值
    @actor_data.bitmap.draw_text(80, 420, 160, 32, actor.exp_s  + " / " + actor.next_exp_s)
    @actor_data.bitmap.font.bold = false
  end
  #--------------------------------------------------------------------------
  # ● 更新角色資料
  #--------------------------------------------------------------------------
  def party_data_refresh
    (0...50).each {|i|
      @party_data.bitmap.fill_rect(260 + i / 4, 411 + i, 345, 1, Color.new(0, 0, 0, 255 - i * 2))
    }
    (1...4).each {|a|
      if !@actor[a].nil?
        bitmap = RPG::Cache.picture(@actor[a].character_name)
        rect = Rect.new(0, 0, 32, 32)
        @party_data.bitmap.blt(278 + (a - 1) * 105, 411, bitmap, rect)
        @party_data.bitmap.font.size = 12
        @party_data.bitmap.font.bold = true
        # 描繪名字
        @party_data.bitmap.draw_text(310 + (a - 1) * 105, 370, 192, 96, @actor[a].name)
        (0...60).each {|i|
          @party_data.bitmap.fill_rect(310 + (a - 1) * 105 + i, 428, 1, 1, Color.new(255, 255, 255, 255))
        }
        # 獲取角色目前 HP
        line_hp = @actor[a].hp * 60 / @actor[a].maxhp
        @party_data.bitmap.font.size = 20
        # 描繪底框
        (0..60).each {|i|
          @party_data.bitmap.font.color = Color.new(100, 0, 0)
          @party_data.bitmap.draw_text(304 + (a - 1) * 105 + i, 420, 32, 32, "‧")
        }
        @party_data.bitmap.font.size = 10
        # 描繪內槽
        (0...line_hp).each {|i|
          @party_data.bitmap.font.color = Color.new(255 - i, 75 + i * 2, i * 1.5)
          @party_data.bitmap.draw_text(309 + (a - 1) * 105 + i, 420, 32, 32, "‧")
        }
        # 獲取角色目前 SP
        line_sp = @actor[a].sp * 60 / @actor[a].maxsp
        @party_data.bitmap.font.size = 20
        # 描繪底框
        (0...60).each {|i|
          @party_data.bitmap.font.color = Color.new(0, 0, 100)
          @party_data.bitmap.draw_text(309 + (a - 1) * 105 + i, 430, 32, 32, "‧")
        }
        @party_data.bitmap.font.size = 10
        # 描繪內槽
        (0...line_sp).each {|i|
          @party_data.bitmap.font.color = Color.new(i * 1.5, 75 + i * 2, 255 - i)
          @party_data.bitmap.draw_text(314 + (a - 1) * 105 + i, 430, 32, 32, "‧")
        }
        @party_data.bitmap.font.color = Color.new(255, 255, 255)
        @party_data.bitmap.font.bold = false
      else
        bitmap = RPG::Cache.picture("nobody")
        rect = Rect.new(0, 0, 32, 32)
        @party_data.bitmap.blt(278 + (a - 1) * 105, 411, bitmap, rect)
        # 描繪名稱線條
        (0...60).each {|i|
          @party_data.bitmap.fill_rect(310 + (a - 1) * 105 + i, 428, 1, 1, Color.new(255, 255, 255, 255))
        }
        # 描繪 HP 底框
        (0..60).each {|i|
          @party_data.bitmap.font.color = Color.new(100, 0, 0)
          @party_data.bitmap.draw_text(304 + (a - 1) * 105 + i, 420, 32, 32, "‧")
        }
        # 描繪 SP 底框
        (0...60).each {|i|
          @party_data.bitmap.font.color = Color.new(0, 0, 100)
          @party_data.bitmap.draw_text(309 + (a - 1) * 105 + i, 430, 32, 32, "‧")
        }
      end
    }
    @party_data.bitmap.font.color = Color.new(255, 255, 255)
    @party_data.bitmap.font.bold = false
  end
  #--------------------------------------------------------------------------
  # ● 更新角色資料
  #--------------------------------------------------------------------------
  def actor_choose_refresh(actor = @actor[0])
    delete_data
    # 更改圖像位置
    @actor_graphic.bitmap = RPG::Cache.picture(actor.name)
    @actor_graphic.x = 320
    @actor_graphic.y = 300
    @actor_graphic.ox = @actor_graphic.bitmap.width / 2
    @actor_graphic.oy = @actor_graphic.bitmap.height / 2
    @actor_graphic.z = 1000
    # 描繪名字底框
    (0...101).each {|i|
      @choose_actor_data.bitmap.fill_rect(220 + i, 320, 1, 32, Color.new(255, 255, 255, i  * 5))
      @choose_actor_data.bitmap.fill_rect(420 - i, 320, 1, 32, Color.new(255, 255, 255, i  * 5))
    }
    @choose_actor_data.bitmap.font.size = 22
    @choose_actor_data.bitmap.font.bold = true
    @choose_actor_data.bitmap.font.color = Color.new(0, 0, 0)
    size = @choose_actor_data.bitmap.text_size(actor.name).width
    # 描繪名字
    @choose_actor_data.bitmap.draw_text(320 - size / 2, 320, 240, 32, actor.name)
  end
end

○畫面:


○範例下載:
下載點 1
下載點 2
送禮物贊助創作者 !
0
留言

創作回應

月見斐夜
WWWWWWWWW
你那個好用啊,這樣我可以一次一覽字體在遊戲中會不會變形怎樣的,不用再看一次改一次,多好啊XDD[e12]
不過能不能顯示符號的問題,這要牽扯到字碼了…的確,一般人不太會用一些特別自體,不過像我這種很愛亂用(尤其是很喜歡用簡繁共用字體的),這個問題就華華麗麗的出現了......[e20]
不過很少人像我這麼無聊你大可放心XDD
2012-07-10 21:44:06
月見斐夜
又發現了個bug,雖然不會造成運行上的問題,可是會破壞觀感...
就是......當你有用列車移動這種腳本時,隊友會被鬼隱[e28]
我之前寫商店腳本時也發生過這種事…我是用畫面截圖解決的
也就是把當前畫面截下來,然後用圖片替代掉Spriteset_Map.new...
這個做法我是從VX的內建腳本學來的,VX內建就有截圖功能,VX在切換到選單時,背景後方會顯示黯淡的地圖場景,其實他不是加地圖層,而是把當時畫面截下,再dispose掉
2012-07-10 21:51:39
先行者
我在想它是不是判定只有在進入地圖時才會顯示隊友,我記得我好像有修正過,但刪了[e27]不過您的方法效率會比較好
2012-07-10 21:57:41
先行者
因為 Spriteset_Map 裡面是一堆 Sprite 組成,比起一個 Sprite 組成的效率快多了[e24]
2012-07-10 21:58:25
先行者
阿!!也許下次可以寫個像空軌那樣的隊友跟隨,然後隊友碰上怪物也會戰鬥的那種[e12]
2012-07-10 21:59:33
純粋な脂肪の猫
來去採用囉XDDD
2012-07-11 00:03:59
先行者
只不過效能有些差,使用時請自重[e27]
2012-07-11 18:00:21
狂狂
我比較有疑慮 這樣切換角色 不會造成事件執行上怪異嗎?
譬如某些事件是A角色 進行 但切切換到B 不就很奇怪= =
2012-07-11 18:37:50
先行者
那使用者在使用時就要自己在切換。不然其實我也可以把這功能換掉[e24]
2012-07-11 18:46:21
先行者
不過應該還好吧,一般使用者對話時會用別的腳本來顯示臉圖,只是隊首不一樣
2012-07-11 18:48:16
白羽優莉奈
在我3年前構想的選單又這種的,不過那時根本...
2013-08-11 01:55:00
先行者
耶耶?三年前構想是這種的阿[e29]
不過這被我坑掉了,原本想寫全套但根本沒時間[e21]
因為裡面完全是用 bitmap 描繪,使用者完全只要準備立繪和右下角的小人物
2013-08-11 11:21:26

更多創作