GithubHelp home page GithubHelp logo

boxbox's People

Contributors

incompl avatar jaredwilli avatar joaompinto avatar theaustindixon avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

boxbox's Issues

Update README with information about grunt

Just wasted a bunch of time trying to get grunt 0.4 working, not realizing the project needs 0.3.

If there's interest, I wouldn't mind migrating the build system to grunt 0.4, although it's more complex.

Cannot get sprite sheet to render any sprites

I cant seem to figure out how to render a sprite using a sprite sheet when creating entities

What I have tried

 var x = world.createEntity({
                            name: 'player' + getRandomInt(100, 100000),
                            x: baseX + pos.x,
                            y: baseY + pos.y,
                            height: 18,
                            width: 10,
                            friction: .3,
                            image: "assets/sprites.png",
                            spriteSheet: true,
                            spriteWidth: 10,
                            spriteHeight: 18,
                            spriteX: 425,
                            spriteY: 5,
                            fixedRotation: true,

                            restitution: 50
                       });

have also tried, for fun

 var x = world.createEntity({
                            name: 'player' + getRandomInt(100, 100000),
                            x: baseX + pos.x,
                            y: baseY + pos.y,
                            height: 18,
                            width: 10,
                            friction: .3,
                            spriteSheet: sheetImgObj,
                            spriteWidth: 10,
                            spriteHeight: 18,
                            spriteX: 425,
                            spriteY: 5,
                            fixedRotation: true,

                            restitution: 50
                       });

but all I get is empty sprites. Any help on this would be greatly appreciated

Uncaught TypeError: Cannot read property 'getContext' of null

(function() {

if (window.DeviceOrientationEvent) {
    console.log("DeviceOrientation is supported");
}

var canvasElem = document.getElementById("myCanvas");

var canvasElem = document.getElementById("myCanvas");
var world = boxbox.createWorld(canvasElem, {
    gravity: {x: 0, y: 20},
    scale: 60
});

})();

in console Chrome Uncaught TypeError: Cannot read property 'getContext' of null
in console Firefox TypeError: this._canvas is null

imageStretchToFit doesn't work, Entity has wrong boundaries

If I try to add a background image to an entity, the image is displayed on a completely wrong position. The Image has a size of 100x100px and I use imageStretchToFit for scaling.
My code looks like the following:

    var canvas = document.getElementById("canvas"),
        world = boxbox.createWorld(canvas);

    var floor = world.createEntity({
        width: 35,
        height: 0.5,
        color: "#000000"
    }, {
        x: 0,
        y: 16,
        type: "static"
    });

    var torso = world.createEntity({
        width: 5,
        height: 5,

        // screenshot 1:
        /*color: "#FF0000",
        borderColor: "#FF0000",
        borderWidth: 1,*/

        // screenshot 2
        image: "background.png",
        imageStretchToFit: true
    }, {
        x: 3,
        y: 7,
        type: "dynamic"
    });

bildschirmfoto vom 2014-10-06 15 54 51

bildschirmfoto vom 2014-10-06 15 55 13

What am I doing wrong?

Entity draw function should pass canvasPosition

Here's some draw code for an entity:

draw: function(ctx, x, y) {
ctx.strokeStyle = "black";
ctx.lineWidth = 10;
ctx.fillStyle = "rgba(128,0,128,0.5)";
ctx.beginPath();
ctx.arc(this.canvasPosition().x,this.canvasPosition().y,40,0,Math.PI*2,true);
ctx.closePath();
ctx.stroke();
ctx.fill();
}

I shouldn't have to type "this.canvasPosition().x" in the draw function, it should pass "cpx, xpy" or something. Regular x and y are not very useful here in a draw context.

PLEAAAAAAZE HALP

Is boxbox dead?

No significant updates in 3 years. I get the feeling that you got tired of it. For a project of this size, I can understand that. But if so, that's too bad. boxbox was simple, well documented and therefore a pleasure to work with.

The latest submit generate artifacts

Hi,

I'm new to Box2D and I find your project really useful. There is one issue, though. The latest submit to github is producing artifacts on rendering.

I'm not sure where the issue resides but it must be easy for you to find. To get an idea what I'm talking about, compare the version you are using in your demos and the one in source. I tried on latest versions of Firefox and Chrome.

Here are the links:
http://incompl.github.io/boxbox/boxbox/demos/chain/chain.html
https://rawgithub.com/incompl/boxbox/master/demos/chain/chain.html

boxbox returns `window` extended

The IIFE that defines window.boxbox does return this, which means that boxbox's entire API is extended onto the window object. This doesn't strike me as the intent here, it should only return the boxbox API itself.

gravity function not setting gravity, possible fix provided

The problem is with:

gravity: function(value) {
    if (value !== undefined) {              
        this._world.SetGravity(new b2Vec2(value.x, value.y));
    }
    var v = this._world.GetGravity();
    return {x: v.x, y: v.y};
},

I had to change

this._world.SetGravity(new b2Vec2(0, value));

to

this._world.SetGravity(new b2Vec2(value.x, value.y));

It asks for {x,y} but if you send in {x: 0, y: 20} for example, it thinks y is now an object until the above fix is applied.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.