I made my own little math algorithm (spelling issues, I know) for that. Here's how:
1. First, find the X and Y (horiz and vert) of the sprite you are centering.
2. Divide the X of the button in half, and in your head, call that NX. Here:
XCenter = 128 - NX
XCenter is the X you should put the sprite at to PERFECTLY center it.
3. Now for the Y. Divide the sprite's Y value in half and call it NY in your head. Then:
YCenter = 96 - NY
YCenter is then the Y value you need to use for perfect centering.
4. Now that the image is perfectly centered, let's handle the touching. Example:
FREESOUND = 1
while true do
if Stylus.Down() then
if Stylus.X() > 111 then
if Stylus.X() < 145 then
if Stylus.Y() > 79 then
if Stylus.Y() < 113 then
Somesound = Sound.LoadRaw( "YourRawHere.raw" )
Somesound:Play()
FREESOUND = 2
end
end
end
end
end
if Pads.Start() then
if FREESOUND == 2 then
Somesound:Free()
end
break
end
end
That would be what it would look like of the sprite was a 32*32 sprite. You have to make the values want greater than one less than where it starts, and less than where it ends + 1. But 32*32 is a reasonable size, so get a 32*32 button if you wanna save trouble.
There you go!