Hi, I haven’t been using Corona for about 5 years and I am very much still a newbie. I have a problem that I am unable to solve despite trying really hard!!!
I had previously developed an app using the ‘shake’ function to select and display a random screen from
a fixed number of images. It worked fine after I got help on here. The process was
Press Play Button on Splash Screen > screen with shake instruction > shake phone > random selection > shake phone > random selection. Here is the code on the play.lua
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”)
localGroup:insert(background)
–> This sets the background
local img = { “1.png”, “2.png”, “3.png”, “4.png”, “5.png”, “6.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);
end
return true;
end
Runtime:addEventListener(“accelerometer”, onShake);
return localGroup
end
However, I now want to create the app without the shake function and add a ‘nextbutton’ to the random selection so the new process would be
Press Play Button on Splash Screen > random selection with new next button > press next button > random selection > press next button > random selection.
Any help/advice would be greatly received. Thanks
Regards
Bob