alice-teacher Alice 2 "While the world is running" event

Vanderhyde, James vanderhyde at sxu.edu
Tue Feb 28 13:54:32 EST 2017


Sorry, I guess you couldn’t see my screenshot. Below is my code that demonstrates the problem. It seems like the world itself is already gone when the End code is executed. You don’t even need any code in the method that is called.
Events
While the world is running
Begin:  <None>

During: <None>

End:
world.my first method



Methods
  world.my first method ( )
    No variables
        Do Nothing

—
James Vanderhyde
Assistant Professor, Computer Science
Program Director, Master of Applied Computer Science
Saint Xavier University
3700 W. 103rd St.
Chicago, IL 60655
773-298-3454

On Feb 28, 2017, at 11:46 AM, robert durtschi <robert.durtschi at gcsu.edu<mailto:robert.durtschi at gcsu.edu>> wrote:


Primary use I've made in While the World is Running is using during.
"while the world is running during: seaplane propeller roll 20 times, style abruptly
or
"while the world is running during: CollisionCheck method

the end option would not necessarily be for the world event.
for something like a key pressed event:
    Begin would be triggered on the leading edge of the key press.
    During would be detected as the key is held down.
    End would be triggered on the trailing edge of the key release.

What I suspect is happening in your case is that the event handler disappears when the program stops. What exactly did you put in the "end" section?

Bob Durtschi

________________________________


In Alice 2, you can right-click on the ?When the world starts? event and change it to ?While the world is running.? I?m not sure why this feature is useful, but it doesn?t seem to work completely. If you put something in the ?End? portion of this event, when you Play the animation and then Stop it (or close the window), you get the Queen reporting a NullPointerException. (See attached screenshot.)

I?m not sure what the correct behavior should be. I would like it to do the thing I said in the event before the window closes, but then arbitrary user code could generate an infinite loop and make the window impossible to close. Maybe hitting Stop during the End event could stop it for good, so you have to hit Stop at most twice to close the window.

Or maybe just remove the End option in the event, so we don?t see the error.




------------------------------

End of alice-teachers Digest, Vol 77, Issue 20
**********************************************
[http://lists.andrew.cmu.edu/pipermail/alice-teachers/attachments/20170227/5cffa6d7/attachment-0001.png]
_______________________________________________
alice-teachers mailing list
alice-teachers at lists.andrew.cmu.edu<mailto:alice-teachers at lists.andrew.cmu.edu>
https://lists.andrew.cmu.edu/mailman/listinfo/alice-teachers

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.andrew.cmu.edu/pipermail/alice-teachers/attachments/20170228/f6d675bd/attachment.html>


More information about the alice-teachers mailing list