Addedd small deadzone
This commit is contained in:
parent
f0f3eb85ac
commit
e615516aee
13
script.js
13
script.js
|
@ -132,8 +132,7 @@ Viewer.prototype = {
|
||||||
this.client.on('ballAppear', function (id) {
|
this.client.on('ballAppear', function (id) {
|
||||||
if (!_this.balls[id]) {
|
if (!_this.balls[id]) {
|
||||||
_this.balls[id] = new BallView(_this, this.balls[id]);
|
_this.balls[id] = new BallView(_this, this.balls[id]);
|
||||||
} else {
|
} else {}
|
||||||
}
|
|
||||||
});
|
});
|
||||||
// this.client.on('ballDestroy', function(id) {
|
// this.client.on('ballDestroy', function(id) {
|
||||||
// delete this.balls[id];
|
// delete this.balls[id];
|
||||||
|
@ -234,10 +233,16 @@ Pointer.prototype = {
|
||||||
},
|
},
|
||||||
pointermove: function (e) {
|
pointermove: function (e) {
|
||||||
var gamePos = e.data.getLocalPosition(this.viewer.stage);
|
var gamePos = e.data.getLocalPosition(this.viewer.stage);
|
||||||
this.dest = { // TODO deadzone
|
this.dest = {
|
||||||
x: gamePos.x - this.viewer.cam.x.get(),
|
x: gamePos.x - this.viewer.cam.x.get(),
|
||||||
y: gamePos.y - this.viewer.cam.y.get()
|
y: gamePos.y - this.viewer.cam.y.get()
|
||||||
};
|
};
|
||||||
|
if (Math.abs(this.dest.x) < 10 && Math.abs(this.dest.x) < 10) {
|
||||||
|
this.dest = {
|
||||||
|
x: 0,
|
||||||
|
y: 0
|
||||||
|
};
|
||||||
|
}
|
||||||
this.move();
|
this.move();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -249,7 +254,7 @@ function Controller(client) {
|
||||||
region: 'EU-London',
|
region: 'EU-London',
|
||||||
ip: '127.0.0.1',
|
ip: '127.0.0.1',
|
||||||
port: 9158
|
port: 9158
|
||||||
}
|
};
|
||||||
this.nick = 'agario-client';
|
this.nick = 'agario-client';
|
||||||
this.autoRespawn = false;
|
this.autoRespawn = false;
|
||||||
|
|
||||||
|
|
Reference in a new issue