• Hey Guest! Ever feel like entering a Game Jam, but the time limit is always too much pressure? We get it... You lead a hectic life and dedicating 3 whole days to make a game just doesn't work for you! So, why not enter the GMC SLOW JAM? Take your time! Kick back and make your game over 4 months! Interested? Then just click here!

Flamethrower collision detection?

Ham

Member
so I'm making a flamethrower and so far this is what it looks like with particles


I was wondering if there was a way to detect any collisions in a triangle range?


something like this, preferably with code

I thought of drawing a rectangle, but making the two points on the left the same, but collision rectangle doesn't work like that
 

Trandoxiana

Member
If you create a triangle in the sprite editor, you can hide the layer the triangle is on (the layer in the sprite, not in the room). Then, open the collision box menu and set it to 'precise'. This way, the collision box should be a triangle, and the sprite is invisible. This also means you can shape the triangle however you want so that it fits the flamethrower.
 
i would draw a line from the player to the nearest enemy and check if that line is within a certain angle ( the angle of the triangle) and then the distance from the origin of the line to see if it is within that area. Maybe not the best solution but thats what i would do
 
Top