Alice Community

Alice Community (http://www.alice.org/community/index.php)
-   How do I...? (http://www.alice.org/community/forumdisplay.php?f=16)
-   -   Keybinding (http://www.alice.org/community/showthread.php?t=5005)

Arvas 09-14-2010 12:08 PM

Keybinding
 
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:
[IMG]http://i553.photobucket.com/albums/jj387/Arvas_Drevan/ugh.png[/IMG]

hgs 09-14-2010 02:10 PM

Keybinding
 
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.

Arvas 09-15-2010 11:10 AM

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

SlithyToves 09-15-2010 12:16 PM

1 Attachment(s)
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 [B]KeyPressed[/B], with parameter KeyEvent [B]w[/B]
do in order
[B][I]Here is where you will need to choose whether to move the pirate or not.[/I][/B][/CODE]

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!

Arvas 09-15-2010 12:54 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 [B]KeyPressed[/B], with parameter KeyEvent [B]w[/B]
do in order
[B][I]Here is where you will need to choose whether to move the pirate or not.[/I][/B][/CODE]

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![/QUOTE]

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!

SlithyToves 09-15-2010 02:17 PM

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

jasen 11-14-2010 10:07 PM

Still Confused
 
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

MagicLocked 09-10-2018 02: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 [B]KeyPressed[/B], with parameter KeyEvent [B]w[/B]
do in order
[B][I]Here is where you will need to choose whether to move the pirate or not.[/I][/B][/CODE]

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"?

kelbstar123 09-15-2018 09:06 PM

Just look at this for help
 
[url]https://drive.google.com/file/d/1FPJ1-yeSpn_3YLRyMqeV7lgtsEa67UWy/view?usp=sharing[/url]
Trust me this may look really bad but it took me ages


All times are GMT -5. The time now is 03:53 PM.

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