We are about to switch to a new forum software. Until then we have removed the registration on this forum.
Hey all! I'm trying to create a simple game menu in my py.processing game, where I have options to view game instructions, a high score list and an option to start the game.
def draw():
if game.State == "Menu":
loadImage(path+'/background.png')
if 200<= mouseX <= 310 and 150 <= mouseY <= 170:
fill (255,0,0)
else:
fill(255)
text("Play the Game!",300,200)
text("View High Scores!",100,300)
text("How to Play",30,50)
elif game.state == "Play":
game.display()
elif game.state == "inputName":
text("Game Over! Save your score:",200,100)
text(game.name,300,200)
This is what I have so far. A menu displays just fine, but I can't give unique options to each feature. Any advice?
Answers
generic answer: you need to make buttons and then when the mouse is pressed in state Menu, check in which button the mouse has been pressed and set state accordingly with
game.state = "Play"
or so.The buttons are rects (can be invisible) that enclose the text "Play the Game!" and "View High Scores!" etc.
you have state and State - make sure, you use only state
this is in JAVA processing