ID:259898
Feb 10 2005, 3:16 am
|
|
If a player presses both the up and left arrow at the same time, the command "Northeast()" should be sent. If the command returns 0, it works like it does now.
|
In response to Shadowdarke
|
|
it wouldn't necessarily be calling North or Northwest, you'd have to handle what to do with the keystrokes yourself. it would just tell you when a key is pressed (or released), so you can keep track of which keys are down and then you could check if "up" and "left" and being pressed, then you step to the northwest.
it seems to work pretty well, especially for certain types of games. people want to make diagonal jumping in sidescrolling games, but if you use javascript for the input, then you can jump and hold down right, and you continually move right as soon as you hit the key, instead of having to wait for the key repeat rate to kick in. or you can jump while running and you don't stop moving in the direction you were running. |
In response to OneFishDown
|
|
Having a client variable 'focus', and a client proc focus_change() (gets called when the focus is changed) would help with this kind of thing.
|
If you are desperate for the technology now, you can create a Javascript popup to track key presses. OFD has a demo discussed in Post ID:288403, and my own experiments even allow you to use invisible popups for it. (Use a size of 0x0 with the titlebar, minimize, and close buttons turned off. ;) It's hard to get people to leave the focus on the popup window if they don't know where it is. You'll have to refocus the input window every time your game detects input that doesn't come throgh the Javascript.)