V
V
Valery Albertovich Zhmyshenko2020-10-16 16:45:30
Game development
Valery Albertovich Zhmyshenko, 2020-10-16 16:45:30

How to make a diagonal line collision in Love2d?

with a straight line that is perpendicular to the coordinate grid, everything is simple, I do it like this

if object.x + object.w >= col[i][1] then
      if object.x <= col[i][2] then
      if object.y + object.h >= col[i][3] then
      if object.y + object.h <= col[i][3] + 8 then
        object.y = col[i][3] - object.h


but what if you need to make a diagonal surface?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question