|
发表于 2007-10-4 13:46:59
|
显示全部楼层
写成脚本,使用时再去调用...
实例化一次
@hpbar = Hpbar.new(2, @event_id)
然后@hpbar.update到死
最后dispose消除掉- class Hpbar
- def initialize(actor_id, event_id)
- @id = actor_id
- @event_id = event_id
- @hp = $game_actors[2].hp
- @hpbar = Sprite.new
- @hpbar.bitmap = Bitmap.new(32, 8)
- @hpbar.ox=16
- @hpbar.oy=4
- @hpbar.z = 9999
- end
- def update
- @hpbar.bitmap.fill_rect(0,0,32,8,Color.new( 0, 0, 0, 255))
- @hpbar.bitmap.fill_rect(1,1,30,6,Color.new( 255, 255, 255, 255))
- @hpbar.bitmap.fill_rect(2,2,28,4,Color.new( 50, 150, 150, 255))
- @hpbar.bitmap.fill_rect(3,3,26,2,Color.new( 25, 50, 50, 255))
- w = 26 * $game_actors[@id].hp / $game_actors[@id].maxhp
- @hpbar.bitmap.fill_rect(3,3,w,2,Color.new(50, 200, 200, 255))
- @hpbar.x=$game_map.events[@event_id].screen_x
- @hpbar.y=$game_map.events[@event_id].screen_y-64
- @hpbar.update
- end
- end
复制代码
事件脚本,呃,那么短写进去也很难看吧...角色一多修改copy起来也麻烦吧~ |
|