Advertising (This ad goes away for registered users. You can Login or Register)

Help - LUA lines

Forum rules
Forum rule Nº 15 is strictly enforced in this subforum.
Post Reply
Dman49
Posts: 55
Joined: Wed May 11, 2011 10:49 pm

Help - LUA lines

Post by Dman49 » Fri Aug 19, 2011 2:26 pm

I am trying to figure out how I can use vector lines. What I want to do is have a line (which you can't see) go from the center of one image to the center of another. I then want this line to detect if there is anything in the way of this line. I'll have 1 image attack another, and I want to be able to have it tell if there is a wall or block in the way of his attack.

If anyone can help it would be much appreciated.
Advertising
PSP 3000 PRO-B6 - PSP GO PRO-B6
Creations: BeastieBox (1.3) ; Flat Paintball (1.0) ; HeroClix PSP (unreleased)

Zasisem
Posts: 200
Joined: Mon Sep 27, 2010 3:49 pm

Re: Help - LUA lines

Post by Zasisem » Sun Aug 21, 2011 7:40 pm

Dman49 wrote:I'll have 1 image attack another, and I want to be able to have it tell if there is a wall or block in the way of his attack.
For this I'm sure I can help you, can you give a bit more detail?
Advertising

User avatar
cmbeke
Posts: 50
Joined: Tue Apr 12, 2011 9:51 pm

Re: Help - LUA lines

Post by cmbeke » Sun Aug 21, 2011 11:48 pm

you need to find the equation of the line, and then check for any intersections with walls on any point of the line. check out this for info on how to get the equation of a line with two points, http://www.purplemath.com/modules/strtlneq.htm
You probably didn't know that you don't know that you don't know what you don't know.
I know I'm crazy, the real question is are you?
Life is nothing but discrimination, likes, dislikes, any choice made ... all a product of discrimination.

Dman49
Posts: 55
Joined: Wed May 11, 2011 10:49 pm

Re: Help - LUA lines

Post by Dman49 » Mon Aug 22, 2011 2:42 pm

Zasisem wrote:
Dman49 wrote:I'll have 1 image attack another, and I want to be able to have it tell if there is a wall or block in the way of his attack.
For this I'm sure I can help you, can you give a bit more detail?
I have a grid. two players are on 2 spaces. One of them needs to be able to see the other if he can attack it. I wan't to know if his field of vision to the other player is blocked by a wall or obstruction. So I need to form 1 line from the middle of one player to the middle of the other.
PSP 3000 PRO-B6 - PSP GO PRO-B6
Creations: BeastieBox (1.3) ; Flat Paintball (1.0) ; HeroClix PSP (unreleased)

DianeMarx
Posts: 1
Joined: Wed Nov 22, 2017 4:30 pm
Location: USA Nevada Carson City
Contact:

Re: Help - LUA lines

Post by DianeMarx » Wed Nov 22, 2017 4:36 pm

Thank everyone. I like to visit your forum and find answers to my questions.

Post Reply

Return to “Programming and Security”