Menu¶

In this section we handle

  • backdrops
  • buttons
  • background music

https://scratch.mit.edu/projects/391162659

Backdrops¶

For this project we select two backdrops

  • Forest for the home screen
  • Savanna for the play screen
../_images/backdrop.png

The home screen has a play button. The play screen has a home button.

The home screen¶

When the program starts we

  • switch to the Forest background
  • show the Play button
../_images/play_flag.png

We could add more buttons for options, high-score, etc.

../_images/menu_home.png

The play button¶

When the play button is clicked we

  • play a pop sound
  • set the boolean variable music to zero (to stop the music loop)
  • stop all sounds
  • broadcast the message play
  • hide the play button
../_images/play_click.png

When the play button receives the home message it

  • waits 0.1 seconds (to be sure the old music stops)
  • switch to the home background to Forest
  • show the button
../_images/play_msg.png

The play screen¶

The play screen has a home button and a player (Scratchy).

../_images/menu_play.png

The home button¶

The program always starts with the home screen, so initially the home button is hidden.

../_images/home_flag.png

When the home clicked is clicked it stops the current music and broadcasts the home message.

../_images/home_click.png

When it receives the play message it shows play screen and home button.

../_images/home_msg.png

Background music¶

The background music is associated with the stage. We choose:

  • Bossa Nova for the home screen
  • Video Game 1 for the play screen
../_images/sounds.png

When the backdrop switches, a new music is played

../_images/backdrop1.png
  • the boolean variable music is set to 1
  • the sound is repeated until the boolean music is reset to 0
../_images/backdrop2.png

Scratch tutorial

Navigation

Contents:

  • Introduction
  • Techniques
  • Looks
  • Animation
  • Cloud data
  • Dialog
  • Menu
    • Backdrops
    • The home screen
    • The play button
    • The play screen
    • The home button
    • Background music
  • Music
  • Pen
  • Rooms
  • Scenario
  • Scripts
  • String
  • Tablet
  • Text
  • Variables
  • Clones
  • Bricks
  • Platformer
  • Pong
  • Adventure game
  • Codes

Related Topics

  • Documentation overview
    • Previous: Dialog
    • Next: Music

Recherche rapide

©2020, Raphael Holzer. | Powered by Sphinx 1.8.5 & Alabaster 0.7.12 | Page source