def update
super
@frame = (@frame+1)%24
# Animate HP bar
if @animatingHP
if @currenthp<@endhp
@currenthp += [1,(@battler.totalhp/96).floor].max
@currenthp = @endhp if @currenthp>@endhp
elsif @currenthp>@endhp
@currenthp -= [1,(@battler.totalhp/96).floor].max
@currenthp = @endhp if @currenthp<@endhp
end
@animatingHP = false if @currenthp==@endhp
refresh
end
# Animate Exp bar
if @animatingEXP
if !@showexp
@currentexp = @endexp
elsif @currentexp<@endexp # Gaining Exp
if @endexp>=192 ||
@endexp-@currentexp>=192/4
@currentexp += 4
else
@currentexp += 2
end
@currentexp = @endexp if @currentexp>@endexp
elsif @currentexp>@endexp # Losing Exp
if @endexp==0 ||
@currentexp-@endexp>=192/4
@currentexp -= 4
elsif @currentexp>@endexp
@currentexp -= 2
end
@currentexp = @endexp if @currentexp<@endexp
end
refresh
if @currentexp==@endexp
if @currentexp==192
if @expflash==0
pbSEPlay("Pkmn exp full")
self.flash(Color.new(64,200,248),8)
@expflash = 8
else
@expflash -= 1
if @expflash==0
@animatingEXP = false
refreshExpLevel
end
end
else
@animatingEXP = false
end
end
end