Round and triangle hitboxes?


(billy2000) #1

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 .


Best way for collision detection for lines?
(azrafe7) #2

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?


(billy2000) #3

That would be great !


(azrafe7) #4

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).


(billy2000) #5

wow thats very nice O:


(azrafe7) #6

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! :smirk:

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 and SHIFT+ARROWS to move the circle

(Jacob Albano) #7

This is awesome! I’ll definitely be checking out the code for my own port of Flashpunk.


(reopucino) #8

wow great… i hode this code will be pull, and more flashpunk will come more hitbox :smile:


(John Andersson) #9

So where are we in this matter now? Hehehehe, feel like I could use some triangle hitboxes for some slope action