Navigation

    Fuze Arena Logo
    • Register
    • Login
    • Search
    • Categories
    • Recent
    • Popular
    • Users
    • Groups
    • Help
    • Discord

    Title Screen/Game Over Screen

    Coding
    3
    13
    815
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • pianofire
      pianofire Fuze Team last edited by pianofire

      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
      
      1 Reply Last reply Reply Quote 5
      • waldron
        waldron F last edited by

        where would you put this code at the beginning or can you pop it anywhere?

        pianofire 1 Reply Last reply Reply Quote 0
        • pianofire
          pianofire Fuze Team @waldron last edited by

          @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

          waldron 1 Reply Last reply Reply Quote 0
          • waldron
            waldron F @pianofire last edited by

            @pianofire thanks, so if i put it below my main game loop it would work

            pianofire 1 Reply Last reply Reply Quote 0
            • pianofire
              pianofire Fuze Team @waldron last edited by

              @waldron The loop ... repeat in this example is the main game loop

              waldron 1 Reply Last reply Reply Quote 0
              • waldron
                waldron F @pianofire last edited by

                @pianofire theight? Not thight? Right ?

                pianofire 1 Reply Last reply Reply Quote 1
                • pianofire
                  pianofire Fuze Team @waldron last edited by

                  @waldron Well spotted!

                  1 Reply Last reply Reply Quote 0
                  • waldron
                    waldron F last edited by

                    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?...

                    pianofire 1 Reply Last reply Reply Quote 0
                    • pianofire
                      pianofire Fuze Team @waldron last edited by

                      @waldron Sorry I don't understand the question. Can you send us a screenshot?

                      1 Reply Last reply Reply Quote 0
                      • waldron
                        waldron F last edited by

                        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 A

                        Running it with the amuse gothicmania sample project

                        pianofire 1 Reply Last reply Reply Quote 0
                        • pianofire
                          pianofire Fuze Team @waldron last edited by pianofire

                          @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
                          
                          waldron 1 Reply Last reply Reply Quote 1
                          • waldron
                            waldron F @pianofire last edited by

                            @pianofire perfect thanks

                            1 Reply Last reply Reply Quote 0
                            • First post
                              Last post