Time for action — creating our level selection menu

Our level selection scene is looking pretty bland right now, isn't it? We should add some images to these buttons, and what would look better than the actual screenshots of the levels? That's what we are going to do next!

  1. Open up your first level, click the Preview button, and then click on the button with the camera icon in the upper-right toolbar to take a screenshot.
  2. Click the Save... button to save the current shot as a file. Repeat this step for all the levels, I know it's not fun but hey, it looks great.
    Time for action — creating our level selection menu
  3. Then import the images to the Library and drag them on to the appropriate button. They may not fit properly within the frame we made, so just resize them accordingly.
  4. Now, we have to add behaviors to the buttons. Simply click the button you want, click Create Rule, change the middle property from Actor receives event | mouse button | is | down to Actor receives event | touch | is | pressed. Then drag a Change Scene behavior into the rule and change Go to scene: to the level you want. Repeat for all the other buttons.

    Tip

    You can click Rule and press command + C to copy the whole rule, then press command + V to paste it into the other buttons, saving a lot of time, or you can click Option and select Behaviors for an even faster method!)

    Time for action — creating our level selection menu
  5. Test to see if you did them right; click Preview and make sure the button sends the player to the right level, small mistakes like this can ruin your app. It's a good thing that I double-checked them because I put the wrong images for four of the buttons!
  6. Finally, program the Menu button. Double-click it and repeat what you did with the rest of the buttons, but change Go to scene: to the Menu scene.

That's it for this level!

What just happened?

In this section, we learned how to create screenshots for each level and create some buttons with images on them. Creating these screenshots is very helpful for submitting your game to iTunes or even posting some images on your website or on Facebook.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.144.110.155