Home‎ > ‎

Opening Screens

Opening Screens - Start ScreensIntroduction, Splash or Instructions
Splash screens are the first screens that show up when you start-up. They usually show the name of the game, your name as the creator of the game, the company name.

Sometimes their purpose is to give the user something to look at while the game loads up and sets up for a new game (initialize scores, timers, draw the first screen, start the game loop, set up the moving objects, etc)

There are usually 2 types of splash screens. One that is a Start screen with instructions on it or buttons for instructions, High Scores, etc. The other type is a temporary screen that goes away automatically on its own after a few seconds.

1. Sample Screens
      Type 1 - Start Screen

        This screen is usually a static screen that has buttons and waits for the user to do something

                             

    This card is probably not your first card that you created, so you need to make sure that this is the first card displayed when the Stack is opened. To do that, you need to put the following handler in the stack script.

    First, make sure that the card has a name. (go into the Property Inspector for the card and give it a name)
                                        

    Next we want to make sure that it is the first card we go to when the stack is opened.

    Open up the Stack Script and add the following code:

            on openStack

               go to card "Start"

          end openStack


      Now when the game starts up, the user will start with this screen


Type 2 - Splash Screen


     This is a brief screen which shows up for only a few seconds while the game loads and starts up. Usually, it is only there for 5 seconds, then you go immediately into the game.


                                                     

     To show this for a few seconds, then continue to the game - add the following code in the Stack Script

     Open up the Stack Script and add the following code:

            on openStack

                       go to card "Start"

            end openStack


      Then on your  card that is the splash screen, add the following code:

       Open up the card Script and add the following code:

            on openStack

                    wait 5 seconds

                    go to card "Level1"

            end openStack


      Or you can just add a button on the card that says "Done" or "Go To Game" with code on the button that sends you to the next card:

      On the object script for the button put this code:

            on mouseUp

                    go to card "Level1"

            end mouseUp


      There are many other ways of doing this, some work better for different situations. Look in the RunRev forums for more help.

2. Adding new Screens
This is as simple as adding a new card. We have our main screen

                           



     To add a new card, click on "Object", "New Card"

                            



      Next we open the "Application Browser" Click on "Tools", "Application Browser"

                             

     Note: (This is an important tool that you will use more in the future. It shows all of your cards, objects and some of their properties. When yo need to get to another card, find an "invisible" object or just get to another card/object - you will use the "Application Browser")


     We can now see both cards:

                             

    Let's rename our cards so that we can identify them more easily. We will call our new card - "Level1"

                             

     In the Application Browser, we see our new name

                             https://960fc1ae-a-ad7557ef-s-sites.googlegroups.com/a/pgcps.org/livecode/home/multiple-levels/NewCardRenamed.png?attachauth=ANoY7cqzUnKdwIweskplNYT6VvvSGhWsDwBhrrr4W1JA9NvCwjCUS0Wz4fDLaC1axs0-ntAXSdR7j6sktQ_Y40jUa6_Iw1nuuK333qQqkHb6AR0df3kJo9_hqxSo8ywKTCi-cqM1RoZVWYSewQIJ13un9q4LXULIloCaUfM5O6ecM-m0MHyocdGGoleunaHmFM2n9W-nP4o4-UNGykGFG1uQYGP2I-Io0emivuf1y2sxV6ntro9Q-hM%3D&attredirects=0
       While we are at it, lets rename our original card - "Start"

                                          


     Double-click on the "Start" card to go to it:

                                               

    Now to add the code to go to our new card - "Level1".
    Right-click on the "Start" button and select "Edit Script"
    Add the mouseUp handler and type in the line - "go to card level1"
   That's it. click on "Apply" and now when you click on the button "Start", it will go to the card "level1"

                      

 

Note:
    If you have moving objects on your screen or a game loop, you need to stop them before going to a different card. If not, they will continue and probably error off. So before you go to a new card, issue a "stopGame"  or "exit mouseUp" message 



Adding More Cards
A nice tutorial is in Lesson Two at Video 2 - Building Better User Interfaces starting at minute 7:00
It shows you shortcuts to adding buttons to go to other cards


.... more to follow, including graphics

Comments