Project1
标题:
HP MP显示出现小数点
[打印本页]
作者:
黑米馒头
时间:
2015-2-2 19:32
标题:
HP MP显示出现小数点
貌似用了下面的脚本,HP和MP显示出现了小数点。如何去掉小数点呢。
#==============================================================================
# ■ JD_DL
#------------------------------------------------------------------------------
# 显示加点状态窗口。
#==============================================================================
class JD_DL < Window_Base
#--------------------------------------------------------------------------
# ● 初始化对像
# actor : 角色
#--------------------------------------------------------------------------
def initialize(actor)
super(320, 0, 330, 360)
self.contents = Bitmap.new(width - 32, height - 32)
self.contents.font.size = 16
@actor = actor
# ** 文字高
# ** 可以放在refresh里 实时控制
@sh = 32
self.opacity = 0
refresh
end
#--------------------------------------------------------------------------
# ● 刷新
#--------------------------------------------------------------------------
def refresh
self.contents.clear
self.contents.font.name = (["宋体","黑体"])
# 属性
draw_v(-73, 144, 0) # 气血
draw_v(-73, 144+28, 1) # 法力
# 潜力描绘
self.contents.font.color = Color.new(255, 255, 255, 255)
str = ""#潜力"
self.contents.draw_text(160, 28*4-1, sw(str), @sh, str)
cx = sw(str)
# 潜能点
self.contents.draw_text(102, 28*4-3, self.width - 40, @sh, $point.to_s, 1)
# ** 返回字符串的宽度
def sw(s)
return self.contents.text_size(s).width
end
# ** HP AND SP 描绘
def draw_v(x, y, type)
case type
when 0
word = ""#$data_system.words.hp # HP
dl = @actor.hp
max = @actor.maxhp
temp = $temp_hp
when 1
word = ""#$data_system.words.sp # MP
dl = @actor.sp
max = @actor.maxsp
temp = $temp_sp
else
return
end
self.contents.font.color = Color.new(255, 255, 255, 255)
# ** 用语
str = word
self.contents.draw_text(x, y, sw(str), @sh, str)
self.contents.font.color = Color.new(255, 255, 255, 255)
# ** 基本值
cx = sw(str)
#str = dl.to_s# + " "#"/"
self.contents.draw_text(x + cx + 23, y, self.width - 40, 32, "/",1)
self.contents.draw_text(x + cx - 127, y, self.width - 40, @sh, dl.to_s, 2)
cx += sw(str)
# ** 调整颜色
if temp > 0
self.contents.font.color = Color.new(82, 226, 82, 255) # 绿色
else
self.contents.font.color = Color.new(255, 255, 255, 255)
end
# ** 基本值 max
str = (max + temp).to_s
self.contents.draw_text(x + cx + 175, y, self.width - 40, @sh, str)
cx += sw(str)
end
复制代码
作者:
chd114
时间:
2015-2-3 03:49
把73行dl后面和to_s之前加上to_i
欢迎光临 Project1 (https://rpg.blue/)
Powered by Discuz! X3.1