user2435007
user2435007

Reputation:

Corona SDK with Graphic 2.0 position not working

I have upgraded my Corona SDK version to 2013.2076 (with Graphic 2.0). But now my background images are not working and the app is crashing.

local background = display.newImageRect("/bg.png", 570, 360 )
background:setReferencePoint( display.CenterReferencePoint )
background.x = display.contentCenterX ; background.y = display.contentCenterY
gameGroup:insert(background)

It is working perfectly in previous version of Corona SDK. I am not being able to identify the issue. Please help

Upvotes: 2

Views: 520

Answers (1)

Khawar
Khawar

Reputation: 9241

With the release of Corona Build 2013.2076, the setReferencePoint is deprecated. You can use

background.anchorX = 0.5 ; 
background.anchorY = 0.5 ; 

For more information about anchors see

http://docs.coronalabs.com/guide/graphics/transform-anchor.html

See examples here

http://docs.coronalabs.com/api/type/DisplayObject/anchorX.html

and

http://docs.coronalabs.com/api/type/DisplayObject/anchorY.html

Upvotes: 3

Related Questions