alice-teacher another question

James Vanderhyde jvanderhyde at benedictine.edu
Thu Nov 10 15:18:01 EST 2011


Emily,

That will require a little extra work. Your event handler method will have to have an if/else block, with roll left in the if block and roll right in the else block. Also, you need a boolean variable in the penguin that switches back and forth between true and false with each press. This variable becomes the condition for the if statement.

Is that helpful? I'll give more detail if you like.

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




On 11/10/11 9:59 AM, "Emily Higgins" <erphiggins at gmail.com> wrote:

Hi All -
Is it possible to have two different actions associated with one event?  My student wants the penguin to take one step with each pressing of the up arrow key.  In other words, the penguin would roll left with the first press, roll right with the second press.

Thank you again for all your help.
Emily Higgins
Boothbay Harbor, Maine

-------------- next part --------------
An HTML attachment was scrubbed...
URL: https://lists.andrew.cmu.edu/mailman/private/alice-teachers/attachments/20111110/f7ff11fa/attachment.html 


More information about the alice-teachers mailing list