alice-teacher Queue-up events

EILEEN PELUSO pelusoem at lycoming.edu
Fri Feb 18 09:29:58 EST 2011


James,
Could we see a sample of that?  I tried that with 3 monkeys (attached)
and it works if I click on one and then a second, but if I click on all
three, the (I'm assuming) threading in Alice's underlying Java code
outwits me.  Multiple clicks on the monkeys result in them jumping in
unison.
Thanks!
Eileen
 
Eileen Peluso, PhD
Lycoming College
Mathematical Sciences Department
Williamsport, PA  17701

>>> On 2/18/2011 at 9:18 AM, in message
<5DCE27CD-CD44-4875-B444-BB05890DA002 at benedictine.edu>, James Vanderhyde
<jvanderhyde at benedictine.edu> wrote:


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

_______________________________________________
alice-teachers mailing list
alice-teachers at lists.andrew.cmu.edu
https://lists.andrew.cmu.edu/mailman/listinfo/alice-teachers
-------------- next part --------------
An HTML attachment was scrubbed...
URL: https://lists.andrew.cmu.edu/mailman/private/alice-teachers/attachments/20110218/d4e1f7de/attachment-0001.html 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Three monkeys.a2w
Type: application/zip
Size: 2016444 bytes
Desc: PKZIP (compressed) files
Url : https://lists.andrew.cmu.edu/mailman/private/alice-teachers/attachments/20110218/d4e1f7de/attachment-0001.zip 


More information about the alice-teachers mailing list