View Single Post
Sample World replication
Status: Offline
Posts: 17
Join Date: Dec 2012
Default Sample World replication - 03-04-2013, 10:54 AM

Hello everyone,

I found my question was asked by two people in 2009 but neither of them were answered. Also, I asked in a different forum but don't seem to be getting any response so I have moved it to this forum to see if it might get noticed here.

In the book "Programming with Alice and Java" on page 78, Figure 4.16 shows the following code in an "event" that has been supplied on the CD in a sample world:

While [left button.depressed] is true
Begin: [Nothing]
During: [Left button.playMusic]
End: [Nothing]

On the next page of the textbook we are asked to create this same "event" for three more conditions but no matter what method I try to use the only choice I get is true or false and I am unable to get [middle button.depressed] is true as an option in the "event" while statement.

I have used version 2.0 and version 2.3 but neither version allows me to use this "[middle button.depressed] is true" while creating an "event". However, this option does appear when creating a "method" using a "while" statement.

The textbook example works and plays the music for the left button while the world is running and the left button is depressed because there is a boolean variable called depressed. The textbook is asking me to use the same method to create an "event" that will play music while the center button and the right button are depressed. As stated above, it works in a "method" but not an "event". Obviously Alice is supposed to allow this or the sample world could not have an "event" like the above example already working.

Why won't it let me do this the exact same way as the sample world? What am I missing? Hopefully my explanation has made sense and someone will be able to tell me what I am doing wrong.

Thank you in advance!
Reply With Quote