mirror of
https://github.com/logsol/chuck.js.git
synced 2026-05-11 10:37:34 +00:00
Merge branch 'master' of github.com:logsol/chuck.js
This commit is contained in:
commit
383eaa93bf
4 changed files with 32 additions and 4 deletions
|
|
@ -47,7 +47,7 @@ define({
|
|||
IS_BROWSER_ENVIRONMENT: typeof window !== 'undefined',
|
||||
USE_WEGBL: true,
|
||||
|
||||
DEBUG_MODE: 0,
|
||||
DEBUG_MODE: 1,
|
||||
|
||||
// NETWORKING
|
||||
WORLD_UPDATE_BROADCAST_INTERVAL: 70,
|
||||
|
|
|
|||
|
|
@ -29,10 +29,20 @@ function (Parent, Box2D, Settings) {
|
|||
|
||||
Item.prototype.createFixture = function () {
|
||||
|
||||
var itemShape = new Box2D.Collision.Shapes.b2PolygonShape();
|
||||
var itemShape;
|
||||
var w = this.options.width / Settings.RATIO;
|
||||
var h = this.options.height / Settings.RATIO;
|
||||
|
||||
if(this.options.type == 'circle'){
|
||||
var r = (w + h) / 4 ;
|
||||
itemShape = new Box2D.Collision.Shapes.b2CircleShape();
|
||||
itemShape.SetRadius(r);
|
||||
itemShape.SetLocalPosition(new Box2D.Common.Math.b2Vec2(0, -r));
|
||||
} else {
|
||||
itemShape = new Box2D.Collision.Shapes.b2PolygonShape();
|
||||
itemShape.SetAsOrientedBox(w / 2, h / 2, new Box2D.Common.Math.b2Vec2(0, -(h/2)));
|
||||
}
|
||||
|
||||
|
||||
var fixtureDef = new Box2D.Dynamics.b2FixtureDef();
|
||||
fixtureDef.shape = itemShape;
|
||||
|
|
@ -42,7 +52,11 @@ function (Parent, Box2D, Settings) {
|
|||
var density = ((this.options.weight + offset) / this.options.width / this.options.height) * factor;
|
||||
fixtureDef.density = density;
|
||||
fixtureDef.friction = Settings.ITEM_FRICTION;
|
||||
fixtureDef.restitution = Settings.ITEM_RESTITUTION;
|
||||
|
||||
fixtureDef.restitution = this.options.bounce
|
||||
? this.options.bounce / 10
|
||||
: Settings.ITEM_RESTITUTION;
|
||||
|
||||
fixtureDef.isSensor = false;
|
||||
|
||||
this.body.CreateFixture(fixtureDef);
|
||||
|
|
|
|||
|
|
@ -246,6 +246,20 @@ microwave: 3.744
|
|||
y:0,
|
||||
rotation: 0,
|
||||
grabAngle: -1.5
|
||||
},
|
||||
{
|
||||
name:'Football',
|
||||
image:'football.gif',
|
||||
type:'circle',
|
||||
category:'outdoor',
|
||||
weight: 2,
|
||||
width:10,
|
||||
height:10,
|
||||
x:350,
|
||||
y:0,
|
||||
rotation: 0,
|
||||
grabAngle: -1.5,
|
||||
bounce: 6
|
||||
}
|
||||
],
|
||||
tiles: /*
|
||||
|
|
|
|||
BIN
static/img/Items/outdoor/football.gif
Normal file
BIN
static/img/Items/outdoor/football.gif
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 302 B |
Loading…
Add table
Add a link
Reference in a new issue