control features implemented

This commit is contained in:
logsol 2012-06-03 18:22:27 +02:00
parent 8d0ff1a929
commit c2b0baaea2
10 changed files with 213 additions and 63 deletions

View file

@ -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() {