Alice Community

Alice Community (
-   How do I...? (
-   -   Real Combination Lock (

facilitator22 05-12-2011 01:25 PM

Real Combination Lock
I need to make a combination lock turn and keep turning when you hit the left key(same for the right key). Also i need to make it stop using the up arrow key. I can do that but the hard part is getting it to recognize a combination. I don't know to make it work like an actual lock so if you could help PLEASE!

Dameria 05-12-2011 04:16 PM

To make it keep turning, you use a "When key is pressed" event, and then right click it and change it to "While key is being pressed", and then in the "During" section of that you put code to turn the lock just a very small amount instantly with a duration of close to "0" so that it can happen pretty fast (mess around with duration to make the lock rotate faster or slower). Then you would have to use trigonometry to find the rotation that the lock is currently set to, and use a fraction of the degree angle to calculate approximately what number it would be set at. If you haven't taken trigonometry then you probably don't know how to use the sine, cosine, and tangent functions, so idk how else you could do it easily. Cosine would most likely be used, but idk, im guessing on that one. Its not easy unless you know what your doing.

sfunk 05-12-2011 05:01 PM

you could just use dummy objects so once one is in the vacinity of the right combination it will activate your method

facilitator22 05-13-2011 11:01 AM

I know how to use cos sin and tan. But i don't understand what you mean when you say use angles to make it find the number its suppose to go to. Maybe I didn't explain it right.
The project is make the lock turn clockwise 2 times then to 21. Then counterclockwise to 5. Then clockwise to 18. You need to make it turn left when you hit the left key and right on the right key. Then stop when you hit up.

facilitator22 05-13-2011 01:17 PM

[QUOTE=sfunk;35627]you could just use dummy objects so once one is in the vacinity of the right combination it will activate your method[/QUOTE]

Thanks i think i got it figured out

Dameria 05-14-2011 10:19 AM

Oh sorry I didn't know it was just a simple animation lock turning method. That can easily be done with rotating the centerpiece of the lock to either the left or the right at certain numbers, you would have to guess and check your way by going higher or lower depending on how far off you are each time you run the program.

All times are GMT -5. The time now is 11:44 PM.

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