Project1

标题: 可以实现这样的战斗菜单吗? [打印本页]

作者: 倚天    时间: 2008-8-14 17:45
提示: 作者被禁止或删除 内容自动屏蔽
作者: 雪流星    时间: 2008-8-14 17:49
可以实现
不过...楼主未免也太伸手了...{/gg}
作者: bsx1990    时间: 2008-8-14 17:58
图标式菜单如下,LZ自己做几个图片就可以了

  1. #==========================================================================
  2. # 本脚本来自www.66RPG.com,使用和转载请保留此信息
  3. #==========================================================================

  4. module Momo_IconCommand
  5.   # 图标名称设定
  6.   ATTACK_ICON_NAME = "atk" # 攻撃
  7.   SKILL_ICON_NAME = "mag"   # 特技
  8.   GUARD_ICON_NAME = "def"  # 防御
  9.   ITEM_ICON_NAME = "itm"     # 物品
  10.   ESCAPE_ICON_NAME = "esc"   # 逃跑
  11.   BEIJING_ICON_NAME = "big"   # 逃跑
  12.   # X坐标修正
  13.   X_PLUS = -40
  14.   # Y坐标修正
  15.   Y_PLUS = -80
  16.   # 选择时图标的动作
  17.   # 0:静止 1:放大
  18.   SELECT_TYPE = 0
  19.   # 闪烁时光芒的颜色
  20.   FLASH_COLOR = Color.new(255, 255, 255, 128)
  21.   # 闪烁时间
  22.   FLASH_DURATION = 10
  23.   # 闪烁间隔
  24.   FLASH_INTERVAL = 20
  25.   # 是否写出文字的名称
  26.   COM_NAME_DROW = false
  27.   # 文字名称是否移动
  28.   COM_NAME_MOVE = false
  29.   # 文字内容
  30.   ATTACK_NAME = "攻击"    # 攻击
  31.   SKILL_NAME = "仙术"   # 特技
  32.   GUARD_NAME = "防御"     # 防御
  33.   ITEM_NAME = "物品"  # 物品
  34.   ESCAPE_NAME = "逃跑"  #逃跑
  35.   # 文字颜色
  36.   COM_NAME_COLOR = Color.new(255, 255, 255, 255)
  37.   # 文字坐标修正
  38.   COM_NAME_X_PLUS = 0
  39.   COM_NAME_Y_PLUS = 0
  40. end

  41. class Window_CommandIcon < Window_Selectable
  42.   attr_accessor :last_index
  43.   #------------------------------------------------------------------------
  44.   # ● オブジェクト初期化
  45.   #------------------------------------------------------------------------
  46.   def initialize(x, y, commands)
  47.     super(x, y, 32, 32)
  48.     # ウィンドウスキンに空文字列を指定してウィンドウを描画しないようにする
  49.     self.windowskin = RPG::Cache.windowskin("")
  50.     @item_max = commands.size
  51.     @commands = commands
  52.     @column_max = commands.size
  53.     @index = 0
  54.     #@column_max = 1
  55.     #@index_max = 0
  56.     @last_index = nil
  57.     @name_sprite = nil
  58.     @sprite = []
  59.     refresh
  60.   end
  61.   def dispose
  62.     super
  63.     for sprite in @sprite
  64.       sprite.dispose unless sprite.nil?
  65.     end
  66.     @name_sprite.dispose unless @name_sprite.nil?
  67.   end
  68.   #------------------------------------------------------------------------
  69.   # ● リフレッシュ
  70.   #------------------------------------------------------------------------
  71.   def refresh
  72.     @name_sprite.dispose unless @name_sprite.nil?
  73.     for sprite in @sprite
  74.       sprite.dispose unless sprite.nil?
  75.     end
  76.     @name_sprite = nil
  77.     draw_com_name if Momo_IconCommand::COM_NAME_DROW
  78.     @sprite = []
  79.     for i in 0...@item_max
  80.       draw_item(i)
  81.     end
  82.   end
  83.   #------------------------------------------------------------------------
  84.   # ● 項目の描画
  85.   #------------------------------------------------------------------------
  86.   def draw_item(index)
  87.     @sprite[index] = Sprite_Icon.new(nil, @commands[index])
  88.     @sprite[index].z = self.z + 1
  89.   end
  90.   def draw_com_name
  91.     @name_sprite = Sprite_Comm_Name.new(nil, get_com_name)
  92.   end
  93.   
  94.   # 更新
  95.   def update
  96.     super
  97.     icon_update
  98.     com_name_update if Momo_IconCommand::COM_NAME_DROW
  99. #    if move_index?
  100.     # 判断当前光标位置
  101.     case @last_index
  102.      when 0 # 攻击
  103.       # 方向键下被按下的情况下
  104.       if Input.repeat?(Input::DOWN)
  105.           # 光标指向物品
  106.           $game_system.se_play($data_system.cursor_se)
  107.           @index = 1      
  108.       end
  109.        #方向键上被按下的情况下
  110.       if Input.repeat?(Input::UP)
  111.         # 光标指向逃跑
  112.           $game_system.se_play($data_system.cursor_se)
  113.           @index = 0      
  114.       end
  115.       # 方向键右被按下的情况下
  116.       if Input.repeat?(Input::RIGHT)
  117.           # 光标指向防御
  118.           $game_system.se_play($data_system.cursor_se)
  119.           @index = 1      
  120.       end
  121.       # 方向键左被按下的情况下
  122.       if Input.repeat?(Input::LEFT)
  123.         # 光标指向法术
  124.           $game_system.se_play($data_system.cursor_se)
  125.           @index = 2
  126.       end
  127.      when 1 # 法术
  128.       # 方向键下被按下的情况下
  129.       if Input.repeat?(Input::DOWN)
  130.           # 光标指向物品
  131.           $game_system.se_play($data_system.cursor_se)
  132.           @index = 3      
  133.       end
  134.       # 方向键上被按下的情况下
  135.       if Input.repeat?(Input::UP)
  136.         # 光标指向逃跑
  137.           $game_system.se_play($data_system.cursor_se)
  138.           @index = 0      
  139.       end
  140.       # 方向键右被按下的情况下
  141.       if Input.repeat?(Input::RIGHT)
  142.           # 光标指向攻击
  143.           $game_system.se_play($data_system.cursor_se)
  144.           @index = 1      
  145.       end
  146.       # 方向键左被按下的情况下
  147.       if Input.repeat?(Input::LEFT)
  148.         # 光标指向法术
  149.           $game_system.se_play($data_system.cursor_se)
  150.           @index = 2
  151.       end
  152.      when 2 # 防御
  153.       # 方向键下被按下的情况下
  154.       if Input.repeat?(Input::DOWN)
  155.           # 光标指向物品
  156.           $game_system.se_play($data_system.cursor_se)
  157.           @index = 4      
  158.       end
  159.       # 方向键上被按下的情况下
  160.       if Input.repeat?(Input::UP)
  161.         # 光标指向逃跑
  162.           $game_system.se_play($data_system.cursor_se)
  163.           @index = 0      
  164.       end
  165.       # 方向键右被按下的情况下
  166.       if Input.repeat?(Input::RIGHT)
  167.           # 光标指向防御
  168.           $game_system.se_play($data_system.cursor_se)
  169.           @index = 1      
  170.       end
  171.       # 方向键左被按下的情况下
  172.       if Input.repeat?(Input::LEFT)
  173.         # 光标指向攻击
  174.           $game_system.se_play($data_system.cursor_se)
  175.           @index = 2
  176.       end
  177.      when 3 # 物品
  178.       # 方向键下被按下的情况下
  179.       if Input.repeat?(Input::DOWN)
  180.           # 光标指向物品
  181.           $game_system.se_play($data_system.cursor_se)
  182.           @index = 3      
  183.       end
  184.       # 方向键上被按下的情况下
  185.       if Input.repeat?(Input::UP)
  186.         # 光标指向攻击
  187.           $game_system.se_play($data_system.cursor_se)
  188.           @index = 1      
  189.       end
  190.       # 方向键右被按下的情况下
  191.       if Input.repeat?(Input::RIGHT)
  192.           # 光标指向防御
  193.           $game_system.se_play($data_system.cursor_se)
  194.           @index = 3      
  195.       end
  196.       # 方向键左被按下的情况下
  197.       if Input.repeat?(Input::LEFT)
  198.         # 光标指向法术
  199.           $game_system.se_play($data_system.cursor_se)
  200.           @index = 4
  201.       end
  202.      when 4 # 逃跑
  203.       # 方向键下被按下的情况下
  204.       if Input.repeat?(Input::DOWN)
  205.           # 光标指向攻击
  206.           $game_system.se_play($data_system.cursor_se)
  207.           @index = 4      
  208.       end
  209.       # 方向键上被按下的情况下
  210.       if Input.repeat?(Input::UP)
  211.         # 光标指向逃跑
  212.           $game_system.se_play($data_system.cursor_se)
  213.           @index = 2      
  214.       end
  215.       # 方向键右被按下的情况下
  216.       if Input.repeat?(Input::RIGHT)
  217.           # 光标指向防御
  218.           $game_system.se_play($data_system.cursor_se)
  219.           @index = 3      
  220.       end
  221.       # 方向键左被按下的情况下
  222.       if Input.repeat?(Input::LEFT)
  223.         # 光标指向法术
  224.           $game_system.se_play($data_system.cursor_se)
  225.           @index = 4
  226.       end
  227.     end      
  228.       @last_index = self.index
  229. #    end
  230.   end

  231.   # アイコンの更新
  232.   def icon_update
  233.     for i in [email protected]
  234.       @sprite[i].active = (self.index == i)
  235.       @sprite[0].x = 68 #self.x + i * 24
  236.       @sprite[0].y = 345         #self.y + 0
  237.       @sprite[0].z = 9999
  238.       @sprite[1].x = 121
  239.       @sprite[1].y = 385
  240.       @sprite[1].z = 9999
  241.       @sprite[2].x = 13
  242.       @sprite[2].y = 385
  243.       @sprite[2].z = 9999      
  244.       @sprite[3].x = 101
  245.       @sprite[3].y = 445
  246.       @sprite[3].z = 9999      
  247.       @sprite[4].x = 34
  248.       @sprite[4].y = 445
  249.       @sprite[4].z = 9999     
  250.       @sprite[5].x = 68
  251.       @sprite[5].y = 400
  252.       @sprite[5].z = 9998
  253.       #      @sprite[i].z = (self.index == i) ? self.z + 2 : self.z + 1
  254.       @sprite[i].visible = self.visible
  255.       @sprite[i].update
  256.     end
  257.   end
  258.   # コマンドネームの更新
  259.   def com_name_update
  260. #    if move_index?
  261.       @name_sprite.name = get_com_name
  262. #    end
  263.     @name_sprite.x = 80 #self.x - 12 + Momo_IconCommand::COM_NAME_X_PLUS
  264.     @name_sprite.y = 350 #self.y - 40 + Momo_IconCommand::COM_NAME_Y_PLUS
  265.     @name_sprite.z = 9998 #self.z + 1
  266.     @name_sprite.active = self.active
  267.     @name_sprite.visible = self.visible
  268.     @name_sprite.update
  269.   end
  270.   def get_com_name
  271.     make_name_set if @name_set.nil?
  272.     name = @name_set[self.index]   
  273.     name = "" if name.nil?
  274.     return name
  275.   end
  276.   def make_name_set
  277.     @name_set = []
  278.     @name_set[0] = Momo_IconCommand::ATTACK_NAME
  279.     @name_set[1] = Momo_IconCommand::SKILL_NAME
  280.     @name_set[2] = Momo_IconCommand::GUARD_NAME
  281.     @name_set[3] = Momo_IconCommand::ITEM_NAME
  282.     @name_set[4] = Momo_IconCommand::ESCAPE_NAM
  283.     @name_set[5] = Momo_IconCommand::EBEIJING_NAM
  284.   end
  285.   def move_index?
  286.     return self.index != @last_index
  287.   end
  288.   def need_reset
  289.     @name_sprite.need_reset = true if Momo_IconCommand::COM_NAME_DROW
  290.   end
  291. end

  292. # アイコン用スプライト
  293. class Sprite_Icon < Sprite
  294.   attr_accessor :active
  295.   attr_accessor :icon_name
  296.   #------------------------------------------------------------------------
  297.   # ● オブジェクト初期化
  298.   #------------------------------------------------------------------------
  299.   def initialize(viewport, icon_name)
  300.     super(viewport)
  301.     @icon_name = icon_name
  302.     @last_icon = @icon_name
  303.     @count = 0
  304.     self.bitmap = RPG::Cache.icon(@icon_name)
  305.     self.ox = self.bitmap.width / 2
  306.     self.oy = self.bitmap.height / 2
  307.     @active = false
  308.   end
  309.   #------------------------------------------------------------------------
  310.   # ● 解放
  311.   #------------------------------------------------------------------------
  312.   def dispose
  313.     if self.bitmap != nil
  314.       self.bitmap.dispose
  315.     end
  316.     super
  317.   end
  318.   #------------------------------------------------------------------------
  319.   # ● フレーム更新
  320.   #------------------------------------------------------------------------
  321.   def update
  322.     super
  323.     if @icon_name != @last_icon
  324.       @last_icon = @icon_name
  325.       self.bitmap = RPG::Cache.icon(@icon_name)
  326.     end
  327.     if @active
  328.       @count += 1
  329.       case Momo_IconCommand::SELECT_TYPE
  330.       when 0
  331.         icon_flash
  332.       when 1
  333.         icon_zoom
  334.       end
  335.       @count = 0 if @count == 20
  336.     else
  337.       icon_reset
  338.     end
  339.   end
  340.   def icon_flash
  341.     if @count % Momo_IconCommand::FLASH_INTERVAL == 0 or @count == 2
  342.       self.flash(Momo_IconCommand::FLASH_COLOR, Momo_IconCommand::FLASH_DURATION)
  343.     end
  344.   end
  345.   def icon_zoom
  346.     case @count
  347.     when 1..10
  348.       zoom = 1.0 + @count / 10.0
  349.     when 11..20
  350.       zoom = 2.0 - (@count - 10) / 10.0
  351.     end
  352.     self.zoom_x = zoom
  353.     self.zoom_y = zoom
  354.   end
  355.   def icon_reset
  356.     @count = 0
  357.     self.zoom_x = 1.0
  358.     self.zoom_y = 1.0
  359.   end
  360. end

  361. # コマンドネーム用スプライト
  362. class Sprite_Comm_Name < Sprite
  363.   attr_accessor :active
  364.   attr_accessor :name
  365.   attr_accessor :need_reset
  366.   #------------------------------------------------------------------------
  367.   # ● オブジェクト初期化
  368.   #------------------------------------------------------------------------
  369.   def initialize(viewport, name)
  370.     super(viewport)
  371.     @name = name
  372.     @last_name = nil
  373.     @count = 0
  374.     @x_plus = 0
  375.     @opa_plus = 0
  376.     @need_reset = false
  377.     @active = false
  378.     self.bitmap = Bitmap.new(160, 32)
  379.   end
  380.   #------------------------------------------------------------------------
  381.   # ● 解放
  382.   #------------------------------------------------------------------------
  383.   def dispose
  384.     if self.bitmap != nil
  385.       self.bitmap.dispose
  386.     end
  387.     super
  388.   end

  389.   #------------------------------------------------------------------------
  390.   # ● フレーム更新
  391.   #------------------------------------------------------------------------
  392.   def update
  393.     super
  394.     if @active
  395.       if need_reset?
  396.         @need_reset = false
  397.         @last_name = @name
  398.         text_reset
  399.       end
  400.       move_text if Momo_IconCommand::COM_NAME_MOVE
  401.     end
  402.   end
  403.   def move_text
  404.     @count += 1
  405.     @x_plus = [@count * 8, 80].min
  406.     self.x = self.x - 80 + @x_plus
  407.     self.opacity = @count * 25
  408.   end
  409.   def text_reset
  410.     @count = 0
  411.     @x_plus = 0
  412.     self.bitmap.clear
  413.     self.bitmap.font.color = Momo_IconCommand::COM_NAME_COLOR
  414.     self.bitmap.draw_text(0, 0, 160, 32, @name)
  415.   end
  416.   def need_reset?
  417.     return (@name != @last_name or @need_reset)
  418.   end
  419. end

  420. class Scene_Battle
  421.   #------------------------------------------------------------------------
  422.   # ● プレバトルフェーズ開始
  423.   #------------------------------------------------------------------------
  424.   alias scene_battle_icon_command_start_phase1 start_phase1
  425.   def start_phase1
  426.     com1 = Momo_IconCommand::ATTACK_ICON_NAME
  427.     com2 = Momo_IconCommand::SKILL_ICON_NAME
  428.     com3 = Momo_IconCommand::GUARD_ICON_NAME
  429.     com4 = Momo_IconCommand::ITEM_ICON_NAME
  430.     com5 = Momo_IconCommand::ESCAPE_ICON_NAME
  431.     com6 = Momo_IconCommand::BEIJING_ICON_NAME
  432.     @actor_command_window = Window_CommandIcon.new(0, 0, [com1, com2, com3, com4, com5,com6])
  433.     @actor_command_window.y = 128
  434.     @actor_command_window.back_opacity = 160
  435.     @actor_command_window.active = false
  436.     @actor_command_window.visible = false
  437.     @actor_command_window.update
  438.     scene_battle_icon_command_start_phase1
  439.   end
  440.   #------------------------------------------------------------------------
  441.   # ● アクターコマンドウィンドウのセットアップ
  442.   #------------------------------------------------------------------------
  443.   alias scene_battle_icon_command_phase3_setup_command_window phase3_setup_command_window
  444.   def phase3_setup_command_window
  445.     scene_battle_icon_command_phase3_setup_command_window
  446.     # アクターコマンドウィンドウの位置を設定
  447.     @actor_command_window.x = command_window_actor_x(@actor_index)
  448.     @actor_command_window.y = command_window_actor_y(@actor_index)
  449.     @actor_command_window.need_reset
  450.   end
  451.   def command_window_actor_x(index)
  452.     $game_party.actors[index].screen_x + Momo_IconCommand::X_PLUS
  453.   end
  454.   def command_window_actor_y(index)
  455.     $game_party.actors[index].screen_y + Momo_IconCommand::Y_PLUS
  456.   end
  457. end
  458. #==========================================================================
  459. # 本脚本来自www.66RPG.com,使用和转载请保留此信息
  460. #==========================================================================
复制代码

作者: 倚天    时间: 2008-8-14 18:03
提示: 作者被禁止或删除 内容自动屏蔽
作者: 倚天    时间: 2008-8-14 18:05
提示: 作者被禁止或删除 内容自动屏蔽
作者: 亮F    时间: 2008-8-14 19:27
以下引用倚天于2008-8-14 10:05:49的发言:

你的脚本是上下左右的,我不要这个,我要的是上下,不要左右的,谢谢.
以下引用bsx1990于2008-8-14 9:58:27的发言:

图标式菜单如下,LZ自己做几个图片就可以了

#==========================================================================
# 本脚本来自www.66RPG.com,使用和转载请保留此信息
#==========================================================================

module Momo_IconCommand
# 图标名称设定
ATTACK_ICON_NAME = "atk" # 攻撃
SKILL_ICON_NAME = "mag"   # 特技
GUARD_ICON_NAME = "def"  # 防御
ITEM_ICON_NAME = "itm"     # 物品
ESCAPE_ICON_NAME = "esc"   # 逃跑
BEIJING_ICON_NAME = "big"   # 逃跑
# X坐标修正
X_PLUS = -40
# Y坐标修正
Y_PLUS = -80
# 选择时图标的动作
# 0:静止 1:放大
SELECT_TYPE = 0
# 闪烁时光芒的颜色
FLASH_COLOR = Color.new(255, 255, 255, 128)
# 闪烁时间
FLASH_DURATION = 10
# 闪烁间隔
FLASH_INTERVAL = 20
# 是否写出文字的名称
COM_NAME_DROW = false
# 文字名称是否移动
COM_NAME_MOVE = false
# 文字内容
ATTACK_NAME = "攻击"    # 攻击
SKILL_NAME = "仙术"   # 特技
GUARD_NAME = "防御"     # 防御
ITEM_NAME = "物品"  # 物品
ESCAPE_NAME = "逃跑"  #逃跑
# 文字颜色
COM_NAME_COLOR = Color.new(255, 255, 255, 255)
# 文字坐标修正
COM_NAME_X_PLUS = 0
COM_NAME_Y_PLUS = 0
end

class Window_CommandIcon < Window_Selectable
attr_accessor :last_index
#------------------------------------------------------------------------
# ● オブジェクト初期化
#------------------------------------------------------------------------
def initialize(x, y, commands)
   super(x, y, 32, 32)
   # ウィンドウスキンに空文字列を指定してウィンドウを描画しないようにする
   self.windowskin = RPG::Cache.windowskin("")
   @item_max = commands.size
   @commands = commands
   @column_max = commands.size
   @index = 0
   #@column_max = 1
   #@index_max = 0
   @last_index = nil
   @name_sprite = nil
   @sprite = []
   refresh
end
def dispose
   super
   for sprite in @sprite
     sprite.dispose unless sprite.nil?
   end
   @name_sprite.dispose unless @name_sprite.nil?
end
#------------------------------------------------------------------------
# ● リフレッシュ
#------------------------------------------------------------------------
def refresh
   @name_sprite.dispose unless @name_sprite.nil?
   for sprite in @sprite
     sprite.dispose unless sprite.nil?
   end
   @name_sprite = nil
   draw_com_name if Momo_IconCommand::COM_NAME_DROW
   @sprite = []
   for i in 0...@item_max
     draw_item(i)
   end
end
#------------------------------------------------------------------------
# ● 項目の描画
#------------------------------------------------------------------------
def draw_item(index)
   @sprite[index] = Sprite_Icon.new(nil, @commands[index])
   @sprite[index].z = self.z + 1
end
def draw_com_name
   @name_sprite = Sprite_Comm_Name.new(nil, get_com_name)
end

# 更新
def update
   super
   icon_update
   com_name_update if Momo_IconCommand::COM_NAME_DROW
#    if move_index?
   # 判断当前光标位置
   case @last_index
    when 0 # 攻击
     # 方向键下被按下的情况下
     if Input.repeat?(Input::DOWN)
         # 光标指向物品
         $game_system.se_play($data_system.cursor_se)
         @index = 1      
     end
      #方向键上被按下的情况下
     if Input.repeat?(Input::UP)
       # 光标指向逃跑
         $game_system.se_play($data_system.cursor_se)
         @index = 0      
     end
     # 方向键右被按下的情况下
     if Input.repeat?(Input::RIGHT)
         # 光标指向防御
         $game_system.se_play($data_system.cursor_se)
         @index = 1      
     end
     # 方向键左被按下的情况下
     if Input.repeat?(Input::LEFT)
       # 光标指向法术
         $game_system.se_play($data_system.cursor_se)
         @index = 2
     end
    when 1 # 法术
     # 方向键下被按下的情况下
     if Input.repeat?(Input::DOWN)
         # 光标指向物品
         $game_system.se_play($data_system.cursor_se)
         @index = 3      
     end
     # 方向键上被按下的情况下
     if Input.repeat?(Input::UP)
       # 光标指向逃跑
         $game_system.se_play($data_system.cursor_se)
         @index = 0      
     end
     # 方向键右被按下的情况下
     if Input.repeat?(Input::RIGHT)
         # 光标指向攻击
         $game_system.se_play($data_system.cursor_se)
         @index = 1      
     end
     # 方向键左被按下的情况下
     if Input.repeat?(Input::LEFT)
       # 光标指向法术
         $game_system.se_play($data_system.cursor_se)
         @index = 2
     end
    when 2 # 防御
     # 方向键下被按下的情况下
     if Input.repeat?(Input::DOWN)
         # 光标指向物品
         $game_system.se_play($data_system.cursor_se)
         @index = 4      
     end
     # 方向键上被按下的情况下
     if Input.repeat?(Input::UP)
       # 光标指向逃跑
         $game_system.se_play($data_system.cursor_se)
         @index = 0      
     end
     # 方向键右被按下的情况下
     if Input.repeat?(Input::RIGHT)
         # 光标指向防御
         $game_system.se_play($data_system.cursor_se)
         @index = 1      
     end
     # 方向键左被按下的情况下
     if Input.repeat?(Input::LEFT)
       # 光标指向攻击
         $game_system.se_play($data_system.cursor_se)
         @index = 2
     end
    when 3 # 物品
     # 方向键下被按下的情况下
     if Input.repeat?(Input::DOWN)
         # 光标指向物品
         $game_system.se_play($data_system.cursor_se)
         @index = 3      
     end
     # 方向键上被按下的情况下
     if Input.repeat?(Input::UP)
       # 光标指向攻击
         $game_system.se_play($data_system.cursor_se)
         @index = 1      
     end
     # 方向键右被按下的情况下
     if Input.repeat?(Input::RIGHT)
         # 光标指向防御
         $game_system.se_play($data_system.cursor_se)
         @index = 3      
     end
     # 方向键左被按下的情况下
     if Input.repeat?(Input::LEFT)
       # 光标指向法术
         $game_system.se_play($data_system.cursor_se)
         @index = 4
     end
    when 4 # 逃跑
     # 方向键下被按下的情况下
     if Input.repeat?(Input::DOWN)
         # 光标指向攻击
         $game_system.se_play($data_system.cursor_se)
         @index = 4      
     end
     # 方向键上被按下的情况下
     if Input.repeat?(Input::UP)
       # 光标指向逃跑
         $game_system.se_play($data_system.cursor_se)
         @index = 2      
     end
     # 方向键右被按下的情况下
     if Input.repeat?(Input::RIGHT)
         # 光标指向防御
         $game_system.se_play($data_system.cursor_se)
         @index = 3      
     end
     # 方向键左被按下的情况下
     if Input.repeat?(Input::LEFT)
       # 光标指向法术
         $game_system.se_play($data_system.cursor_se)
         @index = 4
     end
   end      
     @last_index = self.index
#    end
end

# アイコンの更新
def icon_update
   for i in [email protected]
     @sprite.active = (self.index == i)
     @sprite[0].x = 68 #self.x + i * 24
     @sprite[0].y = 345         #self.y + 0
     @sprite[0].z = 9999
     @sprite[1].x = 121
     @sprite[1].y = 385
     @sprite[1].z = 9999
     @sprite[2].x = 13
     @sprite[2].y = 385
     @sprite[2].z = 9999      
     @sprite[3].x = 101
     @sprite[3].y = 445
     @sprite[3].z = 9999      
     @sprite[4].x = 34
     @sprite[4].y = 445
     @sprite[4].z = 9999     
     @sprite[5].x = 68
     @sprite[5].y = 400
     @sprite[5].z = 9998
     #      @sprite.z = (self.index == i) ? self.z + 2 : self.z + 1
     @sprite.visible = self.visible
     @sprite.update
   end
end
# コマンドネームの更新
def com_name_update
#    if move_index?
     @name_sprite.name = get_com_name
#    end
   @name_sprite.x = 80 #self.x - 12 + Momo_IconCommand::COM_NAME_X_PLUS
   @name_sprite.y = 350 #self.y - 40 + Momo_IconCommand::COM_NAME_Y_PLUS
   @name_sprite.z = 9998 #self.z + 1
   @name_sprite.active = self.active
   @name_sprite.visible = self.visible
   @name_sprite.update
end
def get_com_name
   make_name_set if @name_set.nil?
   name = @name_set[self.index]   
   name = "" if name.nil?
   return name
end
def make_name_set
   @name_set = []
   @name_set[0] = Momo_IconCommand::ATTACK_NAME
   @name_set[1] = Momo_IconCommand::SKILL_NAME
   @name_set[2] = Momo_IconCommand::GUARD_NAME
   @name_set[3] = Momo_IconCommand::ITEM_NAME
   @name_set[4] = Momo_IconCommand::ESCAPE_NAM
   @name_set[5] = Momo_IconCommand::EBEIJING_NAM
end
def move_index?
   return self.index != @last_index
end
def need_reset
   @name_sprite.need_reset = true if Momo_IconCommand::COM_NAME_DROW
end
end

# アイコン用スプライト
class Sprite_Icon < Sprite
attr_accessor :active
attr_accessor :icon_name
#------------------------------------------------------------------------
# ● オブジェクト初期化
#------------------------------------------------------------------------
def initialize(viewport, icon_name)
   super(viewport)
   @icon_name = icon_name
   @last_icon = @icon_name
   @count = 0
   self.bitmap = RPG::Cache.icon(@icon_name)
   self.ox = self.bitmap.width / 2
   self.oy = self.bitmap.height / 2
   @active = false
end
#------------------------------------------------------------------------
# ● 解放
#------------------------------------------------------------------------
def dispose
   if self.bitmap != nil
     self.bitmap.dispose
   end
   super
end
#------------------------------------------------------------------------
# ● フレーム更新
#------------------------------------------------------------------------
def update
   super
   if @icon_name != @last_icon
     @last_icon = @icon_name
     self.bitmap = RPG::Cache.icon(@icon_name)
   end
   if @active
     @count += 1
     case Momo_IconCommand::SELECT_TYPE
     when 0
       icon_flash
     when 1
       icon_zoom
     end
     @count = 0 if @count == 20
   else
     icon_reset
   end
end
def icon_flash
   if @count % Momo_IconCommand::FLASH_INTERVAL == 0 or @count == 2
     self.flash(Momo_IconCommand::FLASH_COLOR, Momo_IconCommand::FLASH_DURATION)
   end
end
def icon_zoom
   case @count
   when 1..10
     zoom = 1.0 + @count / 10.0
   when 11..20
     zoom = 2.0 - (@count - 10) / 10.0
   end
   self.zoom_x = zoom
   self.zoom_y = zoom
end
def icon_reset
   @count = 0
   self.zoom_x = 1.0
   self.zoom_y = 1.0
end
end

# コマンドネーム用スプライト
class Sprite_Comm_Name < Sprite
attr_accessor :active
attr_accessor :name
attr_accessor :need_reset
#------------------------------------------------------------------------
# ● オブジェクト初期化
#------------------------------------------------------------------------
def initialize(viewport, name)
   super(viewport)
   @name = name
   @last_name = nil
   @count = 0
   @x_plus = 0
   @opa_plus = 0
   @need_reset = false
   @active = false
   self.bitmap = Bitmap.new(160, 32)
end
#------------------------------------------------------------------------
# ● 解放
#------------------------------------------------------------------------
def dispose
   if self.bitmap != nil
     self.bitmap.dispose
   end
   super
end

#------------------------------------------------------------------------
# ● フレーム更新
#------------------------------------------------------------------------
def update
   super
   if @active
     if need_reset?
       @need_reset = false
       @last_name = @name
       text_reset
     end
     move_text if Momo_IconCommand::COM_NAME_MOVE
   end
end
def move_text
   @count += 1
   @x_plus = [@count * 8, 80].min
   self.x = self.x - 80 + @x_plus
   self.opacity = @count * 25
end
def text_reset
   @count = 0
   @x_plus = 0
   self.bitmap.clear
   self.bitmap.font.color = Momo_IconCommand::COM_NAME_COLOR
   self.bitmap.draw_text(0, 0, 160, 32, @name)
end
def need_reset?
   return (@name != @last_name or @need_reset)
end
end

class Scene_Battle
#------------------------------------------------------------------------
# ● プレバトルフェーズ開始
#------------------------------------------------------------------------
alias scene_battle_icon_command_start_phase1 start_phase1
def start_phase1
   com1 = Momo_IconCommand::ATTACK_ICON_NAME
   com2 = Momo_IconCommand::SKILL_ICON_NAME
   com3 = Momo_IconCommand::GUARD_ICON_NAME
   com4 = Momo_IconCommand::ITEM_ICON_NAME
   com5 = Momo_IconCommand::ESCAPE_ICON_NAME
   com6 = Momo_IconCommand::BEIJING_ICON_NAME
   @actor_command_window = Window_CommandIcon.new(0, 0, [com1, com2, com3, com4, com5,com6])
   @actor_command_window.y = 128
   @actor_command_window.back_opacity = 160
   @actor_command_window.active = false
   @actor_command_window.visible = false
   @actor_command_window.update
   scene_battle_icon_command_start_phase1
end
#------------------------------------------------------------------------
# ● アクターコマンドウィンドウのセットアップ
#------------------------------------------------------------------------
alias scene_battle_icon_command_phase3_setup_command_window phase3_setup_command_window
def phase3_setup_command_window
   scene_battle_icon_command_phase3_setup_command_window
   # アクターコマンドウィンドウの位置を設定
   @actor_command_window.x = command_window_actor_x(@actor_index)
   @actor_command_window.y = command_window_actor_y(@actor_index)
   @actor_command_window.need_reset
end
def command_window_actor_x(index)
   $game_party.actors[index].screen_x + Momo_IconCommand::X_PLUS
end
def command_window_actor_y(index)
   $game_party.actors[index].screen_y + Momo_IconCommand::Y_PLUS
end
end
#==========================================================================
# 本脚本来自www.66RPG.com,使用和转载请保留此信息
#==========================================================================

额~``
什么意思~
LZ不是要图标菜单么~
这个就很好啊~
LZ再自己找些图标菜单的图片弄上去就行了~`

作者: 倚天    时间: 2008-8-14 19:36
提示: 作者被禁止或删除 内容自动屏蔽
作者: 幽月    时间: 2008-8-14 19:52
提示: 作者被禁止或删除 内容自动屏蔽
作者: 倚天    时间: 2008-8-14 20:22
提示: 作者被禁止或删除 内容自动屏蔽
作者: 幽月    时间: 2008-8-14 21:46
提示: 作者被禁止或删除 内容自动屏蔽




欢迎光临 Project1 (https://rpg.blue/) Powered by Discuz! X3.1