def damage(value, critical) critical = true if value != "Miss" if value >= 0 locy = 0 else value *= -1 locy = 26 end # 数値から桁数を取得 dgt = get_digits(value) # 数値を桁数分に分けて1バイトずつ取得 val_digits(value, dgt) locx = 0 # ダメージの表示サイズを取得 for i in 0..dgt locx += DMG_PICS[@digit[i]] end # ダメージ表示位置を中央に。 locx = (160 - locx) / 2 else # ダメージ表示位置を中央に。 locx = (160 - 77) / 2 end dispose_damage if value.is_a?(Numeric) damage_string = value.abs.to_s else damage_string = value.to_s end bitmap = Bitmap.new(160, 48) dmg = RPG::Cache.picture("rx_damage.png") if value != "Miss" for i in 0..dgt bitmap.blt(locx, 21, dmg, Rect.new(DMG_LOCATES[@digit[i]], locy, DMG_PICS[@digit[i]], 26)) locx += DMG_PICS[@digit[i]] end else bitmap.blt(locx, 21, dmg, Rect.new(0, 78, 77, 26)) end if critical # ダメージ表示位置を中央に。 locx = (160 - 91) / 2 bitmap.blt(locx, 0, dmg, Rect.new(77, 78, 91, 21)) end @_damage_sprite = ::Sprite.new(self.viewport) @_damage_sprite.bitmap = bitmap @_damage_sprite.ox = 80 @_damage_sprite.oy = 20 @_damage_sprite.x = self.x @_damage_sprite.y = self.y - self.oy / 2 @_damage_sprite.z = 3000 @_damage_duration = 40 $status_update = true end