Help please - Press 4 button -
05-24-2011, 10:24 AM
A fan has 4 button - off/high/medium/low. How can I click on a button, the button changes to half-size. Then if another button is pressed, the first button with half-size can be changed back to its original size.
Please see the attached file and could you please let me know how to do the following:
After I click the first button (eg. button 2), the first button (i.e. button 2) resize to half size (half as big/0.5). After that, I press another button (e.g. button 3), the first button (i.e. button 2) will change back to original size (twice as big/2) and the other buttons (i.e. button 0 & 1) will remain unchange.
Im sorry. For somereason I cannot figure this out. I have some of these problems to with my Halo game. But This one is a little bit more tricky than the others. I did manage to get the buttons moving up and down when pressed, but the double size I did not. Also, I am pretty sure the problem has to do with your method with the looping. I got rid of the looping and it still worked. See what you can do from here...
bearmui, you could have a lastClicked variable and everytime you click another button, the object assigned to lastClicked would return to normal size while the object that the user just clicked would change in size. Then you set the button that was just clicked to lastClicked. I hope this helps.
Projects
-Escape the Kitchen
-That ninja animation
-Hill Collision
You might be better off by simply moving the clicked button down by maybe .01 and then back up again when another is clicked.
The fact that the name of the fan was passed when I clicked on any one of the buttons caused me to have to build a click event for each button, although I called only one method to do the changes.
If you use arrays, things could get easier.
bearmui, you could have a lastClicked variable and everytime you click another button, the object assigned to lastClicked would return to normal size while the object that the user just clicked would change in size. Then you set the button that was just clicked to lastClicked. I hope this helps.
reuben2011, can you show me how the object set lastClicked variable? Thx!!!
Im sorry. For somereason I cannot figure this out. I have some of these problems to with my Halo game. But This one is a little bit more tricky than the others. I did manage to get the buttons moving up and down when pressed, but the double size I did not. Also, I am pretty sure the problem has to do with your method with the looping. I got rid of the looping and it still worked. See what you can do from here...
I'll make an example with different objects so that you can get the concept, but so you can't use my work for classwork (if that is what you are doing.)
EDIT: Here it is. Using my favorite object from the Alice gallery.
Projects
-Escape the Kitchen
-That ninja animation
-Hill Collision
Upcoming Projects
-Some penguin adventure game?
Last edited by reuben2011; 05-25-2011 at 03:12 AM.
I'll make an example with different objects so that you can get the concept, but so you can't use my work for classwork (if that is what you are doing.)
Yep, please. I've read the textbook but still couldn't figure it out how I can set the lastclicked variable.