class CommandMenuButtons < BitmapSprite
def initialize(index=0,mode=0,viewport=nil)
super(503,95,viewport)
self.x=Graphics.width-503
self.y=Graphics.height-95
@mode=mode
@buttonbitmap=AnimatedBitmap.new(_INTL("Graphics/Pictures/battleCommandButtons"))
refresh(index,mode)
end
def dispose
@buttonbitmap.dispose
super
end
def update(index=0,mode=0)
refresh(index,mode)
end
def refresh(index,mode=0)
self.bitmap.clear
@mode=mode
cmdarray=[0,2,1,3]
case @mode
when 1
cmdarray=[0,2,1,4] # Use "Call"
when 2
cmdarray=[5,7,6,3] # Safari Zone battle
when 3
cmdarray=[0,8,1,3] # Bug Catching Contest
end
for i in 0...4
next if i==index
x=((i%2)==0) ? 0 : 247
y=((i/2)==0) ? 6 : 44
self.bitmap.blt(x,y,@buttonbitmap.bitmap,Rect.new(0,cmdarray[i]*44,247,44))
end
for i in 0...4
next if i!=index
x=((i%2)==0) ? 0 : 247
y=((i/2)==0) ? 6 : 44
self.bitmap.blt(x,y,@buttonbitmap.bitmap,Rect.new(247,cmdarray[i]*44,247,44))
end
end
end