Starting with the starter project

To simplify the script creation, we will start with the starter project. The starter project contains the following:

  • Stage
  • Global variables
  • Incomplete sprites (sprites that contain incomplete costumes, variables, or scripts)
  • Complete sprites (sprites that contain all the necessary parts and can be configured)
    Starting with the starter project

Engage thrusters

Open the starter project and check out the stage, global variables, and the sprites.

The costume stage in Space Age is imported from the Scratch media library under Space. It does not have any script and is only used for the background.

Engage thrusters

Open the starter project and check out the sprites included. The following table gives a quick overview of what each sprite does:

Sprite name

Description

Scripts included in starter project?

Spaceship

The sprite that the player controls directly

No

Spaceship Ammo

 

No

Shield

Protects the Spaceship against enemy crash but not against the enemy ammo

No

Shield Life

Displays the power level of the shield

No

Life Boost

Resets shield power to full

Yes

Laser Boost

Increases laser power to shoot through all enemies on the laser track

Yes

Rock

Enemy sprite that falls

Yes

Mother Ship

Enemy sprite that flies in a pattern

Yes

Enemy Ammo

Ammo fired by the enemy sprites

Yes

Game Manager

Manager's game levels and scores

Yes

Start Button

When pressed, game starts

Yes

Hundredth

Display the hundred's digit of the score

Yes

Tenth

Display the ten's digit of the score

Yes

One

Display the one's digit of the score

Yes

Global variables are variables that are shared by all sprites and local variables are variables used by one sprite only. Global variables are convenient for sprites to share information, just like a bulletin board. You may think of global variables as posts on a bulletin board for all sprites to see, and local variables as private letters just for the eyes of the owner sprite.

To create a global variable, just select the For all sprites radio button as shown in the following screenshot:

Engage thrusters

In Space Age, there are six global variables: enemy_count, frame_rate, game_level, game_score, power_boost_on, and max_game_level. Their description is given in the following table:

Global variable name

Description

current_enemy_count

Current count of enemies in game

frame_rate

The frame refresh rate; often used to pause for the costume

game_level

Current level of the game; range—1~max_game_level

game_score

Current game score; range—000~999

power_boost_on

True if spaceship's laser boost is on; false if it is off

max_game_level

Highest level in this game

Objective complete – mini debriefing

We've covered the stage, global variables, and the sprites in Space Age. After getting a quick glimpse of all the sprites, next we will complete each sprite.

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

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