Alice Community  

Go Back   Alice Community > Alice 2 > How do I...?

Reply
 
Thread Tools Display Modes
"Chicken Dragons"--User-defined methods and parameters
Old
Klinkin
Guest
 
Status:
Posts: n/a
Default "Chicken Dragons"--User-defined methods and parameters - 10-12-2010, 07: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.
Attached Files
File Type: a2w Chicken Dragons.a2w (912.2 KB, 86 views)
   
Reply With Quote
Old
debussybunny563
Senior Member
 
debussybunny563's Avatar
 
Status: Offline
Posts: 852
Join Date: May 2010
Arrow 10-12-2010, 08:38 PM

There is an overuse of parameters in your code (however, it may be that this is what the assignment is stressing), and I replaced many of them with variables.

I placed comments in the code, so you shouldn't have too much trouble figuring out what I did.

Post if you have any questions/comments, and good luck!
Attached Files
File Type: a2w Chicken Dragons.a2w (3.03 MB, 146 views)


Last edited by debussybunny563; 12-21-2012 at 12:00 AM.

|--------------------------------------------------------------------------------------------------|
|Link to weapons collection: http://www.alice.org/community/showthread.php?t=7368 |
|--------------------------------------------------------------------------------------------------|

I have been dead for quite some time now; not much hope for resurrection.
   
Reply With Quote
Old
Klinkin
Guest
 
Status:
Posts: n/a
Default 10-14-2010, 12:52 AM

Thank you very much. That pretty much solves all my problems, and makes things about three times as elegant, too.
   
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump



Copyright ©2017, Carnegie Mellon University
Alice 2.x 1999-2012, Alice 3.x 2008-2012, Carnegie Mellon University. All rights reserved.