Back to Course

Class 6 - Coding, AI & Robotics Course

0% Complete
0/0 Steps
  1. Coding

    Session 1: Introduction to Coding
    3 Topics
  2. Session 2: Backdrop, Costume, and Animation
    3 Topics
    |
    1 Quiz
  3. Session 3: Basics of Algorithm and Flowchart
    3 Topics
    |
    1 Quiz
  4. Session 4: Basics of Pseudocode
    3 Topics
    |
    1 Quiz
  5. Session 5: Getting Started with Quarky
    3 Topics
    |
    1 Quiz
  6. Session 6: Variables: The Multitaskers
    4 Topics
    |
    1 Quiz
  7. Session 7: Arithmetic Operators
    4 Topics
    |
    1 Quiz
  8. Session 8: Conditional Statements
    3 Topics
    |
    1 Quiz
  9. Session 9: Logical Operators
    4 Topics
    |
    1 Quiz
  10. Session 10: Nested Conditional Statements
    2 Topics
    |
    1 Quiz
  11. Session 11: Loops
    3 Topics
    |
    1 Quiz
  12. Session 12: Touch Based Piano
    2 Topics
  13. Session 13: Criterial in Loops
    5 Topics
    |
    1 Quiz
  14. Session 14: Catch the Fruit Game - Part 1
    2 Topics
  15. Session 15: Catch the Fruit Game - Part 2
    2 Topics
    |
    1 Quiz
  16. Artificial Intelligence
    Section 16: Introduction to Artificial Intelligence
    3 Topics
    |
    1 Quiz
  17. Session 17: Basics of Face Detection
    2 Topics
    |
    1 Quiz
  18. Session 18: Face Expression Detection
    2 Topics
    |
    1 Quiz
  19. Session 19: Mimic Face with Quarky
    1 Topic
  20. Session 20: Face Filter - Part 1
    2 Topics
  21. Session 21: Face Filter - Part 2
    2 Topics
  22. Robotics
    Session 22: Basics of Robotics
    2 Topics
    |
    1 Quiz
  23. Session 23: Wirelessly Controlled Robot
    2 Topics
  24. Session 24: Introduction to Sensors
    3 Topics
    |
    1 Quiz
  25. Session 25: Introduction to Actuators
    3 Topics
    |
    1 Quiz
  26. Session 26: Face Tracking with Robot
    2 Topics
  27. Session 27: Obstacle Avoidance Robot - Part 1
    3 Topics
  28. Session 28: Obstacle Avoidance Robot - Part 2
    2 Topics
    |
    1 Quiz
  29. Session 29: Edge Detector Robot - Part 1
    3 Topics
  30. Session 30: Edge Detector Robot - Part 2
    2 Topics
    |
    1 Quiz
  31. Capstone Project
    Capstone Project
Lesson Progress
0% Complete

Making the Monkey Move

Now it’s time to write the scripts for the Monkey sprite. Let’s begin!

evive Notes Icon
Make sure that the Monkey sprite is selected.

Controlling the Movements Using Quarky

Follow the steps:

  1. Go to the Sensors palette and add a is button () pressed ? block into the scripting area. The button, L, is set as the default option.
  2. To check if L is pressed, we’ll use an if block. Go to the Control palette and drop an if block into the scripting area. Drop the is button () pressed ? block in the white space of the if block.
  3. If L is pressed, then, according to our logic, Tobi should move left. Therefore, go to the Motion palette and drop a move () steps block inside the if block and write -10 in the space. The “-” sign means that direction of movement is left.
  4. However, if R is pressed, then Tobi should move right. Therefore, add another if block below the first one and drop a is button () pressed ? block in the white space.
  5. Then, go to the Motion palette and drop a move () steps block inside the if block, and write 10 in the space.
  6. Add a forever block around the entire script.
  7. To add the finishing touch, add a when flag clicked block from the Events palette above the forever block.
  8. set size to () % block from the Looks palette.  We’re using this block to reduce the size of the sprite to “80%” of the original size.
  9. go to x: () y: () block. We’re using it to fix the position of the sprite at the beginning of the game.

Below is the complete script: