SUPER basic-and somewhat embarrassing-question about display.newLine()

Okay - I’ve read - and reread- and reread the PolyLines API…

Here’s what I’ve done (I know, super basic!!):

local star = display.newLine (0, -150, 25, 200)

Question: PointA (0, -150) to PointB (25, 200) is reversed from the rules of basic math quadrants if (0,0) is supposed to be the middle of the line. Where is the origin (0,0) for this display object?? The drawn line doesn’t even follow the basic rules of quadrants if (0,0) is supposed to be the top left.

From my basic math days, I remember the (x,y) quadrants as: bottom left (-,-), bottom right (+, -), top left( -, +), top right (+, +) and, of course, (0,0) is smack dab in the middle.

Thank you!

[import]uid: 45656 topic_id: 17031 reply_id: 317031[/import]

yes you are right, but the 0,0 is the top left origin point, so the smack center is _W/2, _H/2 where _W and _H are display.contentWidth and display.contentHeight

cheers,

?:slight_smile: [import]uid: 3826 topic_id: 17031 reply_id: 63915[/import]

Thank you for help! Let me clarify something and ask for your help, again. (The first set of coordinates I gave in my original question were just wacky!)

Here’s a set of coordinates I tried out:

local line = display.newLine (0,0, display.contentWidth, display.contentHeight)

This produces a simple line from top,left to bottom,right - I totally understand this…Whew!

However, when I do this:

local line = display.newLine (0,-200, display.contentWidth, display.contentHeight)

The line’s top,left shifts to the right, and I’m not understanding how this is done. My confusion is from how to deal with negative coordinates on a positive coordinate display content (width and height). [Obviously I know how to deal with them in basic quadrant math. :-)]
Please reply! Thanks!
[import]uid: 45656 topic_id: 17031 reply_id: 63949[/import]

in the second example, you are stating…

local line = display.newLine (0,-200, display.contentWidth, display.contentHeight)

x = 0
y = -200 this is off the screen 200 pixels above the top of the visible screen on the device

then you specify the width and the height. so what is happening is the line is starting from a point off the screen, let me illustrate it in ascii for you…

 z z
 z
 z
 z
 +--------------------------------+ | z |
 | z |
 | z |
 | z |
 | z |
 | z |
 | z |
 | z |
 | z |
 | z |
 | z |
 | z |
 | z |
 | z |
 | z |
 | z |
 | z |
 | z |
 | z |
 | z | |
 | |
 +--------------------------------+

I could not draw that very well, but I hope you could get the idea. so your line is shifted to the right, because the x origin to the left is already on top

cheers,

?:slight_smile: [import]uid: 3826 topic_id: 17031 reply_id: 63951[/import]

Got it! :slight_smile: Thank you for your time! Have a great day! [import]uid: 45656 topic_id: 17031 reply_id: 64015[/import]