alice-teacher Queue-up events

James Vanderhyde jvanderhyde at benedictine.edu
Fri Feb 18 09:18:10 EST 2011


I don't think there's a setting for the effect you want. You could implement a queue as a list of objects, so that clicking on an object adds itself to the queue.

An easier solution to prevent the cup from activating before the blender finishes is to add a boolean variable "busy" to the scientist. In each event handler, check the variable to see if it's false. If false, set it to true and do the action. Then reset to false after the action. That way no actions can take place simultaneously. I showed many students how to do this in their Alice projects this year.

James
--
Dr. James Vanderhyde
Math and Computer Science
Benedictine College
jvanderhyde at benedictine.edu
http://vanderhyde.us/~james/pro/



On Feb 17, 2011, at 5:19 PM, Michael Bauer wrote:

> Suppose you create a world which uses multiple event handling, is there a way to queue-up user triggers of an event instead of having it start immediately?  For example, the Mad Scientist exercise in the textbook.  When the user clicks on an item (eg., the blender) and then clicks another item (eg., the cup) before the blender animation finishes, the cup animation starts immediately while the blender is still animated.  Is there a way to queue up the subsequent event triggers so that the cup in the above example doesn't start until the blender finishes even if the cup is clicked before the blender finishes?
> Thanks,
> Mike Bauer
> University of Hawaii - Leeward Community College.
>  
> Hope to see many of you in Dallas next month.
> _______________________________________________
> alice-teachers mailing list
> alice-teachers at lists.andrew.cmu.edu
> https://lists.andrew.cmu.edu/mailman/listinfo/alice-teachers



More information about the alice-teachers mailing list