Title Screen/Game Over Screen
-
Your main loop can just call the relevant functions e.g.:
screen = 0 loop clear() c = controls(0) screen = c.a // Press the A key to change screen if screen == 0 then screen0() endif if screen == 1 then screen1() endif update() repeat function screen0() printat(twidth() / 2, theight() /2, "Screen 0") return void function screen1() printat(twidth() / 2, theight() /2, "Screen 1") return void
-
where would you put this code at the beginning or can you pop it anywhere?
-
@waldron it's up to you really any code outside of the functions will be executed in turn. I prefer to have my main program loop at the top and the functions below but it is a matter of choice
-
@pianofire thanks, so if i put it below my main game loop it would work
-
@waldron The loop ... repeat in this example is the main game loop
-
@pianofire theight? Not thight? Right ?
-
@waldron Well spotted!
-
Ok iv put my code in, where do I put the functions,
Function screen0()
And
Function screen1()
Figure I need something in the brackets maybe?... -
@waldron Sorry I don't understand the question. Can you send us a screenshot?
-
I'll send them later, but at the minute I'm
Running the game but gos to a black screen with screen0, then screen1 when I press ARunning it with the amuse gothicmania sample project
-
@waldron That's what it is supposed to do. It is only an example to show how you could to have multiple screens. You will probably want something more like this:
screen = 0 loop clear() c = controls(0) if screen == 0 then titleScreen() // check for start button press and set screen = 1 endif if screen == 1 then gameScreen() // if game over set screen = 2 endif if screen == 2 then gameOverScreen() // check for button press and set screen = 0 endif update() repeat function titleScreen() // draw title screen here return void function gameScreen() // draw game screen here return void function gameOverScreen() // draw game over screen here return void
-
@pianofire perfect thanks