Best way to convert a circle into a 'perspective'?
Posted: Mon Aug 14, 2017 2:38 am
I've been having this perplexing situation regarding the LOVE game engine. One that involves a game I'm working on. I want to create a circle around my character. That is not the problem. Rather, the problem occurs with what I want that circle to do. I want this circle, AND the points after it to disappear when the area hits an object, specifically one that is solid. Think of it in the perspective of a top-town stealth game. Where the visibility range of an enemy guard gets cut off by an object. That is the kind of circle that I want. I have a snippet of code that creates a pseudo-circle (it has its flaws)
that answers a part of the problem. What I need to do now is adjust the lines length so it does not intersect with an object in the foreground. In this regard, I have no idea what function to use that gives me a clue on how to do this. any other solution to this problem would no doubt be helpful.
Thank you in advance.
Code: Select all
for i=0,radius*4,1 do
love.graphics.line( playerX, playerY, math.sin(math.pi(i/radius/2))*radius + playerX, math.cos(math.pi*(i/attkRad/2))*radius + playerY)
end
Thank you in advance.