implemented rubedoll direction flip and added meshIndex (z) swapping capability. #151

This commit is contained in:
logsol 2015-04-29 00:04:17 +02:00
parent da7e0758bb
commit fb3ac40d17
12 changed files with 483 additions and 389 deletions

View file

@ -9,10 +9,10 @@ define([
"Game/Channel/Player",
"Game/Channel/GameObjects/GameObject",
"Game/Channel/GameObjects/Doll",
"Game/Channel/GameObjects/Items/RagDoll"
"Game/Channel/GameObjects/Items/RubeDoll"
],
function (Parent, PhysicsEngine, Settings, PlayerController, requestAnimFrame, Nc, Box2D, Player, GameObject, Doll, RagDoll) {
function (Parent, PhysicsEngine, Settings, PlayerController, requestAnimFrame, Nc, Box2D, Player, GameObject, Doll, RubeDoll) {
"use strict";
@ -172,7 +172,7 @@ function (Parent, PhysicsEngine, Settings, PlayerController, requestAnimFrame, N
var objects = [];
for (var i = 0; i < this.gameObjects.animated.length; i++) {
if(this.gameObjects.animated[i] instanceof RagDoll) {
if(this.gameObjects.animated[i] instanceof RubeDoll) {
var object = this.gameObjects.animated[i];
var options = object.options;
options.x = object.getPosition().x;

View file

@ -9,10 +9,20 @@ function (Parent, Settings, Nc) {
"use strict";
function RubeDoll(physicsEngine, uid, options) {
this.scheduledForDestruction = false;
this.destructionTimeout = null;
Parent.call(this, physicsEngine, uid, options);
}
RubeDoll.prototype = Object.create(Parent.prototype);
RubeDoll.prototype.beingGrabbed = function(player) {
Parent.prototype.beingGrabbed.call(this, player);
if(this.scheduledForDestruction) {
clearTimeout(this.destructionTimeout);
}
};
RubeDoll.prototype.beingReleased = function(player) {
Parent.prototype.beingReleased.call(this, player);