mirror of
https://github.com/logsol/chuck.js.git
synced 2026-05-11 10:37:34 +00:00
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:
parent
135ed724d1
commit
ebc3da12fa
8 changed files with 2458 additions and 26 deletions
9
app/Game/Channel/GameObjects/Items/Rube.js
Normal file
9
app/Game/Channel/GameObjects/Items/Rube.js
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
define([
|
||||
"Game/Core/GameObjects/Items/Rube"
|
||||
],
|
||||
|
||||
function (Parent) {
|
||||
|
||||
return Parent;
|
||||
|
||||
});
|
||||
26
app/Game/Client/GameObjects/Items/Rube.js
Normal file
26
app/Game/Client/GameObjects/Items/Rube.js
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
define([
|
||||
"Game/Core/GameObjects/Items/Rube"
|
||||
],
|
||||
|
||||
function (Parent) {
|
||||
|
||||
function Rube(physicsEngine, uid, options) {
|
||||
Parent.call(this, physicsEngine, uid, options);
|
||||
}
|
||||
|
||||
Rube.prototype = Object.create(Parent.prototype);
|
||||
|
||||
Rube.prototype.createMesh = function() {
|
||||
};
|
||||
|
||||
Rube.prototype.destroy = function() {
|
||||
};
|
||||
|
||||
Rube.prototype.render = function() {
|
||||
}
|
||||
|
||||
Rube.prototype.flip = function(direction) {
|
||||
};
|
||||
|
||||
return Rube;
|
||||
});
|
||||
|
|
@ -350,6 +350,22 @@ define(function() {
|
|||
|
||||
"grabAngle": "-0.4",
|
||||
},
|
||||
|
||||
|
||||
|
||||
|
||||
"Rube":
|
||||
{
|
||||
"category": "kitchen",
|
||||
"image": "banana.gif",
|
||||
|
||||
// "type": "rube",
|
||||
"weight": "1",
|
||||
"width": "5",
|
||||
"height": "9",
|
||||
|
||||
"grabAngle": "0.5",
|
||||
}
|
||||
}
|
||||
|
||||
return ItemSettings;
|
||||
|
|
|
|||
1408
app/Game/Core/GameObjects/Items/Rube.js
Normal file
1408
app/Game/Core/GameObjects/Items/Rube.js
Normal file
File diff suppressed because it is too large
Load diff
|
|
@ -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;
|
||||
})
|
||||
Loading…
Add table
Add a link
Reference in a new issue