PDA

View Full Version : Method as Trigger for Other Method?


jw234
03-30-2008, 12:34 PM
I want one object's method to trigger a separate object's method, like once the carousel turning animation starts (by, say, a mouse-click) then the monkey begins screeching.

How can I do this?

To clarify: I don't want the reactions to be time-programed like a movie; I want the monkey to only screech is the carousel turns, and if the carousel never turns, then the monkey never screeches. I also don't want some other arbitrary trigger to be required (like the monkey's distance to the carousel, or anything).

Thank you for any help you can offer.

DickBaldwin
03-30-2008, 02:06 PM
I want one object's method to trigger a separate object's method, like once the carousel turning animation starts (by, say, a mouse-click) then the monkey begins screeching.

How can I do this?

To clarify: I don't want the reactions to be time-programed like a movie; I want the monkey to only screech is the carousel turns, and if the carousel never turns, then the monkey never screeches. I also don't want some other arbitrary trigger to be required (like the monkey's distance to the carousel, or anything).

Thank you for any help you can offer.

Just put a call to the monkey method inside the carousel method. Methods call other methods all the time in programming.

Dick Baldwin
Free Alice tutorials: http://www.dickbaldwin.com/tocalice.htm
Free programming tutorials: http://www.dickbaldwin.com/toc.htm

pinckneyb
03-30-2008, 03:37 PM
JW -

I believe this Alice "world" (.A2W file) that I've attached does what you're talking about. This is new territory to me (English prof, trying to learn some programming so as not to live only in the 19th c), so this was good practice.

Let me know if this was what you meant.

pinckneyb
03-30-2008, 03:43 PM
Also, I've got to say:

You could easily publish, in GLIMMER TRAIN, or AMERICAN POETRY REVIEW, maybe, a poem called "Monkey Method" that started with the lines

Just put a call to the monkey method
Inside the carousel method
Methods call other methods
All the time

FWIW