- 注册时间
- 2010-1-3
- 最后登录
- 2010-11-20
④见习
腿神姐真的很温柔&
- 积分
- 408
|
发表于 2010-1-18 20:31:48
|
显示全部楼层
- class Sprite_Character
- alias old_initialize initialize
- def initialize(a,b)
- @hpspsprite = Sprite.new(a)
- @hpspsprite.bitmap = Bitmap.new(160, 100)
- @hpspsprite.z = 0
- @hp = 0
- @sp = 0
- old_initialize(a,b)
- end
- def dispose
- super
- @hpspsprite.bitmap.dispose
- @hpspsprite.dispose
- end
- alias :old_update :update
- def update
- old_update
- @hpspsprite.x = self.x-80
- @hpspsprite.y = self.y-80
- return if @character.id == 0
- event = $game_map.events[@character.id]
- return if event.list[0].code != 108
- return if event.list[0].parameters[0] != "敌人"
- @sp = event.list[3].parameters[0].to_i
- @hp = event.list[4].parameters[0].to_i
- @maxhp = event.list[5].parameters[0].to_i
- @maxsp = event.list[6].parameters[0].to_i
- @hpspsprite.bitmap.clear
- width = 40
- x = 60
- y = 55
- @hpspsprite.bitmap.fill_rect(x-1, y+27, width+2,6, Color.new(255,255,255,200))
- wss = width * @hp / [@maxhp].max
- @hpspsprite.bitmap.fill_rect(x, y+28, wss,1, Color.new(255, 96, 96, 255))
- @hpspsprite.bitmap.fill_rect(x, y+29, wss,1, Color.new(255, 0, 0, 255))
- @hpspsprite.bitmap.fill_rect(x, y+30, wss,1, Color.new(128, 0, 0, 255))
- @hpspsprite.bitmap.fill_rect(x, y+31, wss,1, Color.new(0, 0, 0, 255))
- width = 40
- x = 60
- y = 60
- @hpspsprite.bitmap.fill_rect(x-1, y+27, width+2,6, Color.new(0, 0, 0, 255))
- wss = width * @sp / [@maxsp,1].max
- @hpspsprite.bitmap.fill_rect(x, y+28, wss,1, Color.new(128, 255, 255, 255))
- @hpspsprite.bitmap.fill_rect(x, y+29, wss,1, Color.new(0, 255, 255, 255))
- @hpspsprite.bitmap.fill_rect(x, y+30, wss,1, Color.new(0, 192, 192, 255))
- @hpspsprite.bitmap.fill_rect(x, y+31, wss,1, Color.new(0, 128, 128, 255))
- @sp = $game_party.actors[0].sp
- @hp = $game_party.actors[0].hp
- @hpspsprite.bitmap.clear
- width = 40
- x = 60
- y = 55
- @hpspsprite.bitmap.fill_rect(x-1, y+27, width+2,6, Color.new(0, 0, 0, 255))
- wss = width * @hp / [$game_party.actors[0].maxhp,1].max
- @hpspsprite.bitmap.fill_rect(x, y+28, wss,1, Color.new(255, 96, 96, 255))
- @hpspsprite.bitmap.fill_rect(x, y+29, wss,1, Color.new(255, 0, 0, 255))
- @hpspsprite.bitmap.fill_rect(x, y+30, wss,1, Color.new(128, 0, 0, 255))
- @hpspsprite.bitmap.fill_rect(x, y+31, wss,1, Color.new(0, 0, 0, 255))
- width = 40
- x = 60
- y = 60
- @hpspsprite.bitmap.fill_rect(x-1, y+27, width+2,6, Color.new(0, 0, 0, 255))
- wss = width * @sp / [$game_party.actors[0].maxsp,1].max
- @hpspsprite.bitmap.fill_rect(x, y+28, wss,1, Color.new(128, 255, 255, 255))
- @hpspsprite.bitmap.fill_rect(x, y+29, wss,1, Color.new(0, 255, 255, 255))
- @hpspsprite.bitmap.fill_rect(x, y+30, wss,1, Color.new(0, 192, 192, 255))
- @hpspsprite.bitmap.fill_rect(x, y+31, wss,1, Color.new(0, 128, 128, 255))
- end
- end
复制代码 做了下修改,你先看,有问题问我。 |
|