My sprite can not fully be clicked after scaling.

31 views
Skip to first unread message

LangLearn

unread,
Feb 14, 2016, 2:38:09 PM2/14/16
to HaxeFlixel
I have tried everything to fix this problem. Here is what I have right now

        loadGraphic("assets/images/baseImage"+imageID+".png");
        scale
.set(2, 2);
        width
= 720;
        height
= 720;
        centerOffsets
();
        updateHitbox
();
       
MouseEventManager.add(this, onDown);

The sprite shows up scaled twice like it is supposed to but the image can only be clicked from x 180 to 540 and y 180 to 540 which is the same original size. I have got this working many times before so I do not know why I can not do it this time..

Gama11

unread,
Feb 14, 2016, 4:04:08 PM2/14/16
to HaxeFlixel
MouseEventManager does pixel-perfect overlap checks by default - and it uses the unscaled sprite for that. To base the overlap checks on the hitbox of the sprite, set the PixelPerfect argument of add() to false.
Reply all
Reply to author
Forward
0 new messages