How to resize sprite hitbox (setSize() not working)?
I am trying to resize my sprite's hitbox so I can use flixel.util.FlxSpriteUtil to draw new things outside my sprite's original dimensions. I used a makeGraphic with width 50 and height 20 to make my sprite, and I tried resizing it like this:
(_playerCar is my sprite.) But the hitbox stays exactly the same after this, and I still can't draw anything outside my original rectangle. Is there a way to increase the size of the hitbox? Thanks.
_playerCar.setGraphicSize(100, 50); _playerCar.updateHitbox();
@dean Thanks, but that's not what I'm looking for. I want to resize just the hitbox. setGraphicSize() scales the whole graphic.
Oh. Maybe you can use
_playerCar.makeGraphic(100, 50, 0x0);to create a transparent rectangle, then draw on it with
FlxSpriteUtil.drawRect(_playerCar, 0, 0, 50, 20, 0xFFFFFFFF);and other stuff you want to draw. Just make the
makeGraphic()the size that you want to draw on.