I've looked at a few examples already but can't get it to work. I want a drop down menu to appear when a sprite is tapped. Here is my code for detecting the sprite being tapped (a Pause
button):
public boolean isTapped(Sprite image, int x, int y) {
return (x >= image.getX()
&& x <= image.getX() + image.getWidth()
&& y >= image.getY() && y <= image.getY()
+ image.getHeight());
}
@Override
public boolean touchDown(int screenX, int screenY, int pointer, int button) {
if(isTapped(pauseButtonImage, screenX, screenY)) {
// Make a drop-down menu appear below the sprite
}
return true;
}
I'm not entirely sure what to fill that if-statement with in order to get the drop-down menu. I've seen some examples online but they are somewhat unclear and always looks like there is way too much code than necessary.
All I want is a list
RETURN TO MENU
RESTART LEVEL
EXIT
Can anybody give me the steps I need to take to achieve this? Or perhaps point me to some relevant documentation. Would be highly appreciated.
0 comments:
Post a Comment