90 likes | 186 Views
StarLogoTNG 101 . Treasure Hunt Game Unit Lesson 8: Hatch. Today’s Agenda. Review Mini-lesson on new programming blocks Implement “shooting” or “throwing” game feature Wrap-up. Review. Program a keyboard control for the player to stamp a black patch when the key ‘b’ is pressed.
E N D
StarLogoTNG 101 Treasure Hunt Game Unit Lesson 8: Hatch
Today’s Agenda • Review • Mini-lesson on new programming blocks • Implement “shooting” or “throwing” game feature • Wrap-up
Review • Program a keyboard control for the player to stamp a black patch when the key ‘b’ is pressed. • Program the enemy agents to get “stuck” to the black patch (can’t move) if they walk over a black patch. • Program the score to be reduced by 1 point if the player agent walks over a black patch.
New block: Hatch • Hatch is found in the Logic drawer. • The plain hatch block creates a new agent (“child”) that is the same as the agent that hatches it (“parent”). • The hatch-do block does the same thing but also allows you to modify the new agent – for example, change its breed, change its size, put it in a certain location, etc. • What game features can you add to your treasure game using Hatch blocks? (hints: collision, keyboard command)
New block: set breed • “Set breed” is found in the traits drawer. • It takes a “breed” argument, which can be found in the “My Blocks” drawers. • It sets the breed of an agent to a different breed.
“Shoot” feature • A popular game feature is for your player agent to “shoot” or “throw” something – e.g., paintballs to paint another agent, bullets to kill an enemy, net to capture treasure. • What other “shooting” or “throwing” game features can you think of?
Guided Programming • Open the current version of your “treasure game your initials.sltng” • Save next version • How can you implement “shooting” using what you’ve already learned plus Hatch and Set Breed? • What object (agent) do you want the player to shoot? • How should the shot agent behave after it’s been shot? • What do you want to happen when the shot agent collides with different agents in your game? • What key should trigger the shot?
Programming Activity • Find another use for the Hatch block in your game – for example, if two moving enemies collide, they can “hatch” a new moving enemy. • Improve the real-world physics of shooting – for example, how can you make the shot agents die when they hit the edge of the terrain?
Wrap Up • Describe your “shooting” feature. • 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?