Offset and hitbox problem with Sprite.



  • Hi! i'm having trouble with moving a sprite's hitbox.
    I have a "trap" wich kills the Player.
    The Trap's hitbox its way big, so I i use height = 16; to lower it, so the Player can jump above it.
    It works, but as the hitbox is floating above the Trap i must move it, so i use Offset.set(x,y+5);, wich generates the problem: the player collides with the Trap but the Trap is invisible!! the sprite disappears.
    The code is:

    import flixel.FlxSprite;
    import flixel.system.FlxAssets.FlxGraphicAsset;

    class Trap extends FlxSprite
    {

    public function new(?X:Float=0, ?Y:Float=0, ?SimpleGraphic:FlxGraphicAsset) 
    {
    	super(X, Y, SimpleGraphic);
    	loadGraphic(AssetPaths.pinchos__png, false,32,32);
    	height = 16;
    	offset.set(x, y + 5);
    	
    }
    

    }



  • SOLVED, thanks


Log in to reply
 

Looks like your connection to HaxeFlixel was lost, please wait while we try to reconnect.