here is the full code…
[lua]local storyboard = require(“storyboard”)
local scene = storyboard.newScene()
function scene:createScene(event)
local sceneGroup = self.view
background = display.newImageRect(“water.png”,640,1136)
background.anchorX = .5
background.anchoryY = .5
background.x = display.contentCenterX
background.y = display.contentHeight / 2
sceneGroup:insert(background)
lily = display.newImageRect(“lily.png”,160,160)
lily.anchorX = .5
lily.anchorY = .5
lily.x = display.contentCenterX
lily.y = display.contentCenterY + 400
sceneGroup:insert(lily)
local frog = display.newImageRect(“frog.png”,160,160)
frog.anchorX = .5
frog.anchorY = .5
frog.x = display.contentCenterX
frog.y = display.contentCenterY + 400
sceneGroup:insert(frog)
end
local function jump(event)
transition.cancel(frog.trans)
frog.trans = transition.to(frog,{time=2000, x=event.x, y=event.y})
print(event.x); print(event.y)
end
local rowCount = 4
local columnCount = 4
local imgSize = 160
for row = 0, rowCount do – Loop through the rows
local col = math.random(columnCount) – Choose a column randomly
local x = (col * imgSize) - imgSize – subtracting imgSize to start from 0
local y = row * imgSize
local img = display.newImageRect(“lily.png”, imgSize, imgSize)
img.x = x
img.y = y
img.anchorX = 0
img.anchorY = 0
print(x,y)
end
Runtime:addEventListener(“touch”,jump)[/lua]