mirror of
https://github.com/logsol/chuck.js.git
synced 2026-05-11 10:37:34 +00:00
control features implemented
This commit is contained in:
parent
8d0ff1a929
commit
c2b0baaea2
10 changed files with 213 additions and 63 deletions
|
|
@ -1,36 +1,27 @@
|
|||
Chuck.Control.InputControlUnit = function() {
|
||||
var KEY_LEFT;
|
||||
var KEY_RIGHT;
|
||||
var KEY_UP;
|
||||
var KEY_DOWN;
|
||||
Chuck.Control.InputControlUnit = function(ki, me) {
|
||||
this._ki = ki;
|
||||
this._me = me;
|
||||
|
||||
var _instance;
|
||||
var _ki;
|
||||
var _me;
|
||||
var _shift;
|
||||
var _isJumping;
|
||||
this._shift;
|
||||
this._isJumping;
|
||||
|
||||
this.KEY_LEFT = 65;
|
||||
this.KEY_RIGHT = 68;
|
||||
this.KEY_UP = 87;
|
||||
this.KEY_DOWN = 83;
|
||||
|
||||
this.init();
|
||||
}
|
||||
Chuck.Control.InputControlUnit.prototype.InputControlUnit = function() {
|
||||
this._me = Processor.getInstance().getMe();
|
||||
this._ki = KeyboardInput.getInstance();
|
||||
|
||||
this._ki.registerKey(KEY_LEFT, this.moveLeft, this.stop, this.moveLeft);
|
||||
this._ki.registerKey(KEY_RIGHT, this.moveRight, this.stop, this.moveRight);
|
||||
this._ki.registerKey(KEY_UP, this.jump, this.jumped, this.jumping);
|
||||
this._ki.registerKey(KEY_DOWN, this.duck, this.standUp, this.duck);
|
||||
this._ki.registerKey(KEY_DOWN, this.activateShift, this.activateShift, this.deactivateShift);
|
||||
|
||||
this._ki.registerKey(37, this.wasd);
|
||||
this._ki.registerKey(38, this.wasd);
|
||||
this._ki.registerKey(39, this.wasd);
|
||||
this._ki.registerKey(40, this.wasd);
|
||||
}
|
||||
|
||||
|
||||
Chuck.Control.InputControlUnit.prototype.wasd = function() {
|
||||
trace('wasd benutzen alter...');
|
||||
Chuck.Control.InputControlUnit.prototype.init = function() {
|
||||
|
||||
this._ki.setInputControlUnit(this);
|
||||
|
||||
this._ki.registerKey(this.KEY_LEFT, 'moveLeft', 'stop', 'moveLeft');
|
||||
this._ki.registerKey(this.KEY_RIGHT, 'moveRight', 'stop', 'moveRight');
|
||||
this._ki.registerKey(this.KEY_UP, 'jump', 'jumped', 'jumping');
|
||||
this._ki.registerKey(this.KEY_DOWN, 'duck', 'standUp', 'duck');
|
||||
this._ki.registerKey(this.KEY_DOWN, 'activateShift', 'activateShift', 'deactivateShift');
|
||||
}
|
||||
|
||||
Chuck.Control.InputControlUnit.prototype.moveLeft = function() {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue