"Chicken Dragons"--User-defined methods and parameters -
10-12-2010, 06:35 PM
I'm working on an assignment for my Alice programming course, and I've hit a problem. The goal is to have four dragons arranged in a diamond and have them play "chicken" with each other (hence the name). Since the dragons need animation, I decided to define my own class with two methods; one for ascending and one for flying.
Now, here's the problem. I'm randomly choosing the two dragons out of four to play chicken with each other. I have a method that chooses two out of the four randomly, but I can't put a parameter into my user-defined methods for the dragons. The pre-defined methods (move, turn, etc) let me put an object parameter into the field for the object. How do I make it so that my user-defined methods can do the same?
Also, another note: I'm animating the sub-parts of the dragons, too. Is that a problem?
The file I have so far is attached below.
|