Alice Community  

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

Reply
 
Thread Tools Display Modes
Real Combination Lock
Old
facilitator22
Guest
 
Status:
Posts: n/a
Default Real Combination Lock - 05-12-2011, 01:25 PM

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!
   
Reply With Quote
Old
Dameria
Senior Member
 
Dameria's Avatar
 
Status: Offline
Posts: 978
Join Date: Sep 2009
Location: United States
Default 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.


Check out my best projects so far and please comment:

Tic-Tac-Toe 2.0 ................... http://www.alice.org/community/showthread.php?t=3548
Alice Paint ........................... http://www.alice.org/community/showthread.php?p=23408
Real-Time Clock .................. http://www.alice.org/community/showthread.php?p=12725
Maze Game ......................... http://www.alice.org/community/showthread.php?t=4301
   
Reply With Quote
Old
sfunk
Senior Member
 
sfunk's Avatar
 
Status: Offline
Posts: 1,112
Join Date: Mar 2011
Location: I don't know
Default 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


If you are stuck on a project, check out the tutorials I made here at this link:

http://alice.org/community/showthread.php?p=36778#post36778

There are lots of tutorials on it so far, including some youtube videos, check it out

Or..

Go to my youtube channel to check out my alice 2.2 tutorials I have there..

http://www.youtube.com/user/sfunk1992?feature=mhsn
   
Reply With Quote
Old
facilitator22
Guest
 
Status:
Posts: n/a
Default 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.
   
Reply With Quote
Old
facilitator22
Guest
 
Status:
Posts: n/a
Default 05-13-2011, 01:17 PM

Quote:
Originally Posted by sfunk View Post
you could just use dummy objects so once one is in the vacinity of the right combination it will activate your method
Thanks i think i got it figured out
   
Reply With Quote
Old
Dameria
Senior Member
 
Dameria's Avatar
 
Status: Offline
Posts: 978
Join Date: Sep 2009
Location: United States
Default 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.


Check out my best projects so far and please comment:

Tic-Tac-Toe 2.0 ................... http://www.alice.org/community/showthread.php?t=3548
Alice Paint ........................... http://www.alice.org/community/showthread.php?p=23408
Real-Time Clock .................. http://www.alice.org/community/showthread.php?p=12725
Maze Game ......................... http://www.alice.org/community/showthread.php?t=4301
   
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 ©2019, Carnegie Mellon University
Alice 2.x 1999-2012, Alice 3.x 2008-2012, Carnegie Mellon University. All rights reserved.