Computer Science Canada I've been using turing for 2 weeks.. I need 5 seconds !! |
Author: | Soapies [ Wed Jun 07, 2006 10:21 pm ] | ||
Post subject: | I've been using turing for 2 weeks.. I need 5 seconds !! | ||
You guys probably have this code memorized so if you wouldn't mind helping me out here... All I need to do is know how to make a clickable box that .. say.. turns a light red with one click, but then turns the light back to white with another click. So far I have been able to make it work with two boxes.. One for ON the other for OFF.. but for my culminating activity .. (we're making a program that will add two binary numbers together then show the correct answer with LEDs on a circuit diagram connected through the parallel port).. and.. yeah I'm having a hard time getting a button that will turn on and off.. This is the best I can get (in it's most basic out-of-the-text format)
Is there a way to turn the light on and off with only one button? My teacher tried looking, but he had a problem too.. |
Author: | Soapies [ Wed Jun 07, 2006 10:25 pm ] |
Post subject: | |
P.S. If this helps at all, I'm using "const" and "drawbox (whateverinamedtheconst)" for my culminating.. I tried using a "loop" but my teacher says it has something to do with the boolean equation.. heh. |
Author: | Anonymous [ Wed Jun 07, 2006 10:38 pm ] |
Post subject: | |
If you know how to use boolean, make a boolean variable that returns true when it is first press, then returns false when pressed again, etc. I'll work on some code to help you right now.. |
Author: | Anonymous [ Wed Jun 07, 2006 10:41 pm ] | ||
Post subject: | |||
Try this:
But you will have to figure out how to delay it if it clicks too fast... |
Author: | TheOneTrueGod [ Thu Jun 08, 2006 7:20 am ] | ||
Post subject: | |||
vahnx, don't just give him code. Soapies, all you have to do is have an "oldbutton" variable. Just before the mousewhere statement, set oldbutton to button. You'll get an error, but i'll leave it up to you to fix that ![]() then, the if statement should be
good luck |
Author: | Soapies [ Thu Jun 08, 2006 3:41 pm ] |
Post subject: | |
Thanks guys! I left my disk at school (in the auditorium too! eeek), so I won't be able to put it in, but I deffinately will once I get the chance and I thank you a lot because I reeally couldn't figure it out. and just for the record, I'm a girl ![]() Edit: I tried it and it works amazingly! I was able to put a delay in it and.. IT WORKS!!! Haha, I'm just really happy because it wasn't as hard as it seemed to be. Thanks, both of you, for your help! |