PDA

View Full Version : Making a snowman flip a Hat


Mdking8638
10-30-2009, 01:01 AM
Hi i'm currently using Alice is a program design and development class for my degree. I am completely stumped on this exercise. Verbatim from the book.......

"Write a new world level method for the snow people world. The new method name fliphats , will be called when the snowwoman turns to the snowman. In the fliphats method the snowman uses his right arm to grab his hat and graciously tip his hat to the snow woman and then return his hat to his head. After the snowman flips his hat, the snowman flips her hat"

The problem i'm having is how do I get the snowman to "grab" his hat and take it off then return it. I am utterly stumped at this moment and any help would be greatly appreciated.

For those with the Programming with Alice book it is Exercise 4-1.

x2495iiii
10-30-2009, 03:30 AM
Just have the snowman move his arm so that his hand is near his hat. hen, have the hat set it's vehicle to the snowman's hand. Finally, have the snowman turn his arm so that it looks like he is tipping his hat.

xxledzeppelin2x3
10-30-2009, 02:13 PM
Yes, i had this exercise earlier in the year and you need to move the arm of the snowman up to his hat and then do the "set vehicle to" method so the hat will then move with the hand of the snowman downward.