Keyboard key variables?
Is it possible to add a "key" variable to Alice, and to modify the [I]When a key is typed[/I] events accordingly?
For example, "Key" = Spacebar If "Key" is pressed, execute method. This would make it easier for games to have keys that can be reassigned during play. Also, can you add other keys like control, alt, shift, and the number pad buttons to the list of keys? |
i heard, using scripting you can.
|
[QUOTE=room14;43590]i heard, using scripting you can.[/QUOTE]
I think adding more keys, but not making keys variables, there is a cheap way to making keys a variable though, using boolean/number variables and if/else statements |
Use the [URL="http://www.bbdsoft.com/ascii.html"]ASCII key table[/URL].
Alice detects keys as ASCII in decimals. What you can do is make a key map. Unfortunately, this method is expensive. I'm doing it now using purely booleans. Even in my boss rig, this is taking a very long time because Alice feels like rendering 127 nested if/else statements every time I make a change. |
More keys for When "<key> is typed" event
Edit your \Required\resources\common\StandardResources.py file.
Find this section in the file: ["edu.cmu.cs.stage3.alice.core.behavior.KeyClickBeh avior", ["keyCode", java.awt.event.KeyEvent.VK_SPACE, java.awt.event.KeyEvent.VK_ENTER, ... Add the items/keys you want. If you are not sure of the keyCode, refer to [url]http://docs.oracle.com/javase/7/docs.../KeyEvent.html[/url] Repeat for (if needed): ["edu.cmu.cs.stage3.alice.core.behavior.KeyIsPresse dBehavior", ["keyCode", java.awt.event.KeyEvent.VK_SPACE, java.awt.event.KeyEvent.VK_ENTER,... |
All times are GMT -5. The time now is 04:30 AM. |
Copyright ©2024, Carnegie Mellon University
Alice 2.x © 1999-2012, Alice 3.x © 2008-2012, Carnegie Mellon University. All rights reserved.