Use Upward Y-Direction as Positive and (0,0) at Lower Left Corner

Is there any config I can edit to set (0,0) to the lower left corner and set the Y-axis to point upward?

Now my workaround is as follow:

  1. Create a Display Group called “screen group”
  2. Shift this Display Group to 320 pixels downwards
  3. All display objects are added to this group
  4. Make y values negative before calling display functions

However, this workaround has some problems.

  1. I must add display objects to this “screen group” before I set any Y values to them
  2. If the display objects have their own group, they must be centered at the origin of the group, or otherwise the the “collision area” will have different size/positions from their displayed vectors/images.

Thanks very much for reading. [import]uid: 12769 topic_id: 5627 reply_id: 305627[/import]

Why do you want to do this? If you have a need other than simply because you tend to think that (0, 0) is the lower left corner then I would love to hear it. If however your reason is simply convenience, then I would note that pretty much all computer graphics are standardized on (0, 0) in the upper-left corner. You would be doing yourself a favor to get used to thinking like that. [import]uid: 12108 topic_id: 5627 reply_id: 19228[/import]

If what you are trying to do is draw objects into a display group and then position them off screen to the bottom left and corner then you could use [lua]display.TopLeftReferencePoint[/lua]:

[lua]group = display.newGroup() – Create group

for i = 1, 3 do – Loop 3 times to create three rectangles
local img = display.newRect( group, 100+(60*i), 100, 50, 50) – Create rectangles and add to group
img:setFillColor( 255,0,0 ) – Fill it with colour red
end

group:setReferencePoint( display.TopLeftReferencePoint ) – Set group reference point to top left corner
group.x = 0 – Set coordinate to zero on x axis
group.y = display.contentHeight – Set coordinate to the bottom of the screen
transition.to( group, {time=1000, y = 0 } ) – move group up[/lua]

Just draw your objects normally in the group then set the reference point of the group to the top left corner and move the group to the bottom left corner. [import]uid: 11393 topic_id: 5627 reply_id: 19230[/import]

Thanks for your reply.
You are right. I want to do this because it’s more convenient and easier for me to do the math and handle the numbers in my mind. :smiley: [import]uid: 12769 topic_id: 5627 reply_id: 19909[/import]

Thanks for your reply.
Thanks for the code. I will try it. :smiley: [import]uid: 12769 topic_id: 5627 reply_id: 19911[/import]

Hey corona.game1

One good reason for not doing what you are doing is for tile maps, isometric views etc… For anything like that you need to draw from the top left. Its about how things are layered over each other.

For a top down game its not too bad.

Also moving reference points cam mess up rotations, physics and other more complex things.

I dont know your app / game idea but the deeper you go down this hole the harder it will be to fix later on. [import]uid: 5354 topic_id: 5627 reply_id: 19915[/import]