As the tittle said …is there any way to create hitboxes with different forms than square ,like round or triangle? Because it seems a bit noneffective to use a pixelmask when i can use a hitbox .
Round and triangle hitboxes?
As for circle collision you can implement that by using a simple distance check.
If you want a more integrated solution, HaxePunk (the Haxe port of FlashPunk) supports both Circle and Polygon masks, and rewriting them to as3 should be a pretty straightforward task.
Never used them, but I could just go ahead and port it. Should I?
Fine!
Not so smooth of a port as I’ve imagined (encountered several bugs so far in the haxe version). I’ll post an issue on their github repo to let them know.
Meanwhile here’s what I have (Circle mask - quite complete -, and experimental Polygon mask).
Ok, after many tests I think this thing is quite usable (although some optimization wouldn’t do bad).
Surely there are some bugs hiding in there, but haven’t spotted them yet. But trust me: you’ll find them!.. so please let me know when they show up!
Making the polygon-circle collision work has been somewhat stressing (and fun at the same time). Still don’t get how polygon rotation has been implemented by Matt but heck… that’s for another time. Pixelmask collisions against the 2 new type has also been covered.
Code is on github (I’ll clean that and remove the debug code and the TestWorld shortly). In the meanwhile you can download it and test the demo yourself or directly play around with this:
swf: online | download (54.1 KB)
As per screen instructions:
- enable the console (press
~
) - click the
▶
button on top - use
ARROWS
to move the polygon andSHIFT+ARROWS
to move the circle
This is awesome! I’ll definitely be checking out the code for my own port of Flashpunk.
wow great… i hode this code will be pull, and more flashpunk will come more hitbox
So where are we in this matter now? Hehehehe, feel like I could use some triangle hitboxes for some slope action