Author Topic: [SOLVED]How to resize Hitbox  (Read 1190 times)

DataRogue

  • Member
  • **
  • Posts: 6
  • Karma: +0/-0
    • View Profile
[SOLVED]How to resize Hitbox
« on: Fri, Aug 5, 2011 »
How do I resize a hitbox for an FlxSprite? I've created a sprite sheet where all the sprite boxes are 128x128, however the sprites themselves aren't (Due to the sprite changing sizes during the animation.) Until I implement pixel based collision, I need some form of testing, and having 128x128 collision boxes is inadequate.

Note: I'm using the FlxG.Collision(); method for detection at the moment.
« Last Edit: Fri, Aug 5, 2011 by DataRogue »

bleok

  • New Member
  • *
  • Posts: 4
  • Karma: +0/-0
    • View Profile
Re: How to resize Hitbox
« Reply #1 on: Fri, Aug 5, 2011 »
Change width and height properties  and set offset.x and offset.y to replace hitbox from the top left corner of your sprite.
To make this changes during the animation use addAnimationCallback() (good explanation in this topic: http://forums.flixel.org/index.php/topic,929.0.html )

mightiest_hero

  • Member
  • **
  • Posts: 51
  • Karma: +0/-0
    • View Profile
Re: How to resize Hitbox
« Reply #2 on: Fri, Aug 5, 2011 »
Hi try set height and width

DataRogue

  • Member
  • **
  • Posts: 6
  • Karma: +0/-0
    • View Profile
Re: How to resize Hitbox [SOLVED]
« Reply #3 on: Fri, Aug 5, 2011 »
Thanks, I got solved