Shape:testSegment

Questions about the LÖVE API, installing LÖVE and other support related questions go here.
Forum rules
Before you make a thread asking for help, read this.
Post Reply
chi
Prole
Posts: 3
Joined: Sat Dec 15, 2012 5:45 pm

Shape:testSegment

Post by chi »

I was wondering if there's any alternative to Shape:testSegment for Love versions 0.8.0 or later.

I was planning on using this function to determine if there was any obstacles or other enemies between an enemy shooting and it's target. Mainly, I don't want enemies shooting other enemies, so I want to check if there's any obstacles, namely other enemies, in their line of fire before shooting. So far, all enemies, players and obstacles are implemented with love.physics, so there are shapes, bodies and fixtures for them all.

Is this a good idea? Or should I consider some alternative methods for this type of checks?
User avatar
substitute541
Party member
Posts: 484
Joined: Fri Aug 24, 2012 9:04 am
Location: Southern Leyte, Visayas, Philippines
Contact:

Re: Shape:testSegment

Post by substitute541 »

Love.physics is overkill for simple games. I'd suggest alternative methods of doing that. You can test for intersections using a line intersecting test function in the love2D wiki's snippets. There are lots of other alternative methods so you should try one that suits you the best.
Currently designing themes for WordPress.

Sometimes lurks around the forum.
User avatar
slime
Solid Snayke
Posts: 3162
Joined: Mon Aug 23, 2010 6:45 am
Location: Nova Scotia, Canada
Contact:

Re: Shape:testSegment

Post by slime »

chi
Prole
Posts: 3
Joined: Sat Dec 15, 2012 5:45 pm

Re: Shape:testSegment

Post by chi »

slime wrote:World:rayCast
Thanks! This was exactly what I needed!
Post Reply

Who is online

Users browsing this forum: No registered users and 4 guests