Alice Community  

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

Reply
 
Thread Tools Display Modes
Where in Alice3.x is change to "while a key is pressed" event?
Old
mmar
Junior Member
 
Status: Offline
Posts: 11
Join Date: Sep 2011
Default Where in Alice3.x is change to "while a key is pressed" event? - 07-30-2014, 01:22 PM

I'd like to move object unless I release a key. This is very simple with Alice 2.x where I choose event "when a key is typed" and change it into "while a key is pressed". The problem is that I can't find something similar in Alice 3.x.

Thanks for help.
   
Reply With Quote
Good Question
Old
MrMoke
Senior Member
 
MrMoke's Avatar
 
Status: Offline
Posts: 501
Join Date: Sep 2007
Location: Austin, Texas
Default Good Question - 07-30-2014, 04:27 PM

The answer might be to create a new event that handles arrow keypresses, and build the code to make it work the way you want it to.

I created a grass world using 3.1.1.92 , added a Humvee, positioned the camera and locked it to the Humvee, and then experimented with a little code to moveit, moveit, turnit, turnit.

Added an image of the code for you to view.

The Forum squashes image uploads to unreadable sizes, so I zipped it. Just click and open to view it.

Use the image to put your own event together, and Make sure you pay attention to the options I chose, If you get it to work the Humvee should move and turn while the arrow keys are pressed.

Now create backup copy, saved as version 2, and modify the various options to see how they affect performance.
Attached Files
File Type: zip Alice3WhileKeyPressed.zip (170.8 KB, 5 views)

Last edited by MrMoke; 07-30-2014 at 04:39 PM.
   
Reply With Quote
Old
mmar
Junior Member
 
Status: Offline
Posts: 11
Join Date: Sep 2011
Default 07-31-2014, 09:26 AM

MrMoke, code you sent me is ok, but the problem is with FIRE_MULTIPLE trigger on event, because it always stop at the end although begin and end abruptly.

But looks like I recognized the point. Duration must be equal or less than distance. Am I write?

Last edited by mmar; 07-31-2014 at 09:32 AM.
   
Reply With Quote
Not Exactly
Old
MrMoke
Senior Member
 
MrMoke's Avatar
 
Status: Offline
Posts: 501
Join Date: Sep 2007
Location: Austin, Texas
Default Not Exactly - 07-31-2014, 02:01 PM

The duration is only the speed that each individual move or turn is done. Abrupt puts the individual moves and turns together with no slowdown between repetitions.

The durations, distances, and degrees were tweaked until they looked natural to me.

More later, if I have a little time.
   
Reply With Quote
Reply

Tags
alice 3.x event

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 ©2018, Carnegie Mellon University
Alice 2.x 1999-2012, Alice 3.x 2008-2012, Carnegie Mellon University. All rights reserved.