How to Make a Title Screen and Levels

Материал из Поле цифровой дидактики

Many games have title screens, as well as levels in RPGs. These are mostly made up of backdrops drawn by the creator. Sensing blocks can be added to the sprite as Wall Sensors in order for the sprite to complete missions.

Title Screens

Title screens usually consist of one backdrop (the title and design) and a sprite (the "start" button). One will need three broadcasts for this screen:

  • TitleScreen
  • StartGame
  • ShowSButton

The backdrop should contain this script:

when I receive [TitleScreen v]
switch backdrop to (Title Screen v)
broadcast (ShowSButton v)

The sprite should contain these scripts:

when green flag clicked
show
forever
if <touching (mouse-pointer v)?> then
switch costume to (costume2 v) //A different colored costume
else
switch costume to (costume1 v) // The original costume
when this sprite clicked
broadcast (StartGame v)
hide
when I receive [TitleScreen v]
show // This script is in case of a "Play Again" button at the end of the game. If one does not have a "play again" button, this script is not necessary

Levels

Levels are backdrops. Be sure to keep the platform color consistent in Platformers, as well as anything that may cause the player to lose a life.

If it is needed, they can add a large readout variable that has this script somewhere in the project:

when green flag clicked
forever
set [Level Name v] to (backdrop name)

However, this requires each backdrop to be named. This is a very simple way of creating the backdrop levels and title screen.

Here's a simple script to put in the player so one can advance to the next level without scrolling or anything fancy.

when green flag clicked
forever
if <([x position v] of (Player v)) > (240)> then
switch backdrop to (next backdrop v)
go to x: (-202) y: (-70)

See Also