Alice Community  

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

Reply
 
Thread Tools Display Modes
Keybinding
Old
Arvas
Guest
 
Status:
Posts: n/a
Default Keybinding - 09-14-2010, 01:08 PM

Okay, I literally started using Alice about 40 minutes ago. And my teacher has tasked me with figuring out how to make the character walk while a SPECIFIC key is pressed. I figured out how to make him move while a key is pressed, but not a specific key. Is there something easy I'm missing? Any help would be awesome. Thank you!
~Arvas

Pic for clarification:
   
Reply With Quote
Keybinding
Old
hgs
Guest
 
Status:
Posts: n/a
Default Keybinding - 09-14-2010, 03:10 PM

Are you happy about what the keyPressed procedure is doing so far, and what a keyEvent means?

Your keyEvent is called w. Of the buttons at the top, "do in order", "count...", and so on, which will allow you to make a decision as to whether something is true or not?

You need to make a decision about whether to move before moving....

Hopefully that is enough of a hint.
   
Reply With Quote
Old
Arvas
Guest
 
Status:
Posts: n/a
Default 09-15-2010, 12:10 PM

I'm still confused a bit. I'm trying to bind moving forward to the "w" key. Instead the current code only recognizes that I'm pressing keys on the keyboard. Does that make sense? I need it to only register, and move the character forward on "w" key pressed. Maybe I misread your post but I still don't quite get it. :S
   
Reply With Quote
Old
SlithyToves
Member
 
SlithyToves's Avatar
 
Status: Offline
Posts: 20
Join Date: Sep 2010
Location: USA
Default 09-15-2010, 01:16 PM

hgs was hinting about how to do it, and I will give a little clearer hint, I hope. Your code will need to be something like,
Code:
this.pirate add Keylistener: declare procedure KeyPressed, with parameter KeyEvent w
do in order
Here is where you will need to choose whether to move the pirate or not.
You will need to choose from the list(image attached) one that will let you choose "if ___ is TRUE do ___" and "if ___ is FALSE do ___ (in your case, nothing)"

If my hint wasn't good enough, just post another message, and I will tell you the WHOLE step-by-step (maybe).

Hope this helps!
Attached Images
File Type: jpg attachment1.jpg (4.9 KB, 39 views)


SlithyToves

"Twas brillig, and the slithy toves
Did gyre and gimble in the wabe"
   
Reply With Quote
Old
Arvas
Guest
 
Status:
Posts: n/a
Default 09-15-2010, 01:54 PM

Quote:
Originally Posted by SlithyToves View Post
hgs was hinting about how to do it, and I will give a little clearer hint, I hope. Your code will need to be something like,
Code:
this.pirate add Keylistener: declare procedure KeyPressed, with parameter KeyEvent w
do in order
Here is where you will need to choose whether to move the pirate or not.
You will need to choose from the list(image attached) one that will let you choose "if ___ is TRUE do ___" and "if ___ is FALSE do ___ (in your case, nothing)"

If my hint wasn't good enough, just post another message, and I will tell you the WHOLE step-by-step (maybe).

Hope this helps!
Thank you, I actually managed to figure it out a while ago now. XD
The main issue was that i didn't know if you put an if then statment inside you can change it to specific keys. Now my issue is that controling a character is, terrible. Lol. Bad, maybe I can find a solution, thanks guys!
   
Reply With Quote
Old
SlithyToves
Member
 
SlithyToves's Avatar
 
Status: Offline
Posts: 20
Join Date: Sep 2010
Location: USA
Default 09-15-2010, 03:17 PM

You're welcome. You might be interested in this thread: http://www.alice.org/community/showthread.php?t=4990, about the Sims people in Alice 3 walking.


SlithyToves

"Twas brillig, and the slithy toves
Did gyre and gimble in the wabe"
   
Reply With Quote
Still Confused
Old
jasen
Guest
 
Status:
Posts: n/a
Default Still Confused - 11-14-2010, 11:07 PM

Sorry I still very new at this. I have read the post over and over again and have yet to figure out how to choose a key. I understand what both of you are saying about having an if statement but I do not understand how to write it. If you could help me I would be great-full. Thanks, Jasen
   
Reply With Quote
Old
MagicLocked
Junior Member
 
Status: Offline
Posts: 1
Join Date: Sep 2018
Default 09-10-2018, 03:28 PM

[QUOTE=SlithyToves;25322]hgs was hinting about how to do it, and I will give a little clearer hint, I hope. Your code will need to be something like,
Code:
this.pirate add Keylistener: declare procedure KeyPressed, with parameter KeyEvent w
do in order
Here is where you will need to choose whether to move the pirate or not.
You will need to choose from the list(image attached) one that will let you choose "if ___ is TRUE do ___" and "if ___ is FALSE do ___ (in your case, nothing)"


How do I set my key event to "w"?
   
Reply With Quote
Just look at this for help
Old
kelbstar123
Member
 
Status: Offline
Posts: 20
Join Date: Feb 2018
Talking Just look at this for help - 09-15-2018, 10:06 PM

https://drive.google.com/file/d/1FPJ...ew?usp=sharing
Trust me this may look really bad but it took me ages
   
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.