How to use the
Learning Portal

Learning Portal

Our hands-on, comprehensive lesson plans span a range of levels. Browse our free STEM and coding learning resources.

Marty Image

2.01: Exploring Events

45 Minutes

Lesson Overview

Students will have been using the main green flag event block for programs in MartyBlocks. This lesson will introduce more functionality behind the events section, in MartyBlocks. Event blocks can be triggered by different things, the green flag is only one of them. This will set the stage for parallel programming and connectivity with other devices, like the micro:bit.

In this lesson, learners will create a basic remote control to be used with Marty via different event blocks; this program will rely on learners using sprites as triggers. The use of sprites requires an internet connection.

Key vocabulary:
    Events, input, Output, Trigger,

Content Sections

  • Learning Objectives
  • Warm-up
  • Unknown block type "youtube", please specify a serializer for it in the `serializers.types` prop
  • Get Learning
  • Unknown block type "youtube", please specify a serializer for it in the `serializers.types` prop
      Unknown block type "youtube", please specify a serializer for it in the `serializers.types` prop
      Unknown block type "youtube", please specify a serializer for it in the `serializers.types` prop
      1. Time for Practice
      2. Cool Down
        • Extensions & Challenges
        • Extend
          • Support
            • Additional Reading
            • 2.01: Exploring Events

              45 Minutes

              Lesson Overview

              Students will have been using the main green flag event block for programs in MartyBlocks. This lesson will introduce more functionality behind the events section, in MartyBlocks. Event blocks can be triggered by different things, the green flag is only one of them. This will set the stage for parallel programming and connectivity with other devices, like the micro:bit.

              In this lesson, learners will create a basic remote control to be used with Marty via different event blocks; this program will rely on learners using sprites as triggers. The use of sprites requires an internet connection.

              Key vocabulary:
                Events, input, Output, Trigger,
              • Practice using blocks, in MartyBlocks; knowledge of some block names
              • iPad or Tablet with MartyBlocks
                • Marty the Robot v2
                • Marty Workbooks
                • Tablets with Bluetooth
                • Access to the MartyBlocks editor

              Learning Objectives

              • I can control a device using a program.
              • I can create different events that rely on different inputs.

              To complete this lesson, learners need to be using a tablet and have an internet connection.

              Warm-up

              Share with learners the first slides of the presentation, displaying the objectives and success criteria.

              Ask learners how many of them use the keyboard on their devices to control actions or if they prefer another way to interact with them: mouse, voice, gesture, etc. Share with learners the short spoof video that features the one key keyboard, Mactini, located in the presentation. Ask learners if they think this way of interaction is efficient or if there is something more they could do.

              After watching the video, share that this device has one event with multiple if statements controlling the displayed text on the screen after each key press or combination of key presses. Ask learners to fill in ideas in the workbook why having a one key keyboard could be a good idea and why it could be a bad idea.

              Share that today, they will be creating a remote for Marty that will control him with multiple event blocks. Share an idea for a video that displays Marty moving in the four directions, being controlled by Sprites in MartyBlocks. This video does not have the code alongside the video because you wouldn't see which sprite was being pressed. The other videos, showing how to add sprites and actions for the sprites clearly describe this process. The teacher guide displays all the code that was used to move Marty with the sprites.

              Get Learning

              Show learners the main MartyBlocks screen, this is available as a recorded video from the presentation or if your device is connected to the board/projector, feel free to show the following steps from there. Both this video and the one below, have subtitles to support where to click; feel free to turn them on, in YouTube.

              • Drag a green flag event block from the events section in MartyBlocks.
              • Attach a movement to the event block, the video shows the walk forward block but this could be whatever you want.
              • Drag a 'when this sprite clicked' block from the events section.
              • Attach a movement to the event block, the video shows the get ready block but this could be whatever you want.
              • Press the icon at the top right to give a split-screen showing the sprite a background section.
              • Press the icon to expand to full screen.
              • Press the green flag, now at the top left.
              • Press the Marty sprite. Learners will see that there are two event blocks. They are triggered with different actions: the green flag and the Marty sprite. Explain that these two events give more functionality to a program but only two events is quite limited: there are only two scripts that will run. It would be good to have more.

              This video, below, shows Marty responding to the two different blocks as they are clicked, from the above example. This video is featured in the presentation but can be removed, if desired.

              Ask learners what keys or symbols they would choose to use for controlling Marty: remind them that we used the Marty sprite to get ready; we could use Marty to move a certain way but would other people understand that clicking Marty would make him move or are there more natural symbols to control his movement? Learners might suggest the arrow keys or the WASD keys on the keyboard. Record the ideas on the board and have learners record their ideas in the workbook with annotations for what each key/symbol should do.

              Once a bit of time has been given to record this, remind learners, or introduce them to, the sprite library:

              • Return to the main MartyBlocks window by pressing the collapse icon.
              • Click the icon to show the sprite and background display, if you don't see it.
              • Click the sprite add icon at the bottom.
              • Display to learners the extent of sprites available so that they can choose one for use.
              • Choose an icon, preferably one that would not be best for a directional icon, like a ball.
              • When you return to the workspace, you will see that icon in the top right sprite icon area and in the top right of the workspace. The other blocks will have disappeared, this is because the program is now focused on this sprite.
              • Move the sprites so that they don't overlap by tap dragging one away from the other.
              • Tap the ball icon, or whichever icon you chose, in the sprite selection area, not the workspace at the top right. You will see the ball icon at the top right of the workspace, where you put code blocks.
              • Now drag a 'when this sprite clicked' block from the events section and give it a command, dance was chosen for the video.
              • Now, expand the icon space by clicking the expand icon. Clicking the Marty icon will result in one action and clicking the ball will result in a second action.

              Before having learners explore the sprite library, click on the costumes tab, at the top of the window, to explore what can be done to change the look of a sprite. Point out that this also includes flipping and color changes and that other icons may have more options (as it happens, the arrows, that learners will likely settle on, also feature alternate arrows at 90 degree turns). Finally, show what the paintbrush icon does, after tapping the add sprite icon: create your own sprite.

              Encourage learners to explore the sprite library to find any icons they think would be appropriate for what they need to do and allow them time to explore the options that go with sprites.

              Time for Practice

              Learners need to have their idea for what sprites will do before beginning the code. Once this is decided, it should not take very long for them to assign commands to each block/sprite and explain. Reinforce that it is the sprite tap that is triggering the code, not the green flag. To highlight this, it may be helpful to illustrate what happens with Marty should learners use the green flag event block for each of the sprites. The only output will be the actions attached to the green flag event block for the Marty sprite workspace: none of the other sprites have a green flag event block.

              Learners need to meet the criteria of 4 directions. Extension activities offer ideas to take this further.

              Cool Down

              Bring learners back together to discuss the challenges they faced and overcame. Have groups model their creations and explain what is happening, when. Encourage other groups to ask questions to deepen the understanding of the processes.

              Suggested questions you might ask:

              • What helped you to decide which sprites to use for each movement?
              • If you chose to design your own sprite, what did you use for motivation?
              • Were there any challenges to triggering the code from each sprite?

              Carry out any end of lesson routines.

              Log off devices and clear everything away.

              Extensions & Support

              Extend

              • Challenge learners to design sprites that are unique. Have them decide on a theme, of some kind: perhaps there is a top that you are researching that could influence the style of the symbols, like energy, historical time periods, map symbols, etc.
              • Extend the 4 directions to turns or extra movements like a dance, kick or wiggle. If attached, activate another output, like disco lights.

              Support

              • Remind learners of the built-in controller to support them to see what each of the symbols do, in that section of the Marty app.
              • Have code blocks that are necessary for event input in hard copy, for learners to physically build their code.

              Additional Reading

              • Educator’s Guide

              • Technologies: Craft, Design, Engineering and Graphics
              • Technologies: Computing Science
              • Literacy & English: Listening and Talking
              • Health and Wellbeing: Mental, Emotional, Social and Physical Wellbeing
              • Literacy & English: Writing
              • Computing, Design and Technology: Design and Technology
              • Computing, Design and Technology: Computing
              • CSTA Education Standards
              • Elementary Technology Applications: Grade 3 to Grade 5
              • Digital Technologies, Design & technologies: Digital Technologies
              • International Society for Technology in Education (ISTE)