I’m making a hunting game where you can go duck hunting, bear hunting and deer hunting. I haven’t had much practice with menu screens. What would be a good way to make a menu screen to do this so you can click on one of the options to play that part of the game?
@Andrewsimpson4 See this link for starters. The are several others if this doesn’t help.
http://twolivesleft.com/Codea/Talk/discussion/3299/menu-screen#Item_3
It helps but where do I put the draw code for each of the game and where do I put the setup for each game? @dave1707
@Andrewsimpson4 You would have a setup() and draw() for each game. Here’s a simple example. You would set game1, game2, or game3 to true using the menu. It can also be done using state code or a table.
function setup()
if game1 then
setup1()
end
if game2 then
setup2()
end
if game3 then
setup3()
end
end
function setup1()
end
function setup2()
end
function setup3()
end
function draw()
background(40, 40, 50)
if game1 then
draw1()
end
if game2 then
draw2()
end
if game3 then
draw3()
end
end
function draw1()
background(40, 40, 50)
end
function draw2()
background(40, 40, 50)
end
function draw3()
background(40, 40, 50)
end
@Andrewsimpson4 Yes. You need to seperate the code for each game. That might mean seperate draw(), touch(), setup(), etc. Depending on the amount of code, you either need to seperate the functions or just different game sections in each of the functions. That will depend on the complexity of each game. I can’t tell you the best way because that will depend on how you code.
Ok. Every time I do this it comes up with errors saying saying it can’t call stuff from the function setup @dave1707
@Andrewsimpson4 Without seeing your code, I can’t help. If your code isn’t too big or you don’t mind posting it, that will help me see what’s wrong. Or if you just want to send me a copy of your code, just tap on my name. In the upper left of the page will be a line of text that says, “send dave1707 a message”. Tap on that and it will open a message box to send me stuff.
or, I have a game called “Tilt Island” that utilizes a simpler menu style, if you want to try that out.