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

Project1

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

[已经解决] 请教个问题...

 关闭 [复制链接]

Lv1.梦旅人

梦石
0
星屑
50
在线时间
4 小时
注册时间
2008-6-5
帖子
312
跳转到指定楼层
1
发表于 2009-7-30 14:14:09 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式

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

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

x
本帖最后由 肖宋发 于 2009-7-30 15:18 编辑

我使用了这个脚本后,更换自己弄的图标,却发现图标都凑在一起!要修改哪里啊?还有,第一位角色选择攻击后,轮到第二位时,为什么4个图标在移动到右半一点....?
  1. #==========================================================================
  2. # 本脚本来自www.66RPG.com,使用和转载请保留此信息
  3. #==========================================================================

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

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

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

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

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

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

Lv1.梦旅人

梦石
0
星屑
50
在线时间
4 小时
注册时间
2008-6-5
帖子
312
2
 楼主| 发表于 2009-7-31 15:33:28 | 只看该作者
没有人会吗{:3_50:} {:3_50:} {:3_50:}
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
200
在线时间
10 小时
注册时间
2009-7-25
帖子
656
3
发表于 2009-7-31 16:03:05 | 只看该作者
- -LS连帖子,别急迟早会有人给你答案`建议你给传一下素材。帮你解决`
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
120
在线时间
73 小时
注册时间
2008-7-9
帖子
234
4
发表于 2009-8-1 06:27:47 | 只看该作者
本帖最后由 well 于 2009-8-1 06:29 编辑

引用代码105行
  1. @sprite[i].x = self.x + i * 24
复制代码
i是command_index。所以图标宽24应该就不会重叠了。或者修改这个值,不过伴随的文字也要跟着改。好麻烦~
304~309行是命令窗口位置
战斗图的坐标加上最开始模块里的偏移量,这两个
Momo_IconCommand::X_PLUS
Momo_IconCommand::Y_PLUS
人物战斗图位置不同自然会跟着移动。


以上。无责任,无保证。
请LZ自行更改验证。
血瞳睨世

也来玩一下养小龙吧
回复 支持 反对

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2024-4-29 03:54

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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