mirror of
https://github.com/logsol/chuck.js.git
synced 2026-05-11 18:47:35 +00:00
fixed remote joint
This commit is contained in:
parent
0665348ae2
commit
b159bbb1cc
12 changed files with 143 additions and 29 deletions
|
|
@ -2,8 +2,32 @@ define([
|
|||
"Game/Core/GameObjects/Doll"
|
||||
],
|
||||
|
||||
function(Parent) {
|
||||
function (Parent) {
|
||||
|
||||
return Parent;
|
||||
function Doll(physicsEngine, uid, player) {
|
||||
Parent.call(this, physicsEngine, uid, player);
|
||||
}
|
||||
|
||||
Doll.prototype = Object.create(Parent.prototype);
|
||||
|
||||
Doll.prototype.findCloseItem = function(x, y) {
|
||||
|
||||
function findItem(array) {
|
||||
for (var i = 0; i < array.length; i++) {
|
||||
var item = array[i];
|
||||
if(item.isGrabbingAllowed(this.player)) {
|
||||
return item;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (x < 0) { // looking left
|
||||
return findItem(this.reachableItems.left);
|
||||
} else {
|
||||
return findItem(this.reachableItems.right);
|
||||
}
|
||||
}
|
||||
|
||||
return Doll;
|
||||
|
||||
});
|
||||
Loading…
Add table
Add a link
Reference in a new issue