• Just a reminder that providing specifics on, sharing links to, or naming websites where ROMs can be accessed is against the rules. If your post has any of this information it will be removed.
  • Ever thought it'd be cool to have your art, writing, or challenge runs featured on PokéCommunity? Click here for info - we'd love to spotlight your work!
  • Our weekly protagonist poll is now up! Vote for your favorite Trading Card Game 2 protagonist in the poll by clicking here.
  • Welcome to PokéCommunity! Register now and join one of the best fan communities on the 'net to talk Pokémon and more! We are not affiliated with The Pokémon Company or Nintendo.

Battle Command Buttons Position

MarvinLock

Starting with Pkmn Essentials!
  • 50
    Posts
    11
    Years
    I managed to find out how to stretch battle command buttons but I have a little problem. The lower buttons (Pokemon, Run) appear over the other two (Fight, Bag). I've being trying to find a way to fix it but I can't. Can anyone help?

    [PokeCommunity.com] Battle Command Buttons Position


    Thanks!
     
    Greek, this reminds me school. lol
    Anyway, please post the code you're using.
     
    Greek, this reminds me school. lol
    Anyway, please post the code you're using.

    Haha. Yeap, I'm Greek.
    Here is the code:

    [PokeCommunity.com] Battle Command Buttons Position

    [PokeCommunity.com] Battle Command Buttons Position



    Code:
    Code:
    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
     
    The line that determines the y coordinate for each button is this one:

    Code:
    y=((i/2)==0) ? 6 : 44
    Just change those values, and possibly use thinner button graphics, to make them not overlap.

    The code that determines how tall a button is is:

    Code:
    self.bitmap.blt(x,y,@buttonbitmap.bitmap,Rect.new(0,cmdarray[i]*[COLOR=Red]44[/COLOR],247,[COLOR=Red]44[/COLOR]))
    They're 44 pixels tall. Make sure to change it in both parts of the code (one's for unselected buttons and the other is for selected buttons).
     
    The line that determines the y coordinate for each button is this one:

    Code:
    y=((i/2)==0) ? 6 : 44
    Just change those values, and possibly use thinner button graphics, to make them not overlap.

    The code that determines how tall a button is is:

    Code:
    self.bitmap.blt(x,y,@buttonbitmap.bitmap,Rect.new(0,cmdarray[i]*[COLOR=Red]44[/COLOR],247,[COLOR=Red]44[/COLOR]))
    They're 44 pixels tall. Make sure to change it in both parts of the code (one's for unselected buttons and the other is for selected buttons).

    Thanks once again Maruno!
     
    Back
    Top