3

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 ?

kevin ver
  • 831
  • 4
  • 14
  • 37

2 Answers2

3

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.................. :)

Krishna Raj Salim
  • 7,331
  • 5
  • 34
  • 66
2

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)".

Community
  • 1
  • 1
Oliver
  • 27,510
  • 9
  • 72
  • 103