mirror of
https://github.com/logsol/chuck.js.git
synced 2026-05-12 02:57:34 +00:00
added ASSERT, fixed #103
This commit is contained in:
parent
55eff36f34
commit
dfa71bc8e5
17 changed files with 249 additions and 153 deletions
|
|
@ -1,10 +1,11 @@
|
|||
define([
|
||||
"Game/" + GLOBALS.context + "/GameObjects/Item",
|
||||
"Lib/Vendor/Box2D",
|
||||
"Game/Config/Settings"
|
||||
"Game/Config/Settings",
|
||||
"Lib/Utilities/Assert"
|
||||
],
|
||||
|
||||
function (Parent, Box2D, Settings) {
|
||||
function (Parent, Box2D, Settings, Assert) {
|
||||
|
||||
"use strict";
|
||||
|
||||
|
|
@ -27,6 +28,8 @@ function (Parent, Box2D, Settings) {
|
|||
Skateboard.prototype = Object.create(Parent.prototype);
|
||||
|
||||
Skateboard.prototype.createFixture = function () {
|
||||
Assert.number(this.options.width, this.options.height);
|
||||
Assert.number(this.options.weight);
|
||||
|
||||
var deckShape = new Box2D.Collision.Shapes.b2PolygonShape();
|
||||
var w = this.options.width / Settings.RATIO;
|
||||
|
|
@ -45,10 +48,12 @@ function (Parent, Box2D, Settings) {
|
|||
fixtureDef.isSensor = false;
|
||||
|
||||
this.body.CreateFixture(fixtureDef);
|
||||
}
|
||||
};
|
||||
|
||||
Skateboard.prototype.addWheel = function(x, y) {
|
||||
|
||||
Assert.number(x, y);
|
||||
|
||||
var bodyDef = new Box2D.Dynamics.b2BodyDef();
|
||||
bodyDef.type = Box2D.Dynamics.b2Body.b2_dynamicBody;
|
||||
bodyDef.position.x = x / Settings.RATIO;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue