Okay, well here’s what I’m working with. I DID get things working with a runtime add event listener, but it doesnt work right. It actually gains speed over time, which is not what I was hoping would happen. See below.
local fNames = {"images/fg1.png","images/fg2.png","images/fg3.png"} local foreground = nil math.randomseed(os.time()) local function ChangeForeground() if foreground then foreground:removeSelf() foreground = nil end local imageNameFG = fNames[math.random(1, #fNames)] foreground = display.newImage(imageNameFG) foreground.isVisible = true foreground:setReferencePoint ( display.CenterReferencePoint ) foreground.xScale = .325 foreground.yScale = .325 foreground.x = 420 -- could also use display.contentWidth foreground.y = 500 -- could also use display.contentHeight local function animateFG (event) foreground.y = foreground.y -0.1 foreground.x = foreground.x -0.1 end Runtime:addEventListener ("enterFrame",animateFG) end ChangeForeground() timer.performWithDelay(10000, ChangeForeground, -1) --end FOREGROUND ; begin next -----------------
The part that says “foreground.y = foreground.y -0.1
foreground.x = foreground.x -0.1” at lines 23, etc., just above the runtime add event listener works okay in the beginning but over time it keeps speeding up, which I dont want…That’s the only problem, otherwise it DOES work…
I would rather use a transition.to, but like I said it just doesn’t want to work for me… What I’m doing wrong concerning the transition.to, I just have no clue…