mirror of
https://github.com/logsol/chuck.js.git
synced 2026-05-11 10:37:34 +00:00
added joints
This commit is contained in:
parent
fa110ff4a8
commit
764220675b
10 changed files with 111 additions and 24 deletions
|
|
@ -1,10 +1,11 @@
|
|||
define([
|
||||
"Game/Client/Control/Input/XyInput",
|
||||
"Game/Client/View/DomController",
|
||||
"Game/Config/Settings"
|
||||
"Game/Config/Settings",
|
||||
"Lib/Utilities/NotificationCenter"
|
||||
],
|
||||
|
||||
function (Parent, DomController, Settings) {
|
||||
function (Parent, DomController, Settings, NotificationCenter) {
|
||||
|
||||
function MouseInput() {
|
||||
Parent.call(this);
|
||||
|
|
@ -30,6 +31,14 @@ function (Parent, DomController, Settings) {
|
|||
|
||||
self.onXyChange(x, y);
|
||||
}
|
||||
|
||||
canvas.onmousedown = function(e) {
|
||||
|
||||
var x = (((e.clientX - this.offsetLeft) / Settings.STAGE_WIDTH) * 2) - 1;
|
||||
var y = (((Settings.STAGE_HEIGHT - (e.clientY - this.offsetTop)) / Settings.STAGE_HEIGHT) * 2) -1;
|
||||
|
||||
NotificationCenter.trigger("input/onHandAction", x, y);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -12,10 +12,8 @@ function (NotificationCenter) {
|
|||
XyInput.prototype.onXyChange = function(x, y) {
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
NotificationCenter.trigger('onXyChange', x, y);
|
||||
NotificationCenter.trigger('input/onXyChange', x, y);
|
||||
}
|
||||
|
||||
|
||||
|
||||
return XyInput;
|
||||
|
||||
|
|
|
|||
|
|
@ -14,7 +14,8 @@ function (Parent, KeyboardInput, MouseInput, NotificationCenter) {
|
|||
this.keyboardInput = new KeyboardInput(this);
|
||||
this.xyInput = new MouseInput(this);
|
||||
|
||||
NotificationCenter.on("onXyChange", this.setXY, this);
|
||||
NotificationCenter.on("input/onXyChange", this.setXY, this);
|
||||
NotificationCenter.on("input/onHandAction", this.handAction, this);
|
||||
|
||||
var keys = {
|
||||
w:87,
|
||||
|
|
@ -71,6 +72,12 @@ function (Parent, KeyboardInput, MouseInput, NotificationCenter) {
|
|||
NotificationCenter.trigger('sendGameCommand', 'lookAt', options);
|
||||
};
|
||||
|
||||
PlayerController.prototype.handAction = function(x, y) {
|
||||
var options = {x:x, y:y};
|
||||
Parent.prototype.handAction.call(this, options);
|
||||
NotificationCenter.trigger("sendGameCommand", "handAction", options);
|
||||
};
|
||||
|
||||
PlayerController.prototype.update = function () {
|
||||
this.keyboardInput.update();
|
||||
Parent.prototype.update.call(this);
|
||||
|
|
|
|||
|
|
@ -39,7 +39,6 @@ function (Settings) {
|
|||
}
|
||||
|
||||
DomController.createDebugCanvas = function () {
|
||||
console.log('setHERE')
|
||||
var container = DomController.getCanvasContainer();
|
||||
if(DomController.debugCanvas) {
|
||||
container.removeChild(DomController.debugCanvas);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue