Skip to content

imageStretchToFit doesn't work, Entity has wrong boundaries #35

@hinzundcode

Description

@hinzundcode

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions