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

Project1

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

[已经解决] 图标式战斗选项如何更改默认横向显示改为纵向显示?

 关闭 [复制链接]

Lv3.寻梦者

梦石
0
星屑
3121
在线时间
1435 小时
注册时间
2009-7-27
帖子
1452
跳转到指定楼层
1
发表于 2011-9-17 09:17:30 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
如题,愚者不才,想改成上下选择的模式,但是改来改去只能改位置,却无法把选项改为纵向的显示!
请各位高手帮帮忙指点

点评

把@sprite[i].x = self.x self.x改成固定的数值试试? @sprite[i].y = self.y + i*18 改self.y 改固定数值就好了  发表于 2011-9-17 17:28
补上了修改说明  发表于 2011-9-17 13:14
脚本贴上了  发表于 2011-9-17 12:15

博客:我的博客

Lv1.梦旅人

梦石
0
星屑
49
在线时间
486 小时
注册时间
2009-7-23
帖子
449
2
发表于 2011-9-17 10:17:51 | 只看该作者
全局搜索:
  1. @column_max = commands.size
复制代码
改成
  1. @column_max = 1
复制代码


2578699于2011-9-17 12:15补充以下内容:
直接替换脚本吧。
  1. #==========================================================================
  2. # 本脚本来自www.66RPG.com,使用和转载请保留此信息
  3. # 2578699改
  4. #==========================================================================

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

  39. class Window_CommandIcon < Window_Selectable
  40.   attr_accessor :last_index
  41.   #------------------------------------------------------------------------
  42.   # ● オブジェクト初期化
  43.   #------------------------------------------------------------------------
  44.   def initialize(x, y, commands)
  45.     super(x, y, 32, 32)
  46.     # ウィンドウスキンに空文字列を指定してウィンドウを描画しないようにする
  47.     self.windowskin = RPG::Cache.windowskin("")
  48.     @item_max = commands.size
  49.     @commands = commands
  50.     @column_max = 1
  51.     @index = 0
  52.     @last_index = nil
  53.     @name_sprite = nil
  54.     @sprite = []
  55.     refresh
  56.   end
  57.   def dispose
  58.     super
  59.     for sprite in @sprite
  60.       sprite.dispose unless sprite.nil?
  61.     end
  62.     @name_sprite.dispose unless @name_sprite.nil?
  63.   end
  64.   #------------------------------------------------------------------------
  65.   # ● リフレッシュ
  66.   #------------------------------------------------------------------------
  67.   def refresh
  68.     @name_sprite.dispose unless @name_sprite.nil?
  69.     for sprite in @sprite
  70.       sprite.dispose unless sprite.nil?
  71.     end
  72.     @name_sprite = nil
  73.     draw_com_name if Momo_IconCommand::COM_NAME_DROW
  74.     @sprite = []
  75.     for i in 0...@item_max
  76.       draw_item(i)
  77.     end
  78.   end
  79.   #------------------------------------------------------------------------
  80.   # ● 項目の描画
  81.   #------------------------------------------------------------------------
  82.   def draw_item(index)
  83.     @sprite[index] = Sprite_Icon.new(nil, @commands[index])
  84.     @sprite[index].z = self.z + 1
  85.   end
  86.   def draw_com_name
  87.     @name_sprite = Sprite_Comm_Name.new(nil, get_com_name)
  88.    
  89.   end
  90.   
  91.   # 更新
  92.   def update
  93.     super
  94.     icon_update
  95.     com_name_update if Momo_IconCommand::COM_NAME_DROW
  96.     if move_index?
  97.       @last_index = self.index
  98.     end
  99.   end
  100.   # アイコンの更新
  101.   def icon_update
  102.     for i in [email protected]
  103.       @sprite[i].active = (self.index == i)
  104.       @sprite[i].x = self.x
  105.       @sprite[i].y = self.y + i*18
  106.       @sprite[i].z = (self.index == i) ? self.z + 2 : self.z + 1
  107.       @sprite[i].visible = self.visible
  108.       @sprite[i].update
  109.     end
  110.   end
  111.    # コマンドネームの更新
  112. def com_name_update
  113.    if move_index?
  114.      @name_sprite.name = get_com_name
  115.    end
  116.    @name_sprite.x = self.x - 12 + Momo_IconCommand::COM_NAME_X_PLUS
  117.    @name_sprite.y = self.y - 40 + Momo_IconCommand::COM_NAME_Y_PLUS
  118.    @name_sprite.z = self.z + 1
  119.    @name_sprite.active = self.active
  120.    @name_sprite.visible = self.visible
  121.    @name_sprite.update
  122. end
  123. def get_com_name
  124.    make_name_set if @name_set.nil?
  125.    name = @name_set[self.index]
  126.    name = "" if name.nil?
  127.    return name
  128. end
  129. def make_name_set
  130.    @name_set = []
  131.    @name_set[0] = Momo_IconCommand::ATTACK_NAME
  132.    @name_set[1] = Momo_IconCommand::SKILL_NAME
  133.    @name_set[2] = Momo_IconCommand::GUARD_NAME
  134.    @name_set[3] = Momo_IconCommand::ITEM_NAME
  135.    end
  136. def move_index?
  137.    return self.index != @last_index
  138. end
  139. def need_reset
  140.    @name_sprite.need_reset = true if Momo_IconCommand::COM_NAME_DROW
  141. end
  142. end

  143. # アイコン用スプライト
  144. class Sprite_Icon < Sprite
  145. attr_accessor :active
  146. attr_accessor :icon_name
  147. #--------------------------------------------------------------------------
  148. # ● オブジェクト初期化
  149. #--------------------------------------------------------------------------
  150. def initialize(viewport, icon_name)
  151.    super(viewport)
  152.    @icon_name = icon_name
  153.    @last_icon = @icon_name
  154.    @count = 0
  155.    self.bitmap = RPG::Cache.icon(@icon_name)
  156.    self.ox = self.bitmap.width / 2
  157.    self.oy = self.bitmap.height / 2
  158.    @active = false
  159. end
  160. #--------------------------------------------------------------------------
  161. # ● 解放
  162. #--------------------------------------------------------------------------
  163. def dispose
  164.    if self.bitmap != nil
  165.      self.bitmap.dispose
  166.    end
  167.    super
  168. end
  169. #--------------------------------------------------------------------------
  170. # ● フレーム更新
  171. #--------------------------------------------------------------------------
  172. def update
  173.    super
  174.    if @icon_name != @last_icon
  175.      @last_icon = @icon_name
  176.      self.bitmap = RPG::Cache.icon(@icon_name)
  177.    end
  178.    if @active
  179.      @count += 1
  180.      case Momo_IconCommand::SELECT_TYPE
  181.      when 0
  182.        icon_flash
  183.      when 1
  184.        icon_zoom
  185.      end
  186.      @count = 0 if @count == 20
  187.    else
  188.      icon_reset
  189.    end
  190. end
  191. def icon_flash
  192.    if @count % Momo_IconCommand::FLASH_INTERVAL == 0 or @count == 1
  193.      self.flash(Momo_IconCommand::FLASH_COLOR, Momo_IconCommand::FLASH_DURATION)
  194.    end
  195. end
  196. def icon_zoom
  197.    case @count
  198.    when 1..10
  199.      zoom = 1.0 + @count / 10.0
  200.    when 11..20
  201.      zoom = 2.0 - (@count - 10) / 10.0
  202.    end
  203.    self.zoom_x = zoom
  204.    self.zoom_y = zoom
  205. end
  206. def icon_reset
  207.    @count = 0
  208.    self.zoom_x = 1.0
  209.    self.zoom_y = 1.0
  210. end
  211. end

  212. # コマンドネーム用スプライト
  213. class Sprite_Comm_Name < Sprite
  214. attr_accessor :active
  215. attr_accessor :name
  216. attr_accessor :need_reset
  217. #--------------------------------------------------------------------------
  218. # ● オブジェクト初期化
  219. #--------------------------------------------------------------------------
  220. def initialize(viewport, name)
  221.    super(viewport)
  222.    @name = name
  223.    @last_name = nil
  224.    @count = 0
  225.    @x_plus = 0
  226.    @opa_plus = 0
  227.    @need_reset = false
  228.    @active = false
  229.    self.bitmap = Bitmap.new(160, 32)
  230. end
  231. #--------------------------------------------------------------------------
  232. # ● 解放
  233. #--------------------------------------------------------------------------
  234. def dispose
  235.    if self.bitmap != nil
  236.      self.bitmap.dispose
  237.    end
  238.    super
  239. end
  240. #--------------------------------------------------------------------------
  241. # ● フレーム更新
  242. #--------------------------------------------------------------------------
  243. def update
  244.    super
  245.    if @active
  246.      if need_reset?
  247.        @need_reset = false
  248.        @last_name = @name
  249.        text_reset
  250.      end
  251.      move_text if Momo_IconCommand::COM_NAME_MOVE
  252.    end
  253. end
  254. def move_text
  255.    @count += 1
  256.    @x_plus = [@count * 8, 80].min
  257.    self.x = self.x - 80 + @x_plus
  258.    self.opacity = @count * 25
  259. end
  260. def text_reset
  261.    @count = 0
  262.    @x_plus = 0
  263.    self.bitmap.clear
  264.    self.bitmap.font.color = Momo_IconCommand::COM_NAME_COLOR
  265.    self.bitmap.draw_text(0, 0, 160, 32, @name)
  266. end
  267. def need_reset?
  268.    return (@name != @last_name or @need_reset)
  269. end
  270. end

  271. class Scene_Battle
  272. #--------------------------------------------------------------------------
  273. # ● プレバトルフェーズ開始
  274. #--------------------------------------------------------------------------
  275. alias scene_battle_icon_command_start_phase1 start_phase1
  276. def start_phase1
  277.    com1 = Momo_IconCommand::ATTACK_ICON_NAME
  278.    com2 = Momo_IconCommand::SKILL_ICON_NAME
  279.    com3 = Momo_IconCommand::GUARD_ICON_NAME
  280.    com4 = Momo_IconCommand::ITEM_ICON_NAME
  281.    @actor_command_window = Window_CommandIcon.new(0, 0, [com1, com2, com3, com4])
  282.    @actor_command_window.y = 160
  283.    @actor_command_window.back_opacity = 160
  284.    @actor_command_window.active = false
  285.    @actor_command_window.visible = false
  286.    @actor_command_window.update
  287.    scene_battle_icon_command_start_phase1
  288. end
  289. #--------------------------------------------------------------------------
  290. # ● アクターコマンドウィンドウのセットアップ
  291. #--------------------------------------------------------------------------
  292. alias scene_battle_icon_command_phase3_setup_command_window phase3_setup_command_window
  293. def phase3_setup_command_window
  294.    scene_battle_icon_command_phase3_setup_command_window
  295.    # アクターコマンドウィンドウの位置を設定
  296.    @actor_command_window.x = command_window_actor_x(@actor_index)
  297.    @actor_command_window.y = command_window_actor_y(@actor_index)
  298.    @actor_command_window.need_reset
  299. end
  300. def command_window_actor_x(index)
  301.    $game_party.actors[index].screen_x + Momo_IconCommand::X_PLUS
  302. end
  303. def command_window_actor_y(index)
  304.    $game_party.actors[index].screen_y + Momo_IconCommand::Y_PLUS
  305. end
  306. end

  307. #==============================================================================
  308. # 本脚本来自www.66RPG.com,使用和转载请保留此信息
  309. #==============================================================================
复制代码


2578699于2011-9-17 13:13补充以下内容:
  1. @sprite[i].x = self.x
  2. @sprite[i].y = self.y + i*18

复制代码
106 107行,自己修改x,y值  
y值后面的*18表示间隔,自己调整

点评

请问如何将图标固定在一个位置,就是1号人物的战斗图标在某个位置,然后第2个、3、4、5……的战斗选项图标都在固定一个位置!请问怎么设置?  发表于 2011-9-17 15:56
直接告诉我修改了哪里吧!我自己改的脚本,要是替换了就太麻烦了  发表于 2011-9-17 12:39
可以上下选择了,但是图标还是横向显示,找不到修改的地方  发表于 2011-9-17 12:05
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2025-7-20 19:29

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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