Skip to content

Conversation

Geokureli
Copy link
Member

@Geokureli Geokureli commented Oct 1, 2025

Reverts #3418, removing the ability to detect overlaps where both axes start overlapping on the same frame. This change broke standing on moving platforms.

Fixes bug introduced in #3158 where jumping didn't work depending on order of super.update() and collide calls.
The reproducing code is a copy of the Jumping snippet but with the input detection before the collide call)

package states;

import flixel.FlxG;
import flixel.FlxSprite;
import flixel.ui.FlxVirtualPad;

class JumpTestState extends flixel.FlxState
{
    var sprite:FlxSprite;
    var box:FlxSprite;
    var pad:FlxVirtualPad;
    
    override function create()
    {
        super.create();
        
        sprite = new FlxSprite();
        sprite.makeGraphic(24, 24);
        sprite.x = FlxG.width / 2 - sprite.width / 2;
        sprite.acceleration.y = 900;
        sprite.maxVelocity.y = 300;
        add(sprite);
        
        box = new FlxSprite();
        box.makeGraphic(40, 40);
        box.x = FlxG.width / 2 - box.width / 2;
        box.y = FlxG.height * 0.75 - box.height / 2;
        box.immovable = true;
        add(box);
        
        pad = new FlxVirtualPad(FlxDPadMode.NONE, FlxActionMode.A);
        add(pad);
    }
    
    override function update(elapsed:Float)
    {
        // call super.update first, as it sets touching flags to NONE
        super.update(elapsed);
        
        // jump if touching the box, and jump is pressed
        if (sprite.wasTouching.down && pad.getButton(A).justPressed)
        {
            sprite.velocity.y = -300;
        }
        
        // If sprite is resting on box it will set its touching to DOWN
        FlxG.collide(box, sprite);
    }
}

@Geokureli Geokureli added this to the 6.1.1 milestone Oct 2, 2025
@Geokureli Geokureli marked this pull request as draft October 2, 2025 18:56
@Geokureli
Copy link
Member Author

Turns out 3158 did not introduce a bug, the above test has always been broken. Gonna shelf this open a new PR to revert 3418

@Geokureli Geokureli removed this from the 6.1.1 milestone Oct 2, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant