Presentation is loading. Please wait.

Presentation is loading. Please wait.

StarLogoTNG 101 Treasure Hunt Game Unit Lesson 7: Coordinate System.

Similar presentations


Presentation on theme: "StarLogoTNG 101 Treasure Hunt Game Unit Lesson 7: Coordinate System."— Presentation transcript:

1 StarLogoTNG 101 Treasure Hunt Game Unit Lesson 7: Coordinate System

2 Today’s Agenda Review Mini-lesson on coordinate system in SLTNG and new programming blocks Programming activity Wrap-up

3 Review Program the moving enemy agents to compete with the player agent to “collect” treasure. Also, whenever a moving enemy collides with a treasure, the enemy “leaves a mark” by stomping a crater that’s colored yellow. If a player walks into a yellow crater, the score goes to 0.

4 Coordinate System Spaceland uses an x and y coordinate system. (0, 0) is located in the center of the green square. The green square is approximately 100 by 100. Thus, the range of x and y coordinates is -50 to +50. y = +50 y = -50 X = +50X = -50

5 New blocks: set x, set y, set xy Found in the Movement drawer Take number arguments xcor and ycor are variables that keep track of each agent’s present location

6 Set x, Set y, Set xy Practice What do the following two sections of blocks do? How can you change the setup section above so that the player appears in the bottom right corner?

7 Set x, Set y, Set xy Practice Recall: What happened when you collided with a tree in the obstacles project? How was the “set xy” block used to do this? (click for answer) Brainstorm other uses of set x, set y, and set xy in your treasure game. (hint: setup, collision)

8 New blocks: set heading, heading Found in the “Movement” drawer. Takes a number argument. Heading is a variable that represents the current direction of an agent. A heading of 0 means that the agent is facing “north,” which is “up” when one looks down on the green plane from above. Recall that there are 360 degrees in a circle. See diagram on right for what different values of heading mean. 0 degrees 90 degrees 180 degrees 270 degrees 45 degrees

9 Set heading Practice What do the following sections of programming code do? How can you use the “set heading” block in your treasure hunt game?

10 Guided Programming 1 Open the current version of your treasure game. Save next version. Use “set xy” and “set heading” in the setup block to place your player agent in a certain location facing a certain direction at the start of the game. You may need the Create [player agent] Do block.

11 Guided Programming 2 Implement new game features by programming interactions between the terrain and agents. Example #1: –Trigger: If the player agent steps on a blue patch, –Response: the player’s size is set to 2 and the player stamps the patch back to green. Example #2: –Trigger: If enemy agents steps on a blue patch, –Response: the enemy agents change direction (heading is randomly set). In Setup, use Scatter PC block to randomly set the patch color of 1/100 of Spaceland to blue.

12 Programming Activity Choose a trigger and response from the class brainstorm list or make one up of your own. Write it down on your activity sheet in this form: If…(trigger) then…(response). Implement your idea. TIP: Implement the idea one small step at a time, testing each step to make sure it works before going on to the next step.

13 Wrap Up Describe your “trigger and response” 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?


Download ppt "StarLogoTNG 101 Treasure Hunt Game Unit Lesson 7: Coordinate System."

Similar presentations


Ads by Google