Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: How to check if a sprite is touching a line  (Read 1650 times)

0 Members and 1 Guest are viewing this topic.

CowNation

  • Newbie
  • *
  • Posts: 20
    • View Profile
How to check if a sprite is touching a line
« on: May 22, 2018, 07:59:55 pm »
As the title says, I am drawing a line between 2 verticies.. One is located at the local player sprite, the other goes to the mouse. How can I tell if a different sprite is touching the line in between local & my mouse?

Arcade

  • Full Member
  • ***
  • Posts: 230
    • View Profile
Re: How to check if a sprite is touching a line
« Reply #1 on: May 23, 2018, 05:36:46 pm »
You are essentially asking how to check for collisions between a line and a rectangle (the sprite's bounding box). This is a common thing in many games, which means you can probably find several good tutorials by just searching the internet for those terms. Here is the first result that came up for me when searching, which may be what you want.