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
|
|
@ -12,6 +12,7 @@ function (Doll, Settings) {
|
|||
this.doll;
|
||||
this.id = id;
|
||||
this.isSpawned = false;
|
||||
this.holdingItem = null;
|
||||
}
|
||||
|
||||
Player.prototype.getDoll = function() {
|
||||
|
|
@ -45,6 +46,21 @@ function (Doll, Settings) {
|
|||
if(this.doll) this.doll.lookAt(x, y);
|
||||
}
|
||||
|
||||
Player.prototype.handAction = function(x, y) {
|
||||
|
||||
if (this.holdingItem) {
|
||||
// throw
|
||||
this.doll.throw(this.holdingItem, x, y);
|
||||
this.holdingItem = null;
|
||||
} else {
|
||||
// take
|
||||
var item = this.doll.grab(x, y);
|
||||
if(item) {
|
||||
this.holdingItem = item;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
Player.prototype.update = function () {
|
||||
|
||||
if(this.doll) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue