FlxG.collide does not work when objects go beyond FlxG.width #161

WEREMSOFT opened this Issue May 24, 2011 · 2 comments

2 participants


Hi everyone.

I have a hero, an enemy and bullets.

lots of Bullets are in a FlxGroup
1(one) Enemy are in a FlxGroup

Enemy walks to the right constantly.

In the update method of the PlayState I have:

    public override function update():void
        FlxG.collide(bullets, enemys, onCollidesBulletsEnemys);
        FlxG.collide(soldier, enemys);  

The soldier stop colliding with the enemies when both are beyond FlxG.width value. Same with bullets.

I try changing the size of the canvas and always the collision stop working as I said.


yea, by default FlxG.worldBounds is set to roughly the size of the screen - if you change the size of the worldBounds you should be ok!

@AdamAtomic AdamAtomic closed this May 24, 2011

Works. Using this code on the constructor.

FlxG.worldBounds.width = _level.width;
FlxG.worldBounds.height = _level.height;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment