Liikkumisharjoitus Laboratorion liukusäätimellä – Moving exercise with Laboratory’s slider

Tervehdys kaikille!

Kuinka moni on kokeillut Laboratorion liukusäädintä? Pohditko, mihin sitä voisi käyttää? Haluaisin jakaa kanssanne hauskan idean pelistä oppitunnilla koodattavaksi. Tämä on vain yksi tapa hyödyntää liukusäädintä!

Tavoitteena olisi saada rapu liikkumaan näytöllä ja ottamaan kiinni putoavia ilmapalloja.

Greetings everyone!

How many of you have tried the Laboratory’s slider? Are you wondering what you could do with it? I’d like to share a fun idea of coding with slider during a lesson . This is just one way to utilise slider! 

The goal is to get the crab move along display and catch falling balloons!
Vaihe 1. 

Koodaa rapu liikkumaan liukusäätimellä edestakaisin näytöllä. Katso vinkkiä tarvittaessa viereisestä koodista!

 

Step 1. 

Code the character to move with the slider on the display. Look tip how to code below!

 

Vinkki: Jos haluat, voit säädellä ravun nopeutta ohjauskäskyllä odota_sekuntia. Kokeile myös lisätä koodiin seuraava asuste ja katso mitä tapahtuu!

Tip: If you want you can alter characters speed with control command wait_seconds. Try to add next costume to the code and look what happens!

 

Vaihe 2.

Ohjelmoi ilmapallo putoamaan näytön yläreunasta.

  • Ensiksi ohjelmoi ilmapallo menemään pelin alkaessa näytön yläreunaan.
  • Tämän jälkeen ohjelmoi pallo putoamaan jatkuvasti alaspäin.
  • Lisää kaksi ehtoa:
    1. Jos osuu rapuun, niin ilmapallo poksahtaa ja palaa takaisin ruudun ylänurkkaan.
    2. Jos osuu alareunaan, niin pallo palaa takaisin näytön yläreunaan.
  • Huom: Ole tarkkana, kuinka korkealle ohjelmoit pallon palaavan! Pallo voi käyttäytyä odottamattomasti, jos se osuu reunaan myös näytön yläreunassa.
  • Katso vinkkiä alla olevasta koodista!

 

Step 2.

Code the balloon to fall from the top of the display.

  • First code the balloon to go to the top of the display when game begins.
  • After that code the balloon to fall continuously down.
  • Add two conditions:
    1. If the ball touches the crab-character, it pops up and returns to the top of the display.
    2. If it reaches the edge, it returns again to the top of the display.
  • Note: Be careful how high you program the balloon to return. It may behave unexpectedly, if it touches the edge on the top of the display.

 

 

Voit aina kehittää peliä pidemmälle! 🙂 Antoisia koodaushetkiä!

You can always develop the code further yourself! 🙂 I hope that you have fun with this task!

Anu

 

 

Leave a Reply