01-02-2014

posted Jan 2, 2014, 5:19 AM by Samuel Konstantinovich   [ updated Jan 2, 2014, 5:19 AM ]
Goal: You will learn to make breeds behave in different ways depending on their state. 
It is really important to realize that color and shape do not determine breed. 

Ack Monsters! Activity 

There are two breeds: monsters and towers.
Monsters need variable to keep track of the state. You can store a string or a number, it doesn't matter.
The monsters should be gray, and you can import a "monster" shape from the turtle shape editor. 
The towers should be white, and "house" shaped. 

You need sliders for:
num_towers
num_monsters
rotate_speed
tower_radius
tower_angle

Setup:
Create num_towers towers, and num_monsters monsters.
All turtles should be size 2 and placed randomly on the world. 

Every time the program runs go:

Patch behavior:
-all the patches are black unless they are lit by a tower.

Tower behavior: 
-rotate by rotate_speed degrees
-project a cone of light that turns patches yellow.
-the cone is tower_angle degrees wide, and tower_radius long

Monster behavior:
-Monsters on a yellow patch turn "scared" 
-Monsters on a black patch turn "angry"
-Make the monsters have different shapes for angry and scared states. 

--Angry monsters:
---Fade* to color 2.
---Wiggle at a speed of .3 and random angle of 30. This makes the monster travel across the screen like a normal wiggle. 

-Scared monsters:
 ---Fade* to color 8.
 ---Wiggle at a speed of .1 and random angle of 360. This makes the monster wiggle in place like they are scared. 

*Fade that means the monster changes its color by 0.25 towards that color every time go is run so that the color changes slowly.

Comments