Helikopterle Çiçek Sulama

Ekrandan geçen helikopterinizle çiçekleri sulamaya çalışın.

Step 1: Helicopter

Let’s code your helicopter to move across the stage.

Activity Checklist

  • Open the ‘Green Your City’ Scratch project. Your club leader will give you a copy of this project, or you can open it online at jumpto.cc/city-resources.

    Here’s how the project should look:

    Helikopterle Çiçek Sulama
  • Click your stage and then click ‘Backdrops’. You can then choose a different city backdrop for your game. You can even click the ‘Choose backdrop’ button to choose a different backdrop from the Scratch library.

    Helikopterle Çiçek Sulama
  • Add this code so that your helicopter starts in the top-left of the stage.

    Helikopterle Çiçek Sulama
  • Add code so that your helicopter moves to the right until it reaches the edge of the stage.

    Helikopterle Çiçek Sulama
  • Test your helicopter by clicking the green flag. It should move across the top of the stage until it reaches the other side.

    Helikopterle Çiçek Sulama
  • Once it has reached the edge, your helicopter should go back to the left side of the stage and move down slightly.

    Helikopterle Çiçek Sulama

    Notice that the blocks you need to use are set x {.blockmotion} and change y {.blockmotion}.

  • Finally, you need to repeat this movement until your helicopter is at the bottom of the screen (its y position is less than -90).

    Helikopterle Çiçek Sulama
  • Test your helicopter again. It should move across and down until it gets to the bottom of the stage.

    You can make testing quicker by speeding up your helicopter.

    Helikopterle Çiçek Sulama

Save your project

Challenge: Animate your helicopter

You may have noticed that your helicopter has 2 slightly different costumes.

Helikopterle Çiçek Sulama

Can you use this block to animate your helicopter as it moves?

Helikopterle Çiçek Sulama

Save your project

Step 2: Water

Let’s code your helicopter to drop water onto your flowers.

Activity Checklist

  • Add code to your helicopter sprite, to create a new water drops clone whenever the space key is pressed.

    Helikopterle Çiçek Sulama
  • Add code to your water drops sprite, so that it is hidden when the game starts.

    Helikopterle Çiçek Sulama
  • You can then add code so that each new clone appears wherever the helicopter is.

    Helikopterle Çiçek Sulama
  • Test your code by clicking the flag and then pressing the space bar. A water drop clone should appear whenever space bar is pressed.

    Helikopterle Çiçek Sulama
  • Now you need to make the water drops fall to the ground.

    Helikopterle Çiçek Sulama
  • Test your water drops again. This time they should fall to the ground.

    Helikopterle Çiçek Sulama

Save your project

Challenge: Too much water

Have you noticed that lots of water is dropped if you hold down the space bar?

Helikopterle Çiçek Sulama

Can you use either (or both) of these blocks to fix the problem?

Helikopterle Çiçek Sulama

Save your project

Step 3: Flowers

Let’s code your flowers to grow when they are watered.

Activity Checklist

  • Add code to your red flower sprite to move it to the bottom of the stage at the start of the game.

    Helikopterle Çiçek Sulama
  • Your flower should move upwards whenever it’s touching a water drop.

    Helikopterle Çiçek Sulama
  • Click the green flag and then test your red flower by dropping some water drops onto it. Does the red flower move upwards when hit?

    Have you noticed that your flower keeps moving up when it’s touching the water?

    Helikopterle Çiçek Sulama

    Can you add a wait {.blockcontrol} block so that the flower only moves up once each time.

  • Copy your red flower code to your other flower sprites. To do this, just drag the code onto the other sprites.

    Helikopterle Çiçek Sulama

Save your project

Challenge: Keeping score

Can you add a score {.blockdata} variable to your game? Your score should start at 0, and change by 1 whenever a flower is hit by a water drop.

Here are the code blocks you’ll need:

Helikopterle Çiçek Sulama

Save your project

Challenge: Floating flowers

Have you noticed that if you water your flowers enough times that they move too high?

Helikopterle Çiçek Sulama

You only want your flowers to move up the stage if they’re touching the water and {.blockcontrol} their y position {.blockmotion} is less than -150.

If a flower’s position is higher than -150 then it should move any further.

Here are the code blocks you’ll need:

Helikopterle Çiçek Sulama

 

Kaynak

Yorumunuzu Ekleyin


Yükleniyor...
Yükleniyor...