Difference between revisions of "Scratch Workshop - Item Collection & Dodge"

From WLCS
Line 21: Line 21:
 
# Reset the count variable to 0 when the game starts (green flag clicked)
 
# Reset the count variable to 0 when the game starts (green flag clicked)
 
# Use a forever loop after resetting the variable
 
# Use a forever loop after resetting the variable
## If the count variable is ever equal to 10, then '''broadcast''' a message like "all collected"
+
## Add an '''if''' block to check if the count variable is ever equal to 10, then '''broadcast''' a message like "all collected"
 +
# Go to the player sprite:
 +
# When the player receives "all collected", then
 +
## say "You win!"
 +
## stop everything in the game (Hint: check the Control blocks)
  
 
'''Collecting Items:'''
 
'''Collecting Items:'''
Line 34: Line 38:
 
# Import a new image for the dangerous items that the player will avoid
 
# Import a new image for the dangerous items that the player will avoid
 
# When the game starts, tell the item to go to a random location (use the '''goto''' and '''random #''' block for x and y)
 
# When the game starts, tell the item to go to a random location (use the '''goto''' and '''random #''' block for x and y)
# If the item touches player sprite, then:
+
# If the item touches the player sprite, then:
 
## it should disappear (hide)
 
## it should disappear (hide)
## '''broadcast''' a message like "game over"
+
## say "game over"
 +
## stop everything in the game

Revision as of 22:00, 23 February 2015

Objective:

  • You will create a Scratch game that allows a player to travel around the screen, collect items, and avoid dangers
  • Use the following TEMPLATE INSERT HERE to start your game

Game Summary:

  • The player will be able to move around
  • The player will be able to collect items
  • The player must avoid dangers like "mines" or "traps"
  • The player wins when all items are picked up
  • The player loses when he/she hits a dangerous item

Player Sprite:

  1. Import a new image or create your own player sprite image to replace the given one
  2. Analyze the given movement code
  3. Add additional code blocks to enable movement in the other directions
  4. Hint: You will need more if-statements (Control), key pressing (Sensing), directional movement (Motion)

Item counter: - will be used to keep track of picked up items

  1. Create a variable for all sprites named "count"
  2. Go to the stage background:
  3. Reset the count variable to 0 when the game starts (green flag clicked)
  4. Use a forever loop after resetting the variable
    1. Add an if block to check if the count variable is ever equal to 10, then broadcast a message like "all collected"
  5. Go to the player sprite:
  6. When the player receives "all collected", then
    1. say "You win!"
    2. stop everything in the game (Hint: check the Control blocks)

Collecting Items:

  1. Import a new image for the items that the player will collect
  2. When the game starts, tell the item to go to a random location (use the goto and random # block for x and y)
  3. If the item touches the player sprite, then:
    1. it should disappear (hide)
    2. broadcast a message to the player sprite to say something like "yum!"
    3. increase the item count by 1

Dangerous Items:

  1. Import a new image for the dangerous items that the player will avoid
  2. When the game starts, tell the item to go to a random location (use the goto and random # block for x and y)
  3. If the item touches the player sprite, then:
    1. it should disappear (hide)
    2. say "game over"
    3. stop everything in the game