赞 | 0 |
VIP | 84 |
好人卡 | 1 |
积分 | 1 |
经验 | 140542 |
最后登录 | 2016-5-2 |
在线时间 | 195 小时 |
Lv1.梦旅人
- 梦石
- 0
- 星屑
- 147
- 在线时间
- 195 小时
- 注册时间
- 2009-10-10
- 帖子
- 435
|
加入我们,或者,欢迎回来。
您需要 登录 才可以下载或查看,没有帐号?注册会员
x
我很郁闷...怎么别人写的脚本显示的数值都不卡?
但是我写的脚本会卡的呢?
不过在新的工程里的确不卡.
但在我的游戏里卡的不得了~- class Hp_Window < Window_Base
- def initialize
- super(-15, -16, 740, 580)
- self.contents = Bitmap.new(width - 32, height - 32)
- self.opacity = 0
- self.z = 998
- self.visible = true
- end
- #--------------------------------------------------------------------------
- # ● 刷新画面
- #--------------------------------------------------------------------------
- def update
- value_x = -188
- actor = $game_party.actors[0] #主角
- draw_2hp(actor, 209 + value_x, 8) #生命条
- system_picture(0,0)
- draw_hp_background(0 + value_x,0) # HP底图
- draw_mp_background(312 + value_x,8) # MP底图
- draw_hp(actor, 209 + value_x, 8) #生命条
- draw_mp(actor, 312 + value_x, 8) #能量条
- draw_map_exp(actor, 246 + value_x, 29) #经验条
- end
- #----------------------------------------------------------------------------
- # ● 显示文字
- #----------------------------------------------------------------------------
- def draw_2hp(actor,x,y)
- self.contents.clear
- self.contents.font.size = 11 # 文字的字号
- self.contents.draw_text(x+10, y, 410, 904, $game_party.item_number(1).to_s, 1)
- self.contents.draw_text(x+10, y, 488, 904, $game_party.item_number(2).to_s, 1)
- self.contents.draw_text(x+10, y, 566, 904, $game_party.item_number(3).to_s, 1)
- self.contents.draw_text(x+10, y, 644, 904, $game_party.item_number(4).to_s, 1)
- end
- #----------------------------------------------------------------------------
- # ● 底图
- #----------------------------------------------------------------------------
- def draw_hp_background(x,y)
- hp_background = RPG::Cache.picture("HPdi")
- hp_back = Rect.new(0, 0, hp_background.width, hp_background.height)
- self.contents.blt(x, y, hp_background, hp_back)
- end
- def system_picture(x,y)
- sy_picture = RPG::Cache.picture("system_picture")
- s_picture = Rect.new(0, 0, sy_picture.width, sy_picture.height)
- self.contents.blt(x, y, sy_picture, s_picture)
- end
- def draw_mp_background(x,y)
- hp_background = RPG::Cache.picture("MP")
- hp_back = Rect.new(0, 0, hp_background.width, hp_background.height)
- self.contents.blt(x, y, hp_background, hp_back)
- end
- #----------------------------------------------------------------------------
- # ● 生命条
- #----------------------------------------------------------------------------
- def draw_hp(actor,x,y)
- hp = RPG::Cache.picture("HP条")
- hp_w = hp.width * actor.hp / [actor.maxhp,1].max
- rect2 = Rect.new(0,0,hp_w,hp.height)
- self.contents.blt(x,y,hp,rect2)
- end #def HP
- #----------------------------------------------------------------------------
- # ● 能量条
- #----------------------------------------------------------------------------
- def draw_mp(actor,x,y)
- mp = RPG::Cache.picture("MP条")
- mp_w = mp.width * (actor.maxsp-actor.sp) / [actor.maxsp,1].max
- rect3 = Rect.new(0,0,mp_w,mp.height)
- self.contents.blt(x,y,mp,rect3)
- end #def MP
- #----------------------------------------------------------------------------
- # ● 描绘地图界面经验条
- #----------------------------------------------------------------------------
- def draw_map_exp(actor, x, y)
- bitmap = RPG::Cache.picture("EXP条")
- actor = $game_party.actors[0]
- if actor.nextexp != 0
- jisuan = actor.nowexp.to_f / actor.nextexp
- else
- jisuan = 1
- end
- if actor.level < 99 # 最大等级
- nw = bitmap.width * jisuan
- else
- nw = bitmap.width
- end
- src_rect = Rect.new(0, 0, nw, bitmap.height)
- self.contents.blt( x, y, bitmap, src_rect)
- end
- #==============================================================================
- # ■ Game_Actor
- #==============================================================================
- class Game_Actor
- #--------------------------------------------------------------------------
- # ● 获取目前经验
- #--------------------------------------------------------------------------
- def nowexp
- return @exp - @exp_list[@level]
- end
- #--------------------------------------------------------------------------
- # ● 下一等级还需的经验
- #--------------------------------------------------------------------------
- def nextexp
- return @exp_list[@level+1] > 0 ? @exp_list[@level+1] - @exp_list[@level] : 0
- end
- end
复制代码 |
|