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

Project1

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

[有事请教] 關於傷害數字圖片呈現一上一下的顯示方式設定

[复制链接]

Lv2.观梦者

梦石
0
星屑
344
在线时间
292 小时
注册时间
2013-6-1
帖子
123
跳转到指定楼层
1

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

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

x
本帖最后由 e900003 于 2025-3-29 20:25 编辑

如題,

就是像冒險島的傷害數字呈現的一上一下的顯示方式
如圖所示


但不知道要從哪裡修改

這是正在使用的腳本
RUBY 代码复制
  1. # [XP] 傷害字型自定義顯示
  2. # [url]http://members.jcom.home.ne.jp/cogwheel/[/url]
  3.  
  4. class Scene_Battle
  5.   alias :main_damage :main
  6.   def main
  7.     for path in ["num", "critical", "miss"]
  8.       RPG::Cache.numeric(path)
  9.     end
  10.     main_damage
  11.   end
  12. end
  13.  
  14. module RPG
  15.   class Sprite < ::Sprite
  16.     WIDTH = 23                  # 傷害字型寬度
  17.     HEIGHT = 20                 # 傷害字型高度
  18.     def damage(value, critical)
  19.       dispose_damage
  20.       if value.is_a?(Numeric)
  21.         damage_string = value.abs.to_s
  22.       else
  23.         damage_string = value.to_s
  24.       end
  25.       if value.is_a?(Numeric)
  26.         damage_string = value.abs.to_s
  27.       else
  28.         damage_string = value.to_s
  29.       end
  30.       if value.is_a?(Numeric)
  31.         if value >= 0
  32.           if critical
  33.             d_bitmap = draw_damage(value, 1)
  34.           else
  35.             d_bitmap = draw_damage(value, 0)
  36.           end
  37.         else
  38.           d_bitmap = draw_damage(value, 2)
  39.         end
  40.       else
  41.         d_bitmap = draw_damage(value, 3)
  42.       end
  43.       @_damage_sprite = ::Sprite.new
  44.       @_damage_sprite.bitmap = d_bitmap
  45.       @_damage_sprite.ox = d_bitmap.width / 2
  46.       @_damage_sprite.oy = d_bitmap.height / 2
  47.       @_damage_sprite.x = self.x + self.viewport.rect.x
  48.       @_damage_sprite.y = self.y - self.oy / 2 + self.viewport.rect.y
  49.       @_damage_sprite.z = 3000
  50.       @_damage_duration = 40
  51.     end
  52.     def draw_damage(value, element)
  53.       width = 0
  54.       if value.is_a?(Numeric)
  55.         value = value.abs
  56.         fig = value.to_s.size - 1
  57. #==========================傷害顯示的樣式============================
  58.       if $game_switches[3628] == false
  59.          file = RPG::Cache.numeric("num") #
  60.        else
  61.          file = RPG::Cache.numeric("num_actor") #角色受傷害用的傷害字型
  62.        end
  63. #===========================自定義數字間隔距離1==========================
  64.        if $game_switches[3628] == false
  65.            d_width = WIDTH * fig + file.rect.width / 10  #
  66.         else
  67.           d_width = WIDTH * fig + file.rect.width / 10  #角色受傷害用的傷害字型
  68.         end
  69. #==========================爆擊特效顯示===============================
  70.         if element == 1
  71.          if $game_switches[3628] == false
  72.            critical = RPG::Cache.numeric("critical") #
  73.          else
  74.            critical = RPG::Cache.numeric("critical") #角色受傷害用的傷害字型
  75.          end
  76. #=======================================================================
  77.           d_width = [d_width, critical.rect.width].max
  78.           d_bitmap = Bitmap.new(d_width, HEIGHT + file.rect.height / 3)
  79.           d_x = (d_width - critical.rect.width) / 2
  80.           d_bitmap.blt(d_x, 0, critical, critical.rect)
  81.         else
  82.           d_bitmap = Bitmap.new(d_width, HEIGHT + file.rect.height / 3)
  83.        end
  84. #=========================自定義數字間隔距離2===========================
  85.        if $game_switches[3628] == false
  86.          d_x = ((d_width) - (WIDTH * fig + file.rect.width / 10)) / 2  #
  87.        else
  88.          d_x = ((d_width) - (WIDTH * fig + file.rect.width / 10)) / 2  #角色受傷害用的傷害字型
  89.        end
  90. #======================================================================
  91.         while fig >= 0
  92.           d_bitmap.blt(d_x, HEIGHT, file, Rect.new((value / (10 ** fig)) *
  93.             file.rect.width / 10, element * file.rect.height / 3,
  94.             file.rect.width / 10, file.rect.height / 3))
  95. #=========================自定義數字間隔距離3==========================
  96.          if $game_switches[3628] == false
  97.             d_x += WIDTH  #
  98.            else
  99.             d_x += WIDTH  #角色受傷害用的傷害字型
  100.          end
  101. #======================================================================
  102.           value %= 10 ** fig
  103.           fig -= 1
  104.         end
  105.       else
  106.         case value
  107.         when ""
  108.           return Bitmap.new(1, 1)
  109. #===========================傷害未命中顯示=============================
  110.         when "Miss"
  111.         if $game_switches[3628] == false
  112.           file = RPG::Cache.numeric("miss").dup #
  113.         else
  114.           file = RPG::Cache.numeric("miss_actor").dup #角色受傷害用的傷害字型
  115.         end
  116. #======================================================================
  117.         else
  118.           file = RPG::Cache.numeric(value).dup
  119.         end
  120.         d_bitmap = file
  121.       end
  122.       return d_bitmap
  123.     end
  124.   end
  125.   module Cache
  126.     def self.numeric(filename)
  127.       self.load_bitmap("Graphics/DamageSkin/", filename)
  128.     end
  129.   end
  130. end
您需要登录后才可以回帖 登录 | 注册会员

本版积分规则

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

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

GMT+8, 2025-4-2 06:33

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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