Understanding part of the coordinate system

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.
User avatar
Petunien
Party member
Posts: 191
Joined: Fri Feb 03, 2012 8:02 pm
Location: South Tyrol (Italy)

Understanding part of the coordinate system

Post by Petunien »

Hi,

I need your help to understand a part of the coordinate system.

At the moment, if the player shoots, the bullet goes exactly to the x/y-coordinate where the mouse was clicked.

But I wanna the bullet going outside of the window (1024x768 pixels), so I can delete it.

My question:

Assumed the player shoots at 500/600.
The y-coordinate of the bullet has therefore to be at least -600. But the x-coordinate has to change too, relative to the y-coordinate.

On 1024x768 the ratio is 4:3. What would be the target coordinates?
Aww, I'm bad at explaining problems. Especially in English. :(

This image could help:

http://www.abload.de/img/problemd3l12.jpg

I still suck at math, I hope it changes. :)

Greets
"Docendo discimus" - Lucius Annaeus Seneca
clepto
Prole
Posts: 35
Joined: Wed Jul 25, 2012 10:20 pm

Re: Understanding part of the coordinate system

Post by clepto »

i don't quite understand what you want...
you want to get the coordinates of the target point? (based on image)

if yes you can check in the update() if the x and y coordinate is out of the window and then get the other one...example:

-- suppose the window is 700x800

Code: Select all

if x >= 700 then
    y = get-bullet-y-coordinates
elseif y >= 800 then
    x = get-bullet-x-coordinates
end 
but if you want just to delete the bullet you need to check if only one coordinate (x or y) is out of the window!

hope it helps :)
User avatar
Petunien
Party member
Posts: 191
Joined: Fri Feb 03, 2012 8:02 pm
Location: South Tyrol (Italy)

Re: Understanding part of the coordinate system

Post by Petunien »

I forgot to say that the bullet doesn't go that way. That's the way it should go.

As I wrote, the bullet at the moment goes exactly to the point where the mouse was clicked.

And based on the image, I would like if someone could say me what the coordinates are and how he was able to figure them out. :)
"Docendo discimus" - Lucius Annaeus Seneca
clepto
Prole
Posts: 35
Joined: Wed Jul 25, 2012 10:20 pm

Re: Understanding part of the coordinate system

Post by clepto »

the shooter is in 500/600 right?
the target is in the question mark?

the bullet doesn't follow the red line?

you want the coordinated of the mouse click?

sorry for not understanding :nyu:
User avatar
Petunien
Party member
Posts: 191
Joined: Fri Feb 03, 2012 8:02 pm
Location: South Tyrol (Italy)

Re: Understanding part of the coordinate system

Post by Petunien »

clepto wrote:the shooter is in 500/600 right?
the target is in the question mark?
The player clicked at 500/600. The bullet goes to 500/600.
The question mark stands for the coordinates I want to know.
clepto wrote: the bullet doesn't follow the red line?
No, therefore I asked how to get the coordinates where the question mark is, so I can move the bullet to those coordinates.

Sorry for not writing in correct english. :(
"Docendo discimus" - Lucius Annaeus Seneca
clepto
Prole
Posts: 35
Joined: Wed Jul 25, 2012 10:20 pm

Re: Understanding part of the coordinate system

Post by clepto »

english is not my first language either :)

we know the x coordinates, its the x size of the window...

the y now...hmm..thats diffucult :P

can i ask something? the player clicked in 500/600 so the bullet has to go there...from where does the bullet start? why you need this coordinates?
User avatar
Petunien
Party member
Posts: 191
Joined: Fri Feb 03, 2012 8:02 pm
Location: South Tyrol (Italy)

Re: Understanding part of the coordinate system

Post by Petunien »

clepto wrote:english is not my first language either :)
May ask where you are from? :)
clepto wrote: we know the x coordinates, its the x size of the window...
I don't understand.
clepto wrote: the y now...hmm..thats diffucult :P
Surely easy math. ^^
clepto wrote: can i ask something? the player clicked in 500/600 so the bullet has to go there...from where does the bullet start? why you need this coordinates?
The bullet starts from the player x/y coordinate. Basically I need these coordinates to let the bullet fly outside the window.

Deleting them while flying doesn't look that good. ^^
"Docendo discimus" - Lucius Annaeus Seneca
clepto
Prole
Posts: 35
Joined: Wed Jul 25, 2012 10:20 pm

Re: Understanding part of the coordinate system

Post by clepto »

I am from Greece :)

look at the image here http://ubuntuone.com/5LdkdGaRtE0TR4vX3SEiq3
i hope it helps a bit
User avatar
Petunien
Party member
Posts: 191
Joined: Fri Feb 03, 2012 8:02 pm
Location: South Tyrol (Italy)

Re: Understanding part of the coordinate system

Post by Petunien »

Oh, greets to Greece. ^^

Heh, I think we understand ourselves not correctly. ;)

I think it's better to wait also here until someone comes. :)
"Docendo discimus" - Lucius Annaeus Seneca
clepto
Prole
Posts: 35
Joined: Wed Jul 25, 2012 10:20 pm

Re: Understanding part of the coordinate system

Post by clepto »

haha thats what i was thinking :P

edit: just one more thing, why you need specific coordinates to get the bullet out of the window? just keep increasing the coordinates and check if its out of the window! Goodnight!
Post Reply

Who is online

Users browsing this forum: Roland Chastain, slime and 197 guests