First successful attempt to implement rube ragdoll into the game. uncomment //type: rube at the bottom of ItemSettings.js to convert banana into invisible ragdoll (only visible in debug mode) - grabbing still pretty buggy.

This commit is contained in:
logsol 2014-05-26 04:22:36 +02:00
parent 135ed724d1
commit ebc3da12fa
8 changed files with 2458 additions and 26 deletions

View file

@ -6,9 +6,10 @@ define([
"Game/" + GLOBALS.context + "/GameObjects/Tile",
"Game/" + GLOBALS.context + "/GameObjects/Item",
"Game/" + GLOBALS.context + "/GameObjects/Items/Skateboard",
"Game/" + GLOBALS.context + "/GameObjects/Items/RagDoll"
"Game/" + GLOBALS.context + "/GameObjects/Items/RagDoll",
"Game/" + GLOBALS.context + "/GameObjects/Items/Rube"
], function (Settings, Box2D, Nc, CollisionDetector, Tile, Item, Skateboard, RagDoll) {
], function (Settings, Box2D, Nc, CollisionDetector, Tile, Item, Skateboard, RagDoll, Rube) {
function Level (uid, engine) {
this.uid = uid;
@ -30,6 +31,27 @@ define([
});
}
Level.prototype.createItem = function(uid, options) {
switch(options.type) {
case 'skateboard':
return new Skateboard(this.engine, uid, options);
case 'ragdoll':
return new RagDoll(this.engine, uid, options);
case 'rube':
return new Rube(this.engine, uid, options);
default:
return new Item(this.engine, uid, options);
}
};
Level.prototype.getRandomSpawnPoint = function() {
throw new Error("Level not loaded.");
return {
x: 150 + Math.random() * 300,
y: -500
};
};
Level.prototype.destroy = function () {
/*
for (var key in this.gameObjects) {
@ -41,6 +63,7 @@ define([
this.isLoaded = false;
}
/* Extended by TiledLevel
Level.prototype.createTiles = function () {
if (!this.levelData || !this.levelData.tiles || this.levelData.tiles.length < 1) {
@ -58,7 +81,9 @@ define([
//);
}
}
*/
/* Extended by TiledLevel
Level.prototype.createItems = function() {
if (!this.levelData || !this.levelData.items) {
return;
@ -72,25 +97,7 @@ define([
//this.gameObjects.animated.push(item);
};
};
Level.prototype.createItem = function(uid, options) {
switch(options.type) {
case 'skateboard':
return new Skateboard(this.engine, uid, options);
case 'ragdoll':
return new RagDoll(this.engine, uid, options);
default:
return new Item(this.engine, uid, options);
}
};
Level.prototype.getRandomSpawnPoint = function() {
throw new Error("Level not loaded.");
return {
x: 150 + Math.random() * 300,
y: -500
};
};
*/
return Level;
})