Alice Community  

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

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Call custom method from objects in list
Old
dragnet
Member
 
Status: Offline
Posts: 38
Join Date: Jan 2010
Default Call custom method from objects in list - 03-18-2010, 01:02 PM

I've looked though examples and also through the text books. Can't seem to find a way to call custom methods whe iterating through an object list. For example I want to call a swim method for each fish in a list I've created 'allFish'. When I create a 'For all together' loop to iterate through my array 'allFish', the only options that show up are method calls to the built in object methods, no custom methods are listed. Is there a way to change this?

My only other option is to create a world method that accepts an object and makes it move as I want. Then I can cycle through my list and pass each object to the world method. It works but is not what I would consider as clean of a coding technique.

Thanks.
   
Reply With Quote
 

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 ©2021, Carnegie Mellon University
Alice 2.x 1999-2012, Alice 3.x 2008-2012, Carnegie Mellon University. All rights reserved.