Posted: 4th Sep 2011 22:49
Hi! Why can't I define the width and height of virtual buttons independently? Just a square size... it makes it hard to make a virtual button that says "Resume Game" when it also will have to be as high as the text is long...

Is there a good way to make a sprite into a button you can press with the mouse, or your finger? I am making a game framework, with pause, menu, quit, resume, credits and intro screens that I can use for any game I will make. All the "booring" stuff that goes around a game. This way I can more easily finish a game, since all the booring parts are predefined in the framework
Posted: 5th Sep 2011 0:51
Load up the example file on Input>HittingSprite.

That will give you most of what you need to make your own button.
Posted: 5th Sep 2011 4:21
I made my virtual buttons invisible and put the graphics for it on the background image.
I only use 2 virtual buttons so far on my board game.
One is for the help (?) and the other the exit (x) with the (x) serving a double as the exit for the help screen too.
I put in a simple y/n confirmation for the exit for the app itself.

The size didn't matter much for those buttons since they are at the top of the screen anyway.
I made the diameter the same as the width of the graphic then made sure the bottom was right.
So, if you click just above it then it registers the click, but that is okay for what I am using them for.
If you use a round graphic for the button then it works much better than using squares or rectangles.

Another thought might be to use multiple buttons for the rectangle. (see attached image)
I haven't tried this method yet, but it should work.
The only thing to keep in mind is the 12 button limit on the screen at the same time.
Posted: 5th Sep 2011 11:20
Thanks Rich, I'll check that out when I get home from work. I wonder what happens if the button is placed over other sprites, will it register the one with the lesser depth value first?

CE, that was a very creative way to get it done, with the multiple buttons, wow, your smart I like your way of thinking out of the box.