Content Position Problems

Hi, I used Corona many years ago and loved it. I have recently opened up Solar2D and I am having real problems with my content position on the screen. The apps I created in 2010/11 work as in all the functionality is there and I can move/replace images/buttons etc. However, my content is half way over on the left of the screen and half way up!!! It is driving me bananas…please help if you can! TIA Regards Bob

Given how old the apps are, I’d wager they are using graphics version 1, which was deprecated around 2014 if I remember correctly.

One of the changes was how anchors worked. Again, if I remember correctly, with graphics v1, display objects were anchored by their top left corner by default whereas now they are anchored by their centre by default.

This particular issue would likely be resolved by manually setting the following anchor for the affected objects:

object.anchorX = 0
object.anchorY = 0

You could also see about setting the default values for the anchors to 0, see: Solar2D Documentation — API Reference | Libraries | display | setDefault

Hi XeduR,

Thanks for taking the time to respond. Much appreciated. I have fixed this issue but now have another.

The old app has a number of screens that are selected randomly using the “shake” function and it still works. I used a code someone on this forum provided. However, I now do not want to use the ‘shake’ function to change screens but a button. However, I can’t seem to get this. Here is the existing code with “shake” function. Any help would be very much appreciated. Thanks again.

module(…, package.seeall)

function new()
local localGroup = display.newGroup()
→ This is how we start every single file or “screen” in our folder, except for main.lua
– and director.lua
→ director.lua is NEVER modified, while only one line in main.lua changes, described in that file

local background = display.newImage (“shake.png”)
→ This sets the background

local bletherbutton = display.newImage (“bletherbutton.png”)
bletherbutton.x = 332
bletherbutton.y = 715

local img = { “1.png”, “2.png”, “3.png”, “4.png”, “5.png”, “6.png”, “7.png”,“8.png”,“9.png”,“10.png”,“11.png”,

local function onShake(event)
if event.isShake then
math.randomseed ( os.time () )
local r = math.random(1,#img);
local image = display.newImage(img[r], 0, 0);

return true;

Runtime:addEventListener(“accelerometer”, onShake);

return localGroup