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

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

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