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

Project1

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

[已经解决] 关于事件头上显示名称

[复制链接]

Lv1.梦旅人

梦石
0
星屑
50
在线时间
184 小时
注册时间
2011-3-2
帖子
65
跳转到指定楼层
1
发表于 2014-8-17 19:39:34 | 只看该作者 |只看大图 回帖奖励 |倒序浏览 |阅读模式

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

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

x
这个脚本怎样改变文字颜色,是我不会调用还是没有定义?如果是没有定义,能不能弄成添加"\c[n]"改变颜色呢?谢啦
RUBY 代码复制
  1. #==============================================================================
  2. # ★ RGSS3_ネームポップ Ver1.1
  3. #==============================================================================
  4. =begin
  5.  
  6. 作者:tomoaky
  7. webサイト:ひきも記 ([url]http://hikimoki.sakura.ne.jp/[/url])
  8.  
  9. イベント名かイベント実行内容の先頭に『注釈』コマンドで
  10. <namepop 文字列>
  11. と記述してください。
  12. イベントキャラクターの頭上に文字列が表示されます。
  13.  
  14. イベント名で指定した場合はイベント全ページに適用されますが、
  15. 優先度は注釈コマンドの方が高くなっています。
  16.  
  17. 文字を消したい場合は <namepop none> としてください。
  18.  
  19. 2011.12.16  Ver1.1
  20.   ・フォントの縁取り不透明度を設定項目に追加
  21.  
  22. 2011.12.15  Ver1.0
  23.   公開
  24.  
  25. =end
  26.  
  27. #==============================================================================
  28. # □ 設定項目
  29. #==============================================================================
  30. module TMNPOP
  31.   FONT_SIZE = 14          # フォントサイズ
  32.   FONT_OUT_ALPHA = 255    # フォントの縁取り不透明度
  33. end
  34.  
  35. #==============================================================================
  36. # ■ Game_Character
  37. #==============================================================================
  38. class Game_Character
  39.   #--------------------------------------------------------------------------
  40.   # ● 公開インスタンス変数
  41.   #--------------------------------------------------------------------------
  42.   attr_accessor :namepop                  # ポップアップテキスト
  43.   #--------------------------------------------------------------------------
  44. end
  45.  
  46. #==============================================================================
  47. # ■ Game_Event
  48. #==============================================================================
  49. class Game_Event < Game_Character
  50.   #--------------------------------------------------------------------------
  51.   # ● イベントページの設定をセットアップ
  52.   #--------------------------------------------------------------------------
  53.   alias tmnpop_game_event_setup_page_settings setup_page_settings
  54.   def setup_page_settings
  55.     tmnpop_game_event_setup_page_settings
  56.     if @list
  57.       @namepop = $1 if /<namepop\s*(\S+?)>/i =~ @event.name
  58.       @list.each do |list|
  59.         if list.code == 108 || list.code == 408
  60.           @namepop = $1 if /<namepop\s*(\S+?)>/i =~ list.parameters[0]
  61.         else
  62.           break
  63.         end
  64.       end
  65.     end
  66.   end
  67. end
  68.  
  69. #==============================================================================
  70. # ■ Sprite_Character
  71. #==============================================================================
  72. class Sprite_Character < Sprite_Base
  73.   #--------------------------------------------------------------------------
  74.   # ● 解放
  75.   #--------------------------------------------------------------------------
  76.   alias tmnpop_sprite_character_dispose dispose
  77.   def dispose
  78.     dispose_namepop
  79.     tmnpop_sprite_character_dispose
  80.   end
  81.   #--------------------------------------------------------------------------
  82.   # ● フレーム更新
  83.   #--------------------------------------------------------------------------
  84.   alias tmnpop_sprite_character_update update
  85.   def update
  86.     tmnpop_sprite_character_update
  87.     update_namepop
  88.     if @character.namepop != @namepop
  89.       @namepop = @character.namepop
  90.       start_namepop
  91.     end
  92.   end
  93.   #--------------------------------------------------------------------------
  94.   # ○ namepopの開始
  95.   #--------------------------------------------------------------------------
  96.   def start_namepop
  97.     dispose_namepop
  98.     return if @namepop == "none" || @namepop == nil
  99.     @namepop_sprite = ::Sprite.new(viewport)
  100.     h = TMNPOP::FONT_SIZE + 4
  101.     @namepop_sprite.bitmap = Bitmap.new(h * 10, h)
  102.     @namepop_sprite.bitmap.font.size = TMNPOP::FONT_SIZE
  103.     @namepop_sprite.bitmap.font.out_color.alpha = TMNPOP::FONT_OUT_ALPHA
  104.     @namepop_sprite.bitmap.draw_text(0, 0, h * 10, h, @namepop, 1)
  105.     @namepop_sprite.ox = h * 5
  106.     @namepop_sprite.oy = h
  107.     update_namepop
  108.   end
  109.   #--------------------------------------------------------------------------
  110.   # ○ namepopの更新
  111.   #--------------------------------------------------------------------------
  112.   def update_namepop
  113.     if @namepop_sprite
  114.       @namepop_sprite.x = x
  115.       @namepop_sprite.y = y - height
  116.       @namepop_sprite.z = z + 200
  117.     end
  118.   end
  119.   #--------------------------------------------------------------------------
  120.   # ○ namepopの解放
  121.   #--------------------------------------------------------------------------
  122.   def dispose_namepop
  123.     if @namepop_sprite
  124.       @namepop_sprite.bitmap.dispose
  125.       @namepop_sprite.dispose
  126.       @namepop_sprite = nil
  127.     end
  128.   end
  129. end

Lv3.寻梦者 (版主)

…あたしは天使なんかじゃないわ

梦石
0
星屑
2208
在线时间
4033 小时
注册时间
2010-10-4
帖子
10779

开拓者贵宾

2
发表于 2014-8-17 20:07:16 | 只看该作者
本帖最后由 taroxd 于 2014-8-17 20:08 编辑

103行前面加一句:
  1.     @namepop_sprite.bitmap.font.color.set(red,green,blue)
复制代码
三个参数分别改为对应的数字

要使用 \C[n] 需要进行一些坐标的计算,而我比较懒
回复 支持 反对

使用道具 举报

Lv5.捕梦者

梦石
0
星屑
22703
在线时间
8623 小时
注册时间
2011-12-31
帖子
3367
3
发表于 2014-8-17 20:19:10 | 只看该作者
本帖最后由 VIPArcher 于 2014-8-17 20:35 编辑

用這果文字比較好看
@character 帮你艾特一个人 VIPArcher留
  1. #-------------------------------------------------------------------------------
  2. #  Galv's Event Pop-Ups
  3. #-------------------------------------------------------------------------------
  4. #  For: RPGMAKER VX ACE
  5. #  Version 1.1
  6. #------------------------------------------------------------------------------#
  7. #  2013-03-03 - Version 1.1 - crash fix
  8. #  2013-02-24 - Version 1.1 - release
  9. #------------------------------------------------------------------------------#
  10. #  Just another pop up script, nothing special here other than I made it (which
  11. #  could be less special! haha). Manually create a text pop up or automatically
  12. #  whenever you give the player an item via event command - pops up the item's
  13. #  icon above their head with amount gained.
  14. #------------------------------------------------------------------------------#
  15. #  SCRIPT CALL to manually call the pop up
  16. #------------------------------------------------------------------------------#
  17. #
  18. #  popup(target,type,id,amount)
  19. #
  20. #  # target = event id you want popup to appear on. 0 is for player
  21. #  # type = :item, :armor, :weapon or "Other Text"
  22. #  # id = the item, armor or weapon id OR icon id if using "Other Text"
  23. #  # amount = how many of item you wish to display are being gained or lost
  24. #
  25. #------------------------------------------------------------------------------#
  26. #  EXAMPLES:
  27. #  popup(0," Skulls",1,5)  # '5 x Skulls' with icon 1 above player
  28. #  popup(2,"Hello  ",0,0)  # 'Hello' with no icon above event 2
  29. #  popup(4,:item,1,-10)    # -10 Potions (with icon) above event 4
  30. #
  31. #  NOTE: The Gain item, weapon, armor and gold event commands automatically pop
  32. #        up with the item gained/lost. Only one pop up can be active at a time.
  33. #------------------------------------------------------------------------------#

  34. ($imported ||= {})["Galv_Map_Popups"] = true
  35. module Galv_Mpop

  36. #------------------------------------------------------------------------------#
  37. #  SETUP OPTIONS
  38. #------------------------------------------------------------------------------#

  39.   DISABLE_SWITCH = 1  # Turn swith ON to disable this.
  40.    
  41.    
  42.   SE_GAIN = ["Item1",100,100]   # "SE_Name",volume,pitch when gaining item
  43.   SE_LOSE = ["Miss",100,100]    # "SE_Name",volume,pitch when losing item
  44.    
  45.   # These sounds only play with the add or remove items event command. Custom
  46.   # item pop up won't display a sound so you can play your own.


  47.   Y_OFFSET = -50                # Y offset for popup text
  48.    
  49.   CURRENCY_ICON  = 361          # Icon that appears when gaining/losing money
  50.    
  51.   FONT = "Arial"                # Font used for pop ups
  52.   GAIN_COLOR = [255,255,255]    # RGB colour for gaining item text
  53.   LOSE_COLOR = [255,200,200]    # RGB colour for losing item text
  54.    
  55. #------------------------------------------------------------------------------#
  56. #  END SETUP OPTIONS
  57. #------------------------------------------------------------------------------#

  58. end


  59. class Game_Map
  60.   alias galv_map_pop_gp_initialize initialize
  61.   def initialize
  62.     galv_map_pop_gp_initialize
  63.   end
  64.    
  65.   alias galv_map_pop_gp_update update
  66.   def update(main = false)
  67.     update_popup if @popsprite
  68.     galv_map_pop_gp_update(main)
  69.   end
  70.    
  71.   def update_popup
  72.     @popsprite.update
  73.   end
  74.    
  75.   def dispose_popup
  76.     @popsprite.dispose if @popsprite
  77.     @popsprite = nil
  78.   end
  79.    
  80.   def popup(target,item_type,item_id,amount)
  81.     @popsprite.dispose if @popsprite
  82.     character = get_ptarget(target)
  83.     item = get_pitem(item_type,item_id)
  84.     @popsprite = Sprite_PopText.new(@viewport1,character,item,amount)
  85.   end
  86.    
  87.   def get_ptarget(target)
  88.     if target == 0; return $game_player
  89.     elsif target > 0; return $game_map.events[target]
  90.     end
  91.   end
  92.    
  93.   def get_pitem(item_type,item_id)
  94.     case item_type
  95.     when :item;   $data_items[item_id]
  96.     when :weapon; $data_weapons[item_id]
  97.     when :armor;  $data_armors[item_id]
  98.     else; [item_type.to_s,item_id]
  99.     end
  100.   end
  101.    
  102. end # Game_Player < Game_Character


  103. class Scene_Map < Scene_Base
  104.   def dispose_spriteset
  105.     @spriteset.dispose
  106.     $game_map.dispose_popup
  107.   end
  108. end

  109. class Sprite_PopText < Sprite
  110.   def initialize(viewport,target,item,amount)
  111.     super(viewport)
  112.     @character = target
  113.     @item = item
  114.     @rise = 0
  115.     @rise_speed = 0
  116.     @amount = amount
  117.     create_bitmap
  118.     update
  119.   end

  120.   def dispose
  121.     self.bitmap.dispose
  122.     if @icon_sprite
  123.       @icon_sprite.bitmap.dispose
  124.       @icon_sprite.dispose
  125.     end
  126.     super
  127.   end

  128.   def create_bitmap
  129.     if @item
  130.       @icon_sprite = Sprite.new
  131.       @icon_sprite.bitmap = Cache.system("Iconset")
  132.     end
  133.     @x_offset = -92
  134.     self.bitmap = Bitmap.new(200, 20)
  135.     self.bitmap.font.size = 20
  136.     self.bitmap.font.name = Galv_Mpop::FONT
  137.     self.bitmap.font.shadow = 20
  138.     self.bitmap.font.bold = true
  139.     if @amount >= 0
  140.       self.bitmap.font.color.set(
  141.       Galv_Mpop::GAIN_COLOR[0],Galv_Mpop::GAIN_COLOR[1],Galv_Mpop::GAIN_COLOR[2])
  142.     else
  143.       self.bitmap.font.color.set(
  144.       Galv_Mpop::LOSE_COLOR[0],Galv_Mpop::LOSE_COLOR[1],Galv_Mpop::LOSE_COLOR[2])
  145.     end
  146.     self.z = 2
  147.   end

  148.   def update
  149.     super
  150.     update_position
  151.     update_bitmap
  152.     update_visibility
  153.     update_icon if @icon_sprite
  154.     end_popup
  155.   end

  156.   def end_popup
  157.     return $game_map.dispose_popup if @rise >= 280
  158.   end

  159.   def name_text
  160.     if @item.is_a?(Array)
  161.       amount = @amount > 1 || @amount < -1 ? @amount.to_s : ""
  162.       return amount + @item[0].to_s
  163.     elsif @item
  164.       amount = @amount != 0 ? @amount.to_s : ""
  165.       return @amount >= 1 ? "x" + amount : amount
  166.     else
  167.       return ""
  168.     end
  169.   end
  170.    
  171.   def update_bitmap
  172.     @rise += 1
  173.     self.bitmap.clear
  174.     self.bitmap.draw_text(self.bitmap.rect, name_text, 1)
  175.     if @item && @item.is_a?(Array)
  176.       self.draw_icon(@item[1])
  177.     elsif @item
  178.       self.draw_icon(@item.icon_index)
  179.     end
  180.   end
  181.    
  182.   def draw_icon(icon_index)
  183.     rect = Rect.new(icon_index % 16 * 24, icon_index / 16 * 24, 24, 24)
  184.     @icon_sprite.src_rect = rect
  185.     @icon = icon_index
  186.   end
  187.    
  188.   def calculate_y
  189.     if @rise_speed > 0
  190.       @rise_speed -= 1
  191.       return -(@rise * @rise_speed * 0.2)
  192.     else
  193.       return 0
  194.     end
  195.   end

  196.   def update_position
  197.     self.x = @character.screen_x + @x_offset
  198.     if @amount >= 0
  199.       self.y = @character.screen_y + Galv_Mpop::Y_OFFSET + calculate_y
  200.     else
  201.       self.y = @character.screen_y + Galv_Mpop::Y_OFFSET - 10 + @rise * 0.2
  202.     end
  203.   end

  204.   def update_icon
  205.     @icon_sprite.x = @character.screen_x - name_text.length * 4 - 20
  206.     @icon_sprite.y = self.y - 2
  207.     @icon_sprite.opacity = self.opacity
  208.   end
  209.    
  210.   def update_visibility
  211.     self.opacity = 500 + (name_text.length * 20) - @rise * 6
  212.   end
  213. end # Sprite_PopText < Sprite


  214. class Game_Interpreter
  215.    
  216.   def psound(amount)
  217.     if amount > 0
  218.       RPG::SE.new(Galv_Mpop::SE_GAIN[0],Galv_Mpop::SE_GAIN[1],Galv_Mpop::SE_GAIN[2]).play
  219.     elsif amount < 0
  220.       RPG::SE.new(Galv_Mpop::SE_LOSE[0],Galv_Mpop::SE_LOSE[1],Galv_Mpop::SE_LOSE[2]).play
  221.     end
  222.   end
  223.    
  224.   alias galv_map_pop_gi_command_125 command_125
  225.   def command_125
  226.     difference = $game_party.gold
  227.     galv_map_pop_gi_command_125
  228.     amount = $game_party.gold - difference
  229.     return if amount == 0 || $game_switches[Galv_Mpop::DISABLE_SWITCH]
  230.     psound(amount)
  231.     $game_map.popup(0,"",Galv_Mpop::CURRENCY_ICON,amount)
  232.   end

  233.   alias galv_map_pop_gi_command_126 command_126
  234.   def command_126
  235.     difference = $game_party.item_number($data_items[@params[0]])
  236.     galv_map_pop_gi_command_126
  237.     amount = $game_party.item_number($data_items[@params[0]]) - difference
  238.     return if amount == 0 || $game_switches[Galv_Mpop::DISABLE_SWITCH]
  239.     psound(amount)
  240.     $game_map.popup(0,:item,@params[0],amount)
  241.   end
  242.    
  243.   alias galv_map_pop_gi_command_127 command_127
  244.   def command_127
  245.     difference = $game_party.item_number($data_weapons[@params[0]])
  246.     galv_map_pop_gi_command_127
  247.     amount = $game_party.item_number($data_weapons[@params[0]]) - difference
  248.     return if amount == 0 || $game_switches[Galv_Mpop::DISABLE_SWITCH]
  249.     psound(amount)
  250.     $game_map.popup(0,:weapon,@params[0],amount)
  251.   end
  252.    
  253.   alias galv_map_pop_gi_command_128 command_128
  254.   def command_128
  255.     difference = $game_party.item_number($data_armors[@params[0]])
  256.     galv_map_pop_gi_command_128
  257.     amount = $game_party.item_number($data_armors[@params[0]]) - difference
  258.     return if amount == 0 || $game_switches[Galv_Mpop::DISABLE_SWITCH]
  259.     psound(amount)
  260.     $game_map.popup(0,:armor,@params[0],amount)
  261.   end
  262.    
  263.   def popup(target,item_type,item_id,amount)
  264.     $game_map.popup(target,item_type,item_id,amount)
  265.   end
  266. end # Game_Interpreter
复制代码
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
50
在线时间
184 小时
注册时间
2011-3-2
帖子
65
4
 楼主| 发表于 2014-8-17 20:28:08 | 只看该作者
tseyik 发表于 2014-8-17 20:19
用這果文字比較好看

这个我的游戏脚本比较多。。。如果可以把我发的脚本修改的话。。。。感激不尽

点评

把 出错处两遍的url去掉  发表于 2014-8-17 20:34
123行[url=home.php?mod=space&uid=2631396]@character[/url] = target 改成@character = target  发表于 2014-8-17 20:34
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
50
在线时间
184 小时
注册时间
2011-3-2
帖子
65
5
 楼主| 发表于 2014-8-17 20:29:14 | 只看该作者
taroxd 发表于 2014-8-17 20:07
103行前面加一句:三个参数分别改为对应的数字

要使用 \C[n] 需要进行一些坐标的计算,而我比较懒 ...

帮帮忙好不好啊{:2_264:}

点评

把104行的 draw_text(...) 改为 draw_text_ex(x, 0, @namepop) 。其中 x 坐标值需要自行计算。当然你填 0 也没什么问题,不过就没有居中的效果了  发表于 2014-8-17 20:33
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
50
在线时间
184 小时
注册时间
2011-3-2
帖子
65
6
 楼主| 发表于 2014-8-17 20:41:17 | 只看该作者
taroxd 发表于 2014-8-17 20:07
103行前面加一句:三个参数分别改为对应的数字

要使用 \C[n] 需要进行一些坐标的计算,而我比较懒 ...

错误:方法未定义。。。。

点评

嗯抱歉,是我搞错了。这样的话要用颜色控制符就不只是计算坐标的问题了。所以我就更加懒得帮忙了  发表于 2014-8-17 20:50
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
50
在线时间
184 小时
注册时间
2011-3-2
帖子
65
7
 楼主| 发表于 2014-8-17 20:54:56 | 只看该作者
taroxd 发表于 2014-8-17 20:07
103行前面加一句:三个参数分别改为对应的数字

要使用 \C[n] 需要进行一些坐标的计算,而我比较懒 ...

好吧好吧,那麻烦你告诉我tseyik发的脚本怎么使用- -
我翻译了英文还是不会用。。
谢了哈

点评

调用事件脚本 popup(target,type,id,amount),参数的意义见注释  发表于 2014-8-17 21:18
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
50
在线时间
184 小时
注册时间
2011-3-2
帖子
65
8
 楼主| 发表于 2014-8-17 21:24:57 | 只看该作者
taroxd 发表于 2014-8-17 20:07
103行前面加一句:三个参数分别改为对应的数字

要使用 \C[n] 需要进行一些坐标的计算,而我比较懒 ...

刚研究出来,想要并行处理让他当事件名显示,会出错,而且也改不了颜色。。还不如原来的好用。。

点评

用点评啦~\(≧▽≦)/~  发表于 2014-8-17 21:28
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
50
在线时间
184 小时
注册时间
2011-3-2
帖子
65
9
 楼主| 发表于 2014-8-17 21:29:31 | 只看该作者
taroxd 发表于 2014-8-17 20:07
103行前面加一句:三个参数分别改为对应的数字

要使用 \C[n] 需要进行一些坐标的计算,而我比较懒 ...

不会用点评啊。。你不帮我改那个脚本就结贴吧。。唉

点评

没注意看。。  发表于 2014-8-17 21:33
回复左边不就是点评  发表于 2014-8-17 21:33
回复 支持 反对

使用道具 举报

Lv4.逐梦者 (版主)

无限の剣制

梦石
0
星屑
10073
在线时间
5020 小时
注册时间
2013-2-28
帖子
5030

开拓者贵宾

10
发表于 2014-8-17 23:57:08 | 只看该作者
本帖最后由 VIPArcher 于 2014-8-18 02:20 编辑

使用方法名字栏备注
<namepop 字符串> 显示名字
\C[n] 更改颜色
例如\C[2]<namepop 喵呜喵5>
  1. #==============================================================================
  2. # ★ RGSS3_ネームポップ Ver1.1
  3. #==============================================================================
  4. =begin

  5. 作者:tomoaky
  6. webサイト:ひきも記 ([url]http://hikimoki.sakura.ne.jp/[/url])

  7. イベント名かイベント実行内容の先頭に『注釈』コマンドで
  8. <namepop 文字列>
  9. と記述してください。
  10. イベントキャラクターの頭上に文字列が表示されます。

  11. イベント名で指定した場合はイベント全ページに適用されますが、
  12. 優先度は注釈コマンドの方が高くなっています。

  13. 文字を消したい場合は <namepop none> としてください。

  14. 2011.12.16  Ver1.1
  15.   ・フォントの縁取り不透明度を設定項目に追加

  16. 2011.12.15  Ver1.0
  17.   公開

  18. =end

  19. #==============================================================================
  20. # □ 設定項目
  21. #==============================================================================
  22. module TMNPOP
  23.   FONT_SIZE = 14          # 字体大小
  24.   FONT_OUT_ALPHA = 255    # 字体轮廓透明度
  25. end

  26. #==============================================================================
  27. # ■ Game_Character
  28. #==============================================================================
  29. class Game_Character
  30.   #--------------------------------------------------------------------------
  31.   # ● 公開インスタンス変数
  32.   #--------------------------------------------------------------------------
  33.   attr_accessor :namepop                  # ポップアップテキスト
  34.   attr_accessor :namecolor
  35.   #--------------------------------------------------------------------------
  36. end

  37. #==============================================================================
  38. # ■ Game_Event
  39. #==============================================================================
  40. class Game_Event < Game_Character
  41.   #--------------------------------------------------------------------------
  42.   # ● イベントページの設定をセットアップ
  43.   #--------------------------------------------------------------------------
  44.   alias tmnpop_game_event_setup_page_settings setup_page_settings
  45.   def setup_page_settings
  46.     tmnpop_game_event_setup_page_settings
  47.     if @list
  48.       @namepop = $1 if /<namepop\s*(\S+?)>/i =~ @event.name
  49.       @namecolor = $1.to_i if /\\C\[(\d+?)\]/i =~ @event.name
  50.       @namecolor = 0 if @namecolor == nil ||
  51.       @namecolor < 0 || @namecolor >= 32
  52.       @list.each do |list|
  53.         if list.code == 108 || list.code == 408
  54.           @namepop = $1 if /<namepop\s*(\S+?)>/i =~ list.parameters[0]
  55.           @namecolor = $1.to_i if /\\C\[(\d+?)\]/i =~ list.parameters[0]
  56.         else
  57.           break
  58.         end
  59.       end
  60.     end
  61.   end
  62. end

  63. #==============================================================================
  64. # ■ Sprite_Character
  65. #==============================================================================
  66. class Sprite_Character < Sprite_Base
  67.   #--------------------------------------------------------------------------
  68.   # ● 解放
  69.   #--------------------------------------------------------------------------
  70.   alias tmnpop_sprite_character_dispose dispose
  71.   def dispose
  72.     dispose_namepop
  73.     tmnpop_sprite_character_dispose
  74.   end
  75.   #--------------------------------------------------------------------------
  76.   # ● フレーム更新
  77.   #--------------------------------------------------------------------------
  78.   alias tmnpop_sprite_character_update update
  79.   def update
  80.     tmnpop_sprite_character_update
  81.     update_namepop
  82.     if @character.namepop != @namepop
  83.       @namepop = @character.namepop
  84.       @namecolor = @character.namecolor
  85.       start_namepop
  86.     end
  87.   end
  88.   #--------------------------------------------------------------------------
  89.   # ○ namepopの開始
  90.   #--------------------------------------------------------------------------
  91.   def start_namepop
  92.     dispose_namepop
  93.     return if @namepop == "none" || @namepop == nil
  94.     @namepop_sprite = ::Sprite.new(viewport)
  95.     h = TMNPOP::FONT_SIZE + 4
  96.     @color_board = Window_Base.new(0,0,0,0)
  97.     @color_board.visible = false
  98.     @namepop_sprite.bitmap = Bitmap.new(h * 10, h)
  99.     @namepop_sprite.bitmap.font.size = TMNPOP::FONT_SIZE
  100.     @namepop_sprite.bitmap.font.out_color.alpha = TMNPOP::FONT_OUT_ALPHA
  101.     @namepop_sprite.bitmap.font.color = @color_board.text_color(@namecolor)
  102.     @namepop_sprite.bitmap.draw_text(0, 0, h * 10, h, @namepop, 1)
  103.     @namepop_sprite.ox = h * 5
  104.     @namepop_sprite.oy = h
  105.     update_namepop
  106.   end
  107.   #--------------------------------------------------------------------------
  108.   # ○ namepopの更新
  109.   #--------------------------------------------------------------------------
  110.   def update_namepop
  111.     if @namepop_sprite
  112.       @namepop_sprite.x = x
  113.       @namepop_sprite.y = y - height
  114.       @namepop_sprite.z = z + 200
  115.     end
  116.   end
  117.   #--------------------------------------------------------------------------
  118.   # ○ namepopの解放
  119.   #--------------------------------------------------------------------------
  120.   def dispose_namepop
  121.     if @namepop_sprite
  122.       @namepop_sprite.bitmap.dispose
  123.       @namepop_sprite.dispose
  124.       @color_board.dispose
  125.       @namepop_sprite = nil
  126.     end
  127.   end
  128. end
复制代码

评分

参与人数 1星屑 +1 梦石 +1 收起 理由
taroxd + 1 + 1 好吧我看错用法

查看全部评分

回复 支持 反对

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2024-9-23 07:21

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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