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

Project1

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

[已经解决] 动态显示宝箱获得道具的图标位置如何修改?

[复制链接]

Lv1.梦旅人

梦石
0
星屑
50
在线时间
29 小时
注册时间
2013-8-23
帖子
69
跳转到指定楼层
1
发表于 2013-12-15 00:11:53 | 只看该作者 |只看大图 回帖奖励 |倒序浏览 |阅读模式

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

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

x
效果如图:

我想让道具或者装备的图标显示在名称的后面,就像获得金币一样,在最后部分显示一颗钻石
可是实际效果却是这样的(图标和文字重叠了):
=> (图标显示在灵字的后面)
(魔杖也同样显示在文字后面)
怎么样让图标显示在文字的最后面,同时还不能超出方框外面?

评分

参与人数 1星屑 +20 收起 理由
Luciffer + 20 回馈

查看全部评分

Lv4.逐梦者

送快递的水表员

梦石
10
星屑
4792
在线时间
3303 小时
注册时间
2012-6-27
帖子
7160

开拓者贵宾

来自 4楼
发表于 2013-12-15 10:41:33 | 只看该作者
@gold 先艾特出来这玩意……
改好了,是否是这样?
  1. #==============================================================================
  2. # 动态显示的宝箱 v1.1 (old name: Chest Item Pop-Up)
  3. #------------------------------------------------------------------------------
  4. # 作者  : OriginalWij
  5. #------------------------------------------------------------------------------
  6. # 版本信息:
  7. #
  8. # v1.0
  9. # - 初版
  10. # v1.1
  11. # - 添加提示窗体
  12. #------------------------------------------------------------------------------
  13. # 注意: ① 得失物品/金钱之前,请先打开指定开关
  14. #       ② 得失多个物品时,在多个物品之间插入一个wait(1),详见范例工程
  15. #------------------------------------------------------------------------------
  16. # 汉化版改动: ① 去掉开关自动还原功能
  17. #             ② 按中文习惯显示描述信息
  18. #             ③ 在描述信息中描绘图标
  19. #             ④ 窗体屏幕居中显示
  20. #             ⑤ 增加提示窗体自动关闭功能
  21. #==============================================================================
  22.   # "金钱" 图标序号
  23.   GOLD_ICON = 1250
  24.   # 激活动态显示的开关序号,默认为1号开关
  25.   POPUP_SWITCH = 1
  26.   # 得失物品的声音设定
  27.   POPUP_SOUND = 'Chime2'
  28.   POPUP_SOUND_VOLUME = 100
  29.   POPUP_SOUND_PITCH = 150
  30.   
  31.   ## 提示窗体自动关闭的时间(以帧计算)
  32.   WAIT_TIME = 180
  33. #==============================================================================
  34. # Game_Interpreter
  35. #==============================================================================
  36. class Game_Interpreter
  37.   #--------------------------------------------------------------------------
  38.   # Get X
  39.   #--------------------------------------------------------------------------
  40.   def get_x
  41.     events = $game_map.events
  42.     x_coord = events[@event_id]
  43.     return x_coord.screen_x
  44.   end
  45.   #--------------------------------------------------------------------------
  46.   # Get Y
  47.   #--------------------------------------------------------------------------
  48.   def get_y
  49.     events = $game_map.events
  50.     y_coord = events[@event_id]
  51.     return y_coord.screen_y
  52.   end
  53.   #--------------------------------------------------------------------------
  54.   # Change Gold
  55.   #--------------------------------------------------------------------------
  56.   def command_125
  57.     value = operate_value(@params[0], @params[1], @params[2])
  58.     $game_party.gain_gold(value)
  59.     x_value = get_x
  60.     y_value = get_y
  61.     $scene = Chest_Popup.new(x_value, y_value, 0, value, 1) if $game_switches[POPUP_SWITCH]
  62.     return true
  63.   end
  64.   #--------------------------------------------------------------------------
  65.   # Change Items
  66.   #--------------------------------------------------------------------------
  67.   def command_126
  68.     value = operate_value(@params[1], @params[2], @params[3])
  69.     $game_party.gain_item($data_items[@params[0]], value)
  70.     $game_map.need_refresh = true
  71.     x_value = get_x
  72.     y_value = get_y
  73.     $scene = Chest_Popup.new(x_value, y_value, 1, value, @params[0]) if $game_switches[POPUP_SWITCH]
  74.     return true
  75.   end
  76.   #--------------------------------------------------------------------------
  77.   # Change Weapons
  78.   #--------------------------------------------------------------------------
  79.   def command_127
  80.     value = operate_value(@params[1], @params[2], @params[3])
  81.     $game_party.gain_item($data_weapons[@params[0]], value, @params[4])
  82.     x_value = get_x
  83.     y_value = get_y
  84.     $scene = Chest_Popup.new(x_value, y_value, 2, value, @params[0]) if $game_switches[POPUP_SWITCH]
  85.     return true
  86.   end
  87.   #--------------------------------------------------------------------------
  88.   # Change Armor
  89.   #--------------------------------------------------------------------------
  90.   def command_128
  91.     value = operate_value(@params[1], @params[2], @params[3])
  92.     $game_party.gain_item($data_armors[@params[0]], value, @params[4])
  93.     x_value = get_x
  94.     y_value = get_y
  95.     $scene = Chest_Popup.new(x_value, y_value, 3, value, @params[0]) if $game_switches[POPUP_SWITCH]
  96.     return true
  97.   end
  98. end

  99. #==============================================================================
  100. # Item Popup Window
  101. #==============================================================================
  102. class Item_Popup_Window < Window_Base
  103.   #--------------------------------------------------------------------------
  104.   # Initialize
  105.   #--------------------------------------------------------------------------
  106.   def initialize(x, y)
  107.     super(0, 0, 544, 416)
  108.     self.opacity = 0
  109.     @x = x - 26
  110.     @y = y - 56
  111.   end
  112.   #--------------------------------------------------------------------------
  113.   # Pop-Up
  114.   #--------------------------------------------------------------------------
  115.   def pop_up(icon_index, x, y)
  116.     self.contents.clear
  117.     draw_icon(icon_index, x, y, true)
  118.   end
  119. end

  120. #==============================================================================
  121. # Name window
  122. #==============================================================================
  123. class Name_Window < Window_Base
  124.   #--------------------------------------------------------------------------
  125.   # Initialize ## 去掉坐标传递,新增 icon_index
  126.   #--------------------------------------------------------------------------
  127.   def initialize(icon_index, desc, gold = false)
  128.     ## 此位图缓存应该不需要重载
  129.     width = Cache.system("Window").text_size(desc).width + 32
  130.     width += 24 #if gold
  131.     ## 屏幕居中
  132.     x = (Graphics.width - width)/2
  133.     y = (Graphics.height - WLH-32)/2
  134.     super(x, y, width, WLH + 32)
  135.     if gold
  136.       self.contents.draw_text(0, 0, width-24, WLH, desc)
  137.       draw_icon(icon_index, width - 24-32, 0, true)
  138.     else
  139.       self.contents.draw_text(0, 0, width-24, WLH, desc)
  140.       draw_icon(icon_index, width - 24-32, 0, true)
  141.     end
  142.   end
  143. end

  144. #==============================================================================
  145. # Scene_Base
  146. #==============================================================================
  147. class Scene_Base
  148.   #--------------------------------------------------------------------------
  149.   # Create Snapshot for Using as Background of Another Screen
  150.   #--------------------------------------------------------------------------
  151.   def snapshot_for_background
  152.     $game_temp.background_bitmap.dispose
  153.     $game_temp.background_bitmap = Graphics.snap_to_bitmap
  154.     $game_temp.background_bitmap.blur if !$game_switches[POPUP_SWITCH]
  155.   end
  156. end

  157. #==============================================================================
  158. # Chest_Popup
  159. #==============================================================================
  160. class Chest_Popup < Scene_Base
  161.   #--------------------------------------------------------------------------
  162.   # Initialize
  163.   #--------------------------------------------------------------------------
  164.   def initialize(x, y, type, amount, index)
  165.     @x = x
  166.     @y = y
  167.     @amount = amount
  168.     @gold = false
  169.     case type
  170.     ## 改写成中文习惯
  171.     when 0 # gold
  172.       @icon_index = GOLD_ICON
  173.       @desc = '金钱: ' + @amount.to_s
  174.       @amount = 1
  175.       @gold = true
  176.     when 1 # items
  177.       @icon_index = $data_items[index].icon_index
  178.       ## 自定义文字时,请注意留空格,下同
  179.       @desc = '物品:   ' + $data_items[index].name + '×' + @amount.to_s  
  180.     when 2 # weapons
  181.       @icon_index = $data_weapons[index].icon_index
  182.       @desc = '武器:   ' + $data_weapons[index].name + '×' + @amount.to_s
  183.     when 3 # armors
  184.       @icon_index = $data_armors[index].icon_index
  185.       @desc = '防具:   ' + $data_armors[index].name + '×' + @amount.to_s
  186.     end
  187.   end
  188.   #--------------------------------------------------------------------------
  189.   # Start
  190.   #--------------------------------------------------------------------------
  191.   def start
  192.     create_background
  193.     @popup_window = Item_Popup_Window.new(@x, @y)
  194.   end
  195.   #--------------------------------------------------------------------------
  196.   # Terminate
  197.   #--------------------------------------------------------------------------
  198.   def terminate
  199.     @popup_window.dispose
  200.     @name_window.dispose
  201.     @menuback_sprite.dispose
  202.   end
  203.   #--------------------------------------------------------------------------
  204.   # Return Scene
  205.   #--------------------------------------------------------------------------
  206.   def return_scene
  207.     ##$game_switches[POPUP_SWITCH] = false ## 去掉还原限制
  208.     $scene = Scene_Map.new
  209.   end
  210.   #--------------------------------------------------------------------------
  211.   # Update
  212.   #--------------------------------------------------------------------------
  213.   def update
  214.     super
  215.     @popup_window.update
  216.     @menuback_sprite.update
  217.     do_popup
  218.   end
  219.   #--------------------------------------------------------------------------
  220.   # Update Basic
  221.   #--------------------------------------------------------------------------
  222.   def update_basic
  223.     Graphics.update              
  224.     Input.update                  
  225.     $game_map.update              
  226.   end
  227.   #--------------------------------------------------------------------------
  228.   # Wait
  229.   #--------------------------------------------------------------------------
  230.   def wait(duration)
  231.     for i in 0...duration
  232.       update_basic
  233.     end
  234.   end
  235.   #--------------------------------------------------------------------------
  236.   # Wait for "C"
  237.   #--------------------------------------------------------------------------
  238.   def wait_for_c
  239.     ## 自动关闭的计数器
  240.     @wait_count = WAIT_TIME
  241.     loop do
  242.       @wait_count -= 1
  243.       update_basic
  244.       ## 关闭判定
  245.       break if Input.trigger?(Input::C) or @wait_count <= 0
  246.     end
  247.   end
  248.   #--------------------------------------------------------------------------
  249.   # Create Background
  250.   #--------------------------------------------------------------------------
  251.   def create_background
  252.     @menuback_sprite = Sprite.new
  253.     @menuback_sprite.bitmap = $game_temp.background_bitmap
  254.     @menuback_sprite.update
  255.   end
  256.   #--------------------------------------------------------------------------
  257.   # Show Name
  258.   #--------------------------------------------------------------------------
  259.   def show_name
  260.     ## 去掉坐标传递,新增 icon_index
  261.     @name_window = Name_Window.new(@icon_index, @desc, @gold)
  262.     wait_for_c
  263.     Sound.play_cancel
  264.   end
  265.   #--------------------------------------------------------------------------
  266.   # Do Pop-Up
  267.   #--------------------------------------------------------------------------
  268.   def do_popup
  269.     for i in 1..@amount
  270.       Audio.se_play('Audio/SE/' + POPUP_SOUND, POPUP_SOUND_VOLUME, POPUP_SOUND_PITCH)
  271.       for i in 0..4
  272.         @popup_window.pop_up(@icon_index, @x - 26, @y - (i * 4) - 48)
  273.         @popup_window.update
  274.         wait(2)
  275.       end
  276.       wait(5) if i != @amount
  277.     end
  278.     wait(5)
  279.     show_name
  280.     return_scene
  281.   end
  282. end
复制代码

点评

thank you  发表于 2013-12-15 15:32

评分

参与人数 1梦石 +1 收起 理由
Luciffer + 1 认可答案

查看全部评分

回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
95
在线时间
211 小时
注册时间
2011-8-16
帖子
300
2
发表于 2013-12-15 00:18:36 | 只看该作者
请贴出脚本或发出工程。或指出所用脚本发布链接等。
RPGMaker 脚本/学习交流群:143356012
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
50
在线时间
29 小时
注册时间
2013-8-23
帖子
69
3
 楼主| 发表于 2013-12-15 10:06:13 | 只看该作者
774741359 发表于 2013-12-15 00:18
请贴出脚本或发出工程。或指出所用脚本发布链接等。

忘了
  1. #==============================================================================
  2. # 动态显示的宝箱 v1.1 (old name: Chest Item Pop-Up)
  3. #------------------------------------------------------------------------------
  4. # 作者  : OriginalWij
  5. #------------------------------------------------------------------------------
  6. # 版本信息:
  7. #
  8. # v1.0
  9. # - 初版
  10. # v1.1
  11. # - 添加提示窗体
  12. #------------------------------------------------------------------------------
  13. # 注意: ① 得失物品/金钱之前,请先打开指定开关
  14. #       ② 得失多个物品时,在多个物品之间插入一个wait(1),详见范例工程
  15. #------------------------------------------------------------------------------
  16. # 汉化版改动: ① 去掉开关自动还原功能
  17. #             ② 按中文习惯显示描述信息
  18. #             ③ 在描述信息中描绘图标
  19. #             ④ 窗体屏幕居中显示
  20. #             ⑤ 增加提示窗体自动关闭功能
  21. #==============================================================================
  22.   # "金钱" 图标序号
  23.   GOLD_ICON = 1250
  24.   # 激活动态显示的开关序号,默认为1号开关
  25.   POPUP_SWITCH = 1
  26.   # 得失物品的声音设定
  27.   POPUP_SOUND = 'Chime2'
  28.   POPUP_SOUND_VOLUME = 100
  29.   POPUP_SOUND_PITCH = 150
  30.   
  31.   ## 提示窗体自动关闭的时间(以帧计算)
  32.   WAIT_TIME = 180
  33. #==============================================================================
  34. # Game_Interpreter
  35. #==============================================================================
  36. class Game_Interpreter
  37.   #--------------------------------------------------------------------------
  38.   # Get X
  39.   #--------------------------------------------------------------------------
  40.   def get_x
  41.     events = $game_map.events
  42.     x_coord = events[@event_id]
  43.     return x_coord.screen_x
  44.   end
  45.   #--------------------------------------------------------------------------
  46.   # Get Y
  47.   #--------------------------------------------------------------------------
  48.   def get_y
  49.     events = $game_map.events
  50.     y_coord = events[@event_id]
  51.     return y_coord.screen_y
  52.   end
  53.   #--------------------------------------------------------------------------
  54.   # Change Gold
  55.   #--------------------------------------------------------------------------
  56.   def command_125
  57.     value = operate_value(@params[0], @params[1], @params[2])
  58.     $game_party.gain_gold(value)
  59.     x_value = get_x
  60.     y_value = get_y
  61.     $scene = Chest_Popup.new(x_value, y_value, 0, value, 1) if $game_switches[POPUP_SWITCH]
  62.     return true
  63.   end
  64.   #--------------------------------------------------------------------------
  65.   # Change Items
  66.   #--------------------------------------------------------------------------
  67.   def command_126
  68.     value = operate_value(@params[1], @params[2], @params[3])
  69.     $game_party.gain_item($data_items[@params[0]], value)
  70.     $game_map.need_refresh = true
  71.     x_value = get_x
  72.     y_value = get_y
  73.     $scene = Chest_Popup.new(x_value, y_value, 1, value, @params[0]) if $game_switches[POPUP_SWITCH]
  74.     return true
  75.   end
  76.   #--------------------------------------------------------------------------
  77.   # Change Weapons
  78.   #--------------------------------------------------------------------------
  79.   def command_127
  80.     value = operate_value(@params[1], @params[2], @params[3])
  81.     $game_party.gain_item($data_weapons[@params[0]], value, @params[4])
  82.     x_value = get_x
  83.     y_value = get_y
  84.     $scene = Chest_Popup.new(x_value, y_value, 2, value, @params[0]) if $game_switches[POPUP_SWITCH]
  85.     return true
  86.   end
  87.   #--------------------------------------------------------------------------
  88.   # Change Armor
  89.   #--------------------------------------------------------------------------
  90.   def command_128
  91.     value = operate_value(@params[1], @params[2], @params[3])
  92.     $game_party.gain_item($data_armors[@params[0]], value, @params[4])
  93.     x_value = get_x
  94.     y_value = get_y
  95.     $scene = Chest_Popup.new(x_value, y_value, 3, value, @params[0]) if $game_switches[POPUP_SWITCH]
  96.     return true
  97.   end
  98. end

  99. #==============================================================================
  100. # Item Popup Window
  101. #==============================================================================
  102. class Item_Popup_Window < Window_Base
  103.   #--------------------------------------------------------------------------
  104.   # Initialize
  105.   #--------------------------------------------------------------------------
  106.   def initialize(x, y)
  107.     super(0, 0, 544, 416)
  108.     self.opacity = 0
  109.     @x = x - 26
  110.     @y = y - 56
  111.   end
  112.   #--------------------------------------------------------------------------
  113.   # Pop-Up
  114.   #--------------------------------------------------------------------------
  115.   def pop_up(icon_index, x, y)
  116.     self.contents.clear
  117.     draw_icon(icon_index, x, y, true)
  118.   end
  119. end

  120. #==============================================================================
  121. # Name window
  122. #==============================================================================
  123. class Name_Window < Window_Base
  124.   #--------------------------------------------------------------------------
  125.   # Initialize ## 去掉坐标传递,新增 icon_index
  126.   #--------------------------------------------------------------------------
  127.   def initialize(icon_index, desc, gold = false)
  128.     ## 此位图缓存应该不需要重载
  129.     width = Cache.system("Window").text_size(desc).width + 32
  130.     width += 24 if gold
  131.     ## 屏幕居中
  132.     x = (Graphics.width - width)/2
  133.     y = (Graphics.height - WLH-32)/2
  134.     super(x, y, width, WLH + 32)
  135.     if gold
  136.       self.contents.draw_text(0, 0, width-24, WLH, desc)
  137.       draw_icon(icon_index, width - 24-32, 0, true)
  138.     else
  139.       draw_icon(icon_index, 56, 0, true)
  140.       self.contents.draw_text(0, 0, width, WLH, desc)
  141.     end
  142.   end
  143. end

  144. #==============================================================================
  145. # Scene_Base
  146. #==============================================================================
  147. class Scene_Base
  148.   #--------------------------------------------------------------------------
  149.   # Create Snapshot for Using as Background of Another Screen
  150.   #--------------------------------------------------------------------------
  151.   def snapshot_for_background
  152.     $game_temp.background_bitmap.dispose
  153.     $game_temp.background_bitmap = Graphics.snap_to_bitmap
  154.     $game_temp.background_bitmap.blur if !$game_switches[POPUP_SWITCH]
  155.   end
  156. end

  157. #==============================================================================
  158. # Chest_Popup
  159. #==============================================================================
  160. class Chest_Popup < Scene_Base
  161.   #--------------------------------------------------------------------------
  162.   # Initialize
  163.   #--------------------------------------------------------------------------
  164.   def initialize(x, y, type, amount, index)
  165.     @x = x
  166.     @y = y
  167.     @amount = amount
  168.     [url=home.php?mod=space&uid=236945]@gold[/url] = false
  169.     case type
  170.     ## 改写成中文习惯
  171.     when 0 # gold
  172.       @icon_index = GOLD_ICON
  173.       @desc = '金钱: ' + @amount.to_s
  174.       @amount = 1
  175.       @gold = true
  176.     when 1 # items
  177.       @icon_index = $data_items[index].icon_index
  178.       ## 自定义文字时,请注意留空格,下同
  179.       @desc = '物品:   ' + $data_items[index].name + '×' + @amount.to_s  
  180.     when 2 # weapons
  181.       @icon_index = $data_weapons[index].icon_index
  182.       @desc = '武器:   ' + $data_weapons[index].name + '×' + @amount.to_s
  183.     when 3 # armors
  184.       @icon_index = $data_armors[index].icon_index
  185.       @desc = '防具:   ' + $data_armors[index].name + '×' + @amount.to_s
  186.     end
  187.   end
  188.   #--------------------------------------------------------------------------
  189.   # Start
  190.   #--------------------------------------------------------------------------
  191.   def start
  192.     create_background
  193.     @popup_window = Item_Popup_Window.new(@x, @y)
  194.   end
  195.   #--------------------------------------------------------------------------
  196.   # Terminate
  197.   #--------------------------------------------------------------------------
  198.   def terminate
  199.     @popup_window.dispose
  200.     @name_window.dispose
  201.     @menuback_sprite.dispose
  202.   end
  203.   #--------------------------------------------------------------------------
  204.   # Return Scene
  205.   #--------------------------------------------------------------------------
  206.   def return_scene
  207.     ##$game_switches[POPUP_SWITCH] = false ## 去掉还原限制
  208.     $scene = Scene_Map.new
  209.   end
  210.   #--------------------------------------------------------------------------
  211.   # Update
  212.   #--------------------------------------------------------------------------
  213.   def update
  214.     super
  215.     @popup_window.update
  216.     @menuback_sprite.update
  217.     do_popup
  218.   end
  219.   #--------------------------------------------------------------------------
  220.   # Update Basic
  221.   #--------------------------------------------------------------------------
  222.   def update_basic
  223.     Graphics.update              
  224.     Input.update                  
  225.     $game_map.update              
  226.   end
  227.   #--------------------------------------------------------------------------
  228.   # Wait
  229.   #--------------------------------------------------------------------------
  230.   def wait(duration)
  231.     for i in 0...duration
  232.       update_basic
  233.     end
  234.   end
  235.   #--------------------------------------------------------------------------
  236.   # Wait for "C"
  237.   #--------------------------------------------------------------------------
  238.   def wait_for_c
  239.     ## 自动关闭的计数器
  240.     @wait_count = WAIT_TIME
  241.     loop do
  242.       @wait_count -= 1
  243.       update_basic
  244.       ## 关闭判定
  245.       break if Input.trigger?(Input::C) or @wait_count <= 0
  246.     end
  247.   end
  248.   #--------------------------------------------------------------------------
  249.   # Create Background
  250.   #--------------------------------------------------------------------------
  251.   def create_background
  252.     @menuback_sprite = Sprite.new
  253.     @menuback_sprite.bitmap = $game_temp.background_bitmap
  254.     @menuback_sprite.update
  255.   end
  256.   #--------------------------------------------------------------------------
  257.   # Show Name
  258.   #--------------------------------------------------------------------------
  259.   def show_name
  260.     ## 去掉坐标传递,新增 icon_index
  261.     @name_window = Name_Window.new(@icon_index, @desc, @gold)
  262.     wait_for_c
  263.     Sound.play_cancel
  264.   end
  265.   #--------------------------------------------------------------------------
  266.   # Do Pop-Up
  267.   #--------------------------------------------------------------------------
  268.   def do_popup
  269.     for i in 1..@amount
  270.       Audio.se_play('Audio/SE/' + POPUP_SOUND, POPUP_SOUND_VOLUME, POPUP_SOUND_PITCH)
  271.       for i in 0..4
  272.         @popup_window.pop_up(@icon_index, @x - 26, @y - (i * 4) - 48)
  273.         @popup_window.update
  274.         wait(2)
  275.       end
  276.       wait(5) if i != @amount
  277.     end
  278.     wait(5)
  279.     show_name
  280.     return_scene
  281.   end
  282. end
复制代码
回复 支持 反对

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2024-4-28 06:50

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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