xxxxxxxxxx
18
function Car(x, y, w, h, r) {
this.car = new Box(x, y, w, h, {
restitution: 0
});
this.leftWheel = new Ball(x - w / 2 + r, y + h / 2 - r / 2, r, {
restitution: 0
});
this.rightWheel = new Ball(x + w / 2 - r, y + h / 2 - r / 2, r, {
restitution: 0
});
World.add(world, [this.car, this.leftWheel, this.rightWheel]);
this.show = function() {
this.car.show();
this.leftWheel.show();
this.rightWheel.show();
}
}