Home‎ > ‎

Multiple Levels

Adding More Levels 
Games usually have multiple levels. As you complete one level, you go to a new but harder level.

In LiveCode, a new level is basically just a new card. In this lesson, we are going to create new cards and then make buttons to go back and forth between the cards (levels)

Then we will learn how to make this automatic using a hidden object and the Intersect command.

Adding a New Level
This is as simple as adding a new card. (right-click on card - "New Card" or click on "EditBar" - "New Card). Give it a name in it's Property Inspector (e.g. "level 2") and add the command "go to card "level 2" some where in your code. This creates a new, blank card.

If you have a lot of code on your old card and want to use much of it again, you can use the "Clone" method to clone the card which creates a new card with all the objects and code from the original one. You can edit the new card to change the name of the card, and the objects,, if you wish.

To clone a card:
 1. On the LiveCode "Edit Bar", click on "Message Box" which opens up a window where you can type commands interactively. (like in Python where you can type live commands) Type "clone card "mycard" - or whatever you named it.  Then open up the "Project Browser" or the "Property Browser for it and rename it (e.g. "level 2")

...more to come...

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, stop all motion on the card.



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