赞 | 0 |
VIP | 155 |
好人卡 | 9 |
积分 | 3 |
经验 | 15635 |
最后登录 | 2024-10-29 |
在线时间 | 412 小时 |
Lv2.观梦者 永遠神剣
- 梦石
- 0
- 星屑
- 339
- 在线时间
- 412 小时
- 注册时间
- 2009-8-16
- 帖子
- 1797
|
本帖最后由 Eienshinken 于 2009-11-9 01:08 编辑
这不是我写的脚本,是用SailCat大大的伤害美化脚本改的- #==============================================================================
- # 本脚本来自www.66RPG.com,使用和转载请保留此信息
- #==============================================================================
- # ============================================================================
- # 伤害效果美化 v1.0 by SailCat
- # ============================================================================
- # 脚本使用说明:
- # 1.使用时需要将Damage.png复制到你的游戏的Graphics/Pictures目录下
- # 2.Damage.png文件的格式:
- # 大小为180 x 96
- # (0, 0) - (179, 31)为伤害值的数字表,其中每个数字宽18,高32
- # (0, 32) - (179, 63)为回复值(伤害负值)的数字表,其中每个数字宽18,高32
- # (0, 64) - (89, 95)为会心一击标记的图画,长宽为90 x 32
- # (90, 64) - (179, 95)为未命中标记的图画,长宽为90 x 32
- # ============================================================================
- module RPG
- class Sprite < ::Sprite
- #--------------------------------------------------------------------------
- # ● 伤害值描画
- #--------------------------------------------------------------------------
- def damage(value, critical)
- # 释放伤害
- dispose_damage
- # 如果伤害值是数值
- if value.is_a?(Numeric)
- # 绝对值转为字符串
- damage_string = value.abs.to_s
- else
- # 转为字符串
- damage_string = value.to_s
- end
- # 初始化位图
- bitmap = Bitmap.new(180, 128)
- bitmap.font.name = "Arial Black"
- bitmap.font.size = 32
- # 伤害值是数值的情况下
- if value.is_a?(Numeric)
- # 分割伤害值字符串
- damage_array = damage_string.scan(/./)
- damage_x = 81 - damage_string.size * 9
- # 伤害值为负的情况下
- if value < 0
- # 调用回复数字表
- rect_y = 32
- else
- # 调用伤害数字表
- rect_y = 0
- end
- # 循环伤害值字符串
- for char in damage_array
- number = char.to_i
- # 显示伤害数字
- unless @battler.is_a?(Game_Enemy)
- bitmap.blt(damage_x, 32, RPG::Cache.picture("Damage"),
- Rect.new(number * 18, rect_y+32*3, 18, 32))
- else
- bitmap.blt(damage_x, 32, RPG::Cache.picture("Damage"),
- Rect.new(number * 18, rect_y, 18, 32))
- end
- # 后移一位
- damage_x += 18
- end
- # 伤害值不是数值的情况
- else
- # 如果伤害值不是 Miss
- unless value == "Miss"
- # 系统默认描画字符串
- bitmap.font.color.set(0, 0, 0)
- bitmap.draw_text(-1, 27, 162, 36, damage_string, 1)
- bitmap.draw_text(+1, 27, 162, 36, damage_string, 1)
- bitmap.draw_text(-1, 29, 162, 36, damage_string, 1)
- bitmap.draw_text(+1, 29, 162, 36, damage_string, 1)
- bitmap.font.color.set(255, 255, 255)
- bitmap.draw_text(0, 28, 162, 36, damage_string, 1)
- # Miss 的情况下
- else
- # 显示未击中图画
- bitmap.blt(36, 28, RPG::Cache.picture("Damage"), Rect.new(90, 64, 90, 32))
- end
- end
- # 会心一击标志打开的情况
- if critical
- # 显示会心一击图画
- bitmap.blt(36, 0, RPG::Cache.picture("Damage"), Rect.new(0, 64, 90, 32))
- end
- # 伤害值定位
- @_damage_sprite = ::Sprite.new(self.viewport)
- @_damage_sprite.bitmap = bitmap
- @_damage_sprite.ox = 81
- @_damage_sprite.oy = 20
- @_damage_sprite.x = self.x
- @_damage_sprite.y = self.y - self.oy / 2
- @_damage_sprite.z = 3000
- @_damage_duration = 40
- end
- end
- end
- #==============================================================================
- # 本脚本来自www.66RPG.com,使用和转载请保留此信息
- #==============================================================================
复制代码 |
|