160 likes | 177 Views
StarLogoTNG 101. Treasure Hunt Game Unit Lesson 3: Treasures and Hazards. Today’s Agenda. Review Mini-lesson on breed editor and new programming blocks Modify first program Wrap-up. Review.
E N D
StarLogoTNG 101 Treasure Hunt Game Unit Lesson 3: Treasures and Hazards
Today’s Agenda • Review • Mini-lesson on breed editor and new programming blocks • Modify first program • Wrap-up
Review • How do you create a keyboard control to make the player move up when you press the letter ‘a’ key? • Why are the following blocks not great for controlling the movement of an agent? • What numbers for degrees would work better instead?
Treasures and Hazards • What was the winning objective of the obstacle course? • Brainstorm ideas for “treasures” or incentives in your game design. • How did the various hazards or obstacles make the obstacles game interesting? • Brainstorm ideas for hazards in your game design.
Modifying First Program • File menu > Open project “first program mod.sltng” • File menu > Save next version • About the modified first program • Setup: clears everyone, creates turtles that are randomly scattered, creates “treasure” agents and other agents that are non-moving hazards • Run (forever): turtles move forward 1 space continually, forever • Collisions: between turtles and treasure/hazards.
Breed Editor • Click “Edit Breeds” button near top of canvas to bring up the editor in a new window. • Used to assign “shapes” and names to breeds. • Breeds are used to create different types of agents. • Each breed has its own set of programs and blocks (or block section). • Exercise: Click “new” button and rename the newly created agent to “treasure” and select a new shape.
New Block: Setup • Found in the “Setup and Run” drawer • Used to set initial conditions of the game • Example: what happens in first program when you click on setup? • Brainstorm starting conditions for your treasure game
New Blocks: Clear • Found in the “Setup and Run” drawer • “Clear everyone” makes all agents disappear • You can learn about the other clear blocks in your reference guide • Look at the setup block in first program. Why is it important to include “clear everyone” in setup? What do you think will happen if you remove this block? Make a prediction and test it!
New Blocks: Create • Create is used to create agents of a particular breed. • Because it is specific to each breed, these blocks are found in the “My Blocks” palette. • On the “My Blocks” palette, each drawer is named for a breed or a section of the canvas. • Select the breed you want to create agents of, and look for the “Create breed name” block. • This block takes a number argument that specifies how many agents you want to create. • There is also a “Create breed name” that has two parts – the number of agents and a “do” section. • The “do” section allows you to specify additional instructions, such as placement of the agent in spaceland and setting the camera angle.
New Block: Scatter • Located on the “My Blocks” palette • Found in each breed’s drawer • Usually used after agents are created to place them randomly in spaceland • There is also a “scatter everyone” block in the Setup drawer for scattering all agents that have been created, regardless of breed.
Guided Programming 1 • In the existing setup block, attach the appropriate blocks to create 10-20 treasure agents and scatter them. • Test out your new setup by clicking setup in the runtime window.
New Block: Collision • Found in each breed’s drawer in the “My Blocks” palette • Used to determine what happens when one agents touches another agent • What happened in second program when the player agent collided with a tree agent?
New Block: Die • Found in the “Logic” drawer • The agent that runs the block deletes itself (disappears completely from Spaceland). • How do you think this block was used in the second program?
Guided Programming 2 • Drag a collision block that shows “treasure” and “turtles” onto the collisions section of the canvas • Think: what do you want to happen when the turtle collides with the treasure? • Explore different possible results for collision. Use blocks that you already know, such as set color*, set size, movement blocks, die, and set score. *To see an agent’s color, you also need to use the block “model skin off” found in traits.
Programming Activity • Create a new breed for Hazards • Add create and scatter hazards to setup. • Think: what do you want to happen when the player collides with a hazard? • Explore different possible results for collision (check out the reference guide for new blocks or explore new blocks on your own).
Wrap Up • What collision results did you try? • What worked? What didn’t work? • What challenges did you have? • What was fun? • What questions do you have? • What new game ideas do you have?