Top/Left Issue

Hoping someone can explain something to me as I am a little confused at the moment…

So here is the deal, I have a background image that I want positioned at x = 0, y = 0 which should be the upper left hand corner and have tried anchorX/Y etc. but cannot seem to just get at 0,0.

For example (basic):

sceneGroup = self.view

img = newImageRect etc.

img.x = 0

img.y = 0

-> this puts the image at a negative x/y position.

however 

sceneGroup = self.view

sceneGroup.y = 226

sceneGroup.x = 200

->then image at 0,0 (or anything else, groups etc.) are all at 0,0…

so the question is other than offsetting the sceneGroup directly how can I make the sceneGroup “actually” always be at 0,0?

in 1.0 it was pretty simple, set top = 0, left = 0 in config then just set a topleft referencePoint but I just can’t seem to figure out how to do the same thing with anchorX etc.

Any ideas?

Are you sure? This should work:

local group = self.view rect = display.newRect(group, 0, 0, 100, 100); rect.anchorX, rect.anchorY = 0, 0;

as always ingemar your the man :slight_smile:

apparently i did pick the wrong week to stop smoking crack :slight_smile:

For some reason my brain was not working as I was using anchorX/Y as my positionX/Y lol DOAH!

local img = display.newImageRect(group, "testbg.png", 400, 400) img.anchorX, img.anchorY = 0, 0 img.x, img.y = 0, 0

Once I put both it in everything started working like it should what I had done is gone through and just removed all the setReferencePoints instead of replacing them with anchors so the end result was just setting the x/y position and everything got mangled which is what should be expected :slight_smile:

Thanks for your help :slight_smile:

Further proof that bad habits *are* good for you  :wink:

lol

Are you sure? This should work:

local group = self.view rect = display.newRect(group, 0, 0, 100, 100); rect.anchorX, rect.anchorY = 0, 0;

as always ingemar your the man :slight_smile:

apparently i did pick the wrong week to stop smoking crack :slight_smile:

For some reason my brain was not working as I was using anchorX/Y as my positionX/Y lol DOAH!

local img = display.newImageRect(group, "testbg.png", 400, 400) img.anchorX, img.anchorY = 0, 0 img.x, img.y = 0, 0

Once I put both it in everything started working like it should what I had done is gone through and just removed all the setReferencePoints instead of replacing them with anchors so the end result was just setting the x/y position and everything got mangled which is what should be expected :slight_smile:

Thanks for your help :slight_smile:

Further proof that bad habits *are* good for you  :wink:

lol