Alice Community  

Go Back   Alice Community > Alice 2 > How do I...?

Reply
 
Thread Tools Display Modes
Event "While ... true"
Old
talmalee
Member
 
Status: Offline
Posts: 17
Join Date: Dec 2012
Default Event "While ... true" - 02-28-2013, 06:27 PM

Hello everyone,

I found my question was asked by two people in 2009 but neither of them were answered so I am going to ask it again.

In the book "Programming with Alice and Java" on page 78, Figure 4.16 shows:

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

On the next page 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.

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, I can use it in a method when using using a "While" statement.

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
One could only Guess
Old
MrMoke
Senior Member
 
MrMoke's Avatar
 
Status: Offline
Posts: 501
Join Date: Sep 2007
Location: Austin, Texas
Default One could only Guess - 02-28-2013, 09:04 PM

Since we don't all have your textbook with us.

Maybe you could-
  1. Drag a button object into the world.
  2. Rename it to "Left Button".
  3. Create a boolean variable for it called "depressed".
  4. Create a method for it called "PlayMusic".
  5. Work from there.
   
Reply With Quote
Need to make it work in an "Event"
Old
talmalee
Member
 
Status: Offline
Posts: 17
Join Date: Dec 2012
Default Need to make it work in an "Event" - 02-28-2013, 09:44 PM

Thank you for the ideas. There are many ways to get the same effect but 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 in the original post, it works in a "method" but not an "event". Obviously Alice is supposed to allow it or the sample world could not have an "event" like the above example already working.

Why won't it let me do it the exact same way as the sample world? What am I missing?
   
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump



Copyright ©2024, Carnegie Mellon University
Alice 2.x © 1999-2012, Alice 3.x © 2008-2012, Carnegie Mellon University. All rights reserved.