Jump to content

initialising sprites out of view with collideWorldBounds enabled


gRoberts
 Share

Recommended Posts

Hi all,

I can't seem to find any documented way of initialising a sprite with a negative axis value, whilst having collideWorldBounds enabled.

It appears to be resetting my negative axis values to 0 upon rendering, which makes it appear really clunky.

    app.game.prototype.spawn = function() {
        var germId = germs[Math.floor(Math.random()*germs.length)],
            germ = spawnGroup.create(
                this.rnd.integerInRange(0, this.world.width),
                -50,
                germId
            );

        this.physics.arcade.enable(germ);

        germ.body.gravity.y = this.rnd.integerInRange(200, 500);
        germ.body.collideWorldBounds = true;
        germ.inputEnabled = true;
        germ.events.onInputDown.add(this.onInputDown, this);
    };

Any suggestions on how to get around this?

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...