Presentation is loading. Please wait.

Presentation is loading. Please wait.

StarLogoTNG 101 Treasure Hunt Game Unit Lesson 2: Keyboard Controls.

Similar presentations


Presentation on theme: "StarLogoTNG 101 Treasure Hunt Game Unit Lesson 2: Keyboard Controls."— Presentation transcript:

1 StarLogoTNG 101 Treasure Hunt Game Unit Lesson 2: Keyboard Controls

2 Today’s Agenda Review Mini-lesson on new programming blocks Obstacle course programming challenge Wrap-up

3 Review What do you predict will be the agent’s movement when it executes the following block? What about this stack of blocks?

4 Review File menu > Open project “movement review.sltng” File menu > Save next version 5 minute programming challenge! Create the tallest stack of movement blocks that does not change the position or direction of the agent. Rule: You may not use the same pink argument block more than once. Hint: You may test your stack as many times as you want during the 5 minutes.

5 Programming Tip Another way to delete a block is to drag and drop it anywhere in the palette

6 Player Controls Have you seen or played Nintendo Wii? Why do people like it? What’s special about it? All computer games involve some kind of player control. Besides the Wii remote, what are other devices used by players to control the character or action in a game? Today, we will implement keyboard controls to move an agent around spaceland.

7 New Block: If / then Found in the “Logic” drawer First part (“test condition”) must evaluate to true or false If test condition is true, the blocks in the “then” section is executed. If false, ignore the “then” section. Example: see first program

8 Exercise: If / then block What do you think these IF blocks will do when executed by an agent? Explain your thinking.

9 New Blocks: Keyboard detect Found in the “Controls” drawer. Question mark means that the blocks tests if that particular key is pressed – evaluates to true or false. Click on down arrow on the right side of the block to select a different keyboard key to test.

10 Obstacles WATCH THE TEACHER DEMONSTRATE THE FOLLOWING STEPS FIRST. File menu > Open project “obstacles.sltng”. File menu > Save next version About obstacles project: –Terrain: maze / obstacle course –Setup: creates 1 player agent that starts in a corner of the board; also creates “treasure” blocks and other agents that are obstacles (you’ll find out) –Run: nothing happens yet –Game ends when the player collects all the treasure.

11 Programming Activity 1 WATCH THE TEACHER DEMONSTRATE THE FOLLOWING STEPS FIRST. Program instructions to control the agent’s movement from the agent’s point of view: –Up arrow key = move forward –Left arrow key = turn left –Right arrow key = turn right –Down arrow key = move backward Click on Run in the Runtime window to test out the controls. What happens when the player agent walks on different kinds of terrain (dips, hills, platforms)? Try out different values for the arguments (# of steps and degrees) and see what happens.

12 Programming Activity 2 Objective: collect all treasure in the obstacle course Program additional keyboard controls to get past obstacles. Consult the reference guide for descriptions of NEW blocks that could be useful.

13 Wrap Up What strategies and new blocks did you try to get past the obstacles? What worked? What didn’t work? What challenges did you have? What was fun? What questions do you have?


Download ppt "StarLogoTNG 101 Treasure Hunt Game Unit Lesson 2: Keyboard Controls."

Similar presentations


Ads by Google