Probably a dumb question...

I was playing around the the sample puzzle app:
https://github.com/jonbeebe/Puzzle-App

and in a function (createPuzzle), an image is added to the screen using:
puzzlePreview = display.newImageRect( puzzleFile, 500, 500 )
puzzlePreview.x = 300; puzzlePreview.y = 512

In another function (drawBackground) I added a rectangle using the same coordinates:
local myRectangle = display.newRect(300,512, 500, 500)
–doing it twice to be certain.
myRectangle.x=300; myRectangle.y=512
myRectangle.strokeWidth = 3
–myRectangle:setFillColor(140, 140, 140)
myRectangle:setStrokeColor(180, 180, 180)

They are both added in a function, and then inserted into the correct group. And yet, the rectangle shows up in a totally different place than the image does. Is it a reference point issue? And if so, why does one have a different reference point than the other one?

Any help is appreciated as I try to wrap my head around this stuff. Thanks! [import]uid: 19193 topic_id: 14599 reply_id: 314599[/import]

I believe that if you set the location of the rectangle in the initial declaration (display.newRect) it is placed with a top-left reference point. By setting the x and y coordinates to 0 to start with, the rectangle will default to center referenced, and then your seperate x,y commands will place it the same as your original rectangle. Try:

local myRectangle = display.newRect(0, 0, 500, 500) --then myRectangle.x=300; myRectangle.y=512 [import]uid: 64596 topic_id: 14599 reply_id: 54016[/import]

Hmmmm, sadly no, that didn’t fix it. [import]uid: 19193 topic_id: 14599 reply_id: 54111[/import]

what version of the sdk are you using? I remember 484 having this issue sometime back? please confirm?

regards [import]uid: 55009 topic_id: 14599 reply_id: 54180[/import]