How do I find right side coordinates?
I want to hero stop if he is near screen end so hero doesn’t go from screen.
There are some alternatives in display.*
display.contentWidth,
display.pixelHeight or display.pixelWidth depending on the orientation.
Also, haven’t used those yet but display.getSafeAreaInsets(), display.viewableContentWidth and display.safeActualContentWidth should also work depending on your use case.
Hi @ConveyedRex7592,
I use these
screen.lua
local M = {
DECLARED_SCREEN_WIDTH = display.contentWidth,
DECLARED_SCREEN_WIDTH = display.contentHeight,
TOTAL_SCREEN_WIDTH = display.actualContentWidth,
TOTAL_SCREEN_HEIGHT = display.actualContentHeight,
CENTER_X = display.contentCenterX,
CENTER_Y = display.contentCenterY,
UNUSED_WIDTH = display.actualContentWidth - display.contentWidth,
UNUSED_HEIGHT = display.actualContentHeight - display.contentHeight,
LEFT = display.contentCenterX - display.actualContentWidth * 0.5,
TOP = display.contentCenterY - display.actualContentHeight * 0.5,
RIGHT = display.contentCenterX + display.actualContentWidth * 0.5,
BOTTOM = display.contentCenterY + display.actualContentHeight * 0.5,
}
return M
Have a nice day:)
ldurniat
Thanks!