kevin ver
kevin ver

Reputation: 851

stick a image to the bottom right corner

How can i stick a image to the bottom right corner of the screen?

local screenGroup = self.view
helpbtn = display.newImage("helpbtn.png")
screenGroup:insert(helpbtn)
helpbtn.x = 255; helpbtn.y = 600
transition.to( helpbtn, { time=2500, y=465, transition=easing.inOutExpo } )

So on all the different devices it will look the same ?

Upvotes: 3

Views: 320

Answers (2)

Krishna Raj Salim
Krishna Raj Salim

Reputation: 7390

Try this:

local distanceFromCorner = 5
local helpbtn = display.newImage("helpbtn.png")
screenGroup:insert(helpbtn)
helpbtn.x = display.contentWidth  - helpbtn.contentWidth/2 - distanceFromCorner;
helpbtn.y = display.contentHeight - helpbtn.contentHeight/2 - distanceFromCorner;

You can also make use of object:setReferencePoint(display.BottomRightReferencePoint) in normal corona modes or Anchor Points in Corona’s Graphics 2.0 engine.

Keep Coding.................. :)

Upvotes: 3

Oliver
Oliver

Reputation: 29483

Use display.contentWidth and display.contentHeight. Also look at other SO posts like Corona SDK Cross Device Screen Resolution and on google for "corona lua screen (size OR resolution)".

Upvotes: 2

Related Questions