8 pixel offset?

Hi All

does anyone know why displays 8 pixel higher on x & y?

local player = display.newRect(40, 40, 16,16)
print(player.x,player.y)

output–>

48       48

i have offset my code to player.x - 8 and the output is correct, is there a better way? do i have something set incorrect?

thx

I’m assuming you are using a build older than 2076?  If so, here is what is going on…  You are creating a 16x16 rectangle.  With the Graphics 1 engine in 1202 and earlier display.newRect() draws that rectangle where it’s TOP and LEFT points are at a 40, 40.  However the object is managed from it’s center, so the .x and .y i.e. the center of the rectangle is at 48, 48.

When you upgrade to 2076 which has the Graphics 2.0 engine, these calls down treat the X, Y passed in as the center of the object, not the top left.

Rob

I’m assuming you are using a build older than 2076?  If so, here is what is going on…  You are creating a 16x16 rectangle.  With the Graphics 1 engine in 1202 and earlier display.newRect() draws that rectangle where it’s TOP and LEFT points are at a 40, 40.  However the object is managed from it’s center, so the .x and .y i.e. the center of the rectangle is at 48, 48.

When you upgrade to 2076 which has the Graphics 2.0 engine, these calls down treat the X, Y passed in as the center of the object, not the top left.

Rob