Project1
标题:
如何在地图上显示主角头像,血,法,经验条?谢谢各位亲
[打印本页]
作者:
Denis
时间:
2012-12-29 12:29
标题:
如何在地图上显示主角头像,血,法,经验条?谢谢各位亲
如何在地图上显示主角头像,血,法,经验条?谢谢各位亲
作者:
羞射了
时间:
2012-12-29 14:15
在scene_map 内新建窗口,然后描绘角色的数值。具体怎么写可以参考游戏内自带的菜单类脚本就可以办到。
作者:
Denis
时间:
2012-12-29 17:05
表示脚本一个,谁能提供一个呢?谢谢啦
作者:
美丽晨露
时间:
2012-12-29 17:17
本帖最后由 美丽晨露 于 2012-12-29 17:25 编辑
有个脚本,不过要自己提供素材
否则会出错的
class Game_Actor < Game_Battler
def now_exp
return [url=home.php?mod=space&uid=13302]@exp[/url] - @exp_list[@level]
end
def next_exp
return @exp_list[@level+1] > 0 ? @exp_list[@level+1] - @exp_list[@level] : 0
end
end
class Sprite_Bar < Sprite
def initialize(v,actor)
super(v)
self.bitmap = RPG::Cache.picture("人物#{actor.id}")
self.visible = false
[url=home.php?mod=space&uid=95897]@actor[/url] = actor
refresh
end
def refresh
self.bitmap.clear
self.bitmap.dispose
self.bitmap = nil
bar = RPG::Cache.picture("人物#{@actor.id}")
self.bitmap = bar.dup
bitmap = RPG::Cache.picture("1")
hp_w = @actor.hp * bitmap.width / @actor.maxhp
rect = Rect.new(0, 0, hp_w,bitmap.height)
self.bitmap.blt(48, 3, bitmap, rect)
bitmap = RPG::Cache.picture("2")
hp_w = @actor.sp * bitmap.width / @actor.maxsp
rect = Rect.new(0, 0, hp_w,bitmap.height)
self.bitmap.blt(48, 16, bitmap, rect)
bitmap = RPG::Cache.picture("3")
if @actor.next_exp == 0
hp_w = @actor.now_exp
else
hp_w = @actor.now_exp * bitmap.width / @actor.next_exp
end
rect = Rect.new(0, 0, hp_w,bitmap.height)
self.bitmap.blt(48, 29, bitmap, rect)
# 3 16 29
@hp = @actor.hp
@sp = @actor.sp
@exp = @actor.now_exp
end
def update
super
self.visible = $game_switches[2]
return unless self.visible
refresh if @hp != @actor.hp || @sp != @actor.sp || @exp != @actor.now_exp
end
end
class Scene_Map
alias new_main main unless method_defined?("new_main")
alias new_update update unless method_defined?("new_update")
def main
@bar = []
@vie = []
for actor in $game_party.actors
v = Viewport.new(640-((actor.index+1) * 129), 0, 129, 45)
v.z += 1000
@bar.push(Sprite_Bar.new(v, actor))
@vie.push(v)
end
new_main
@bar.each{|bar|bar.dispose}
@vie.each{|vie|vie.dispose}
end
def update
@bar.each{|bar|bar.update}
new_update
end
end
复制代码
欢迎光临 Project1 (https://rpg.blue/)
Powered by Discuz! X3.1