加入我们,或者,欢迎回来。
您需要 登录 才可以下载或查看,没有帐号?注册会员
x
我想插入图片用以表示HP和MP,然后我这么写
#-------------------------------------------------------------------------- # ● 释放 #-------------------------------------------------------------------------- def dispose super @vs.dispose @hp1.dispose @hp2.dispose @sp2.dispose if @sp2 !=nil @sp1.dispose if @sp1 !=nil end #-------------------------------------------------------------------------- # ● 刷新 #-------------------------------------------------------------------------- def refresh self.contents.clear self.contents.font.size = 18 @item_max = 1 self.contents.font.bold = false self.contents.font.color = Color.new(0,0, 0, 255) @vs=Sprite.new @vs.bitmap=Bitmap.new("Graphics/Pictures/VS.png") @vs.x=295 @vs.y=120 @vs.z=200 self.contents.font.color =Color.new(0,0, 0, 255) draw_HP1(@actor, 0, 24) draw_SP1(@actor, 0, 48) if @actor.maxsp>0 draw_HP2(@enemy, 320, 24) draw_SP2(@enemy, 320, 48) if @enemy.maxsp>0 end def draw_HP1(actor,x, y, w1=100) @hp1=Sprite.new @hp1.bitmap=Bitmap.new("Graphics/Pictures/HP.png") @hp1.x=96 @hp1.y=204 @hp1.z=200 end
#--------------------------------------------------------------------------
# ● 释放
#--------------------------------------------------------------------------
def dispose
super
@vs.dispose
@hp1.dispose
@hp2.dispose
@sp2.dispose if @sp2 !=nil
@sp1.dispose if @sp1 !=nil
end
#--------------------------------------------------------------------------
# ● 刷新
#--------------------------------------------------------------------------
def refresh
self.contents.clear
self.contents.font.size = 18
@item_max = 1
self.contents.font.bold = false
self.contents.font.color = Color.new(0,0, 0, 255)
@vs=Sprite.new
@vs.bitmap=Bitmap.new("Graphics/Pictures/VS.png")
@vs.x=295
@vs.y=120
@vs.z=200
self.contents.font.color =Color.new(0,0, 0, 255)
draw_HP1(@actor, 0, 24)
draw_SP1(@actor, 0, 48) if @actor.maxsp>0
draw_HP2(@enemy, 320, 24)
draw_SP2(@enemy, 320, 48) if @enemy.maxsp>0
end
def draw_HP1(actor,x, y, w1=100)
@hp1=Sprite.new
@hp1.bitmap=Bitmap.new("Graphics/Pictures/HP.png")
@hp1.x=96
@hp1.y=204
@hp1.z=200
end
但是当战斗结束时,HP,VS等图片要过一会才会消除,是我写的不对吗? |