I did something very similar to this just yesterday, although I was adding on 8 new badges instead of moving them around.
Find line 58 in "PokemonTrainerCard". It should look something like the first half of this:
Code:
x=29
for i in 0...4
if $Trainer.badges[i]
imagePositions[imagePositions.length]=[
"Graphics/Pictures/badges.png",x,313,i*32,0,32,32
]
if $Trainer.badges[i+4]
imagePositions[imagePositions.length]=[
"Graphics/Pictures/badges.png",x,387,128+i*32,0,32,32
]
end
end
x+=74
end
Copy and paste this over what's there. This should give you a grid, 4 across and 2 down, of your 8 badges. Some of the numbers will need changing, though, so read on. The numbers you should be looking at are noted by bullet points below (but note that not all of them are meant to be changed!).
- Right at the top, the "x=29" determines how far right the entire grid of badges goes. It's counted from the left side of the screen (x=0).
Next is each of the two rows. The same notes apply to both of them, so I'll just talk about the first row (the first 4 badges):
x,313,i*32,0,32,32
- x - Leave this first number alone. That's calculated for you.
- 313 - This is how far down from the top edge the badges are located. Change this to move the row of badges up and down the screen. Note that you will need to change this number for the second row to a different number (a bigger number) for the second 4 badges to appear below the first 4. Make the number difference equal to that of x+ (see below) to keep everything looking square.
- i*32 - Leave it alone. It tells the game how far along in the badges.png file it should start looking for the current badge it's working on.
- 0 - The same goes for this, except that it looks how far down in the png file it is instead (i.e. 0 means it's at the top).
- 32, 32 - These two numbers tell the game how big a badge is, and thus what size area it should take from badges.png (assuming the coordinates of the top left of the square are the coordinates above that I told you to leave alone).
And finally:
- At the bottom of the code is "x+=74". This number is the horizontal separation between the top left corners of adjacent badges. It is also equal to the separation between adjacent badges PLUS the width of a badge. Make this number bigger to increase the horizontal gap between badges, and make it smaller to squash them closer together. (You'll probably end up making it smaller, since "74" is a number I'm using in my game that has a big resolution.)
Whatever you make "x+" equal, make sure that the difference between "
313 and
387" (as they are in my code) is the same value. This keeps the badges all nice and square.
Have an experiment with the numbers (I suppose you'll
have to, really) to see how they all work, and to position the badges where you want them to go.
---------------------------------------------------------------------------------------------
I actually have a problem of my own. I'm looking into the PokéGear's regional map, and I want to move the map's position from 0,0 to 80,80 (so it would be center in a 640x480 screen - my map is 320x240, so the numbers work). However, look as I might, I can't find any line that sets the position of "Map.png". How can I move it?
I'm just looking for how to change the position of the picture itself. I've already done the "hard" part of moving the points and scrolling area and whatnot.