Game Development Reference
In-Depth Information
Natives.sendNativeKeyEvent(Natives.EV_KEYUP,
ScanCodes.sc_LeftArrow);
break;
case KeyEvent.KEYCODE_X:
// strafe right
Natives.sendNativeKeyEvent(Natives.EV_KEYUP,
ScanCodes.sc_Alt);
Natives.sendNativeKeyEvent(Natives.EV_KEYUP,
ScanCodes.sc_RightArrow);
break;
case KeyEvent.KEYCODE_B:
// Fire
Natives.sendNativeKeyEvent(Natives.EV_KEYUP,
ScanCodes.sc_Control);
break;
case KeyEvent.KEYCODE_A:
// shift (Run)
Natives.sendNativeKeyEvent(Natives.EV_KEYUP,
ScanCodes.sc_RShift);
break;
default:
Natives.sendNativeKeyEvent(Natives.EV_KEYUP, ScanCodes
.keySymToScancode(btnCode));
break;
}
}
}
Creating the Movement Controller
The movement controller is designed to provide navigation and other actions for phones with no
keyboard. It is modeled after the popular SNES controller (see Figure 6-5), and provides the following
buttons:
Navigation buttons : For up, down, left, and right rotation
Selection buttons : For the select and start actions
Extra buttons for miscellaneous actions : In Wolf 3D, they are mapped as follows: Y
to strafe left, X to strafe right, B to fire, and A to enable running.
Search WWH ::




Custom Search