Hello everyone, I am making a game where when your finger moves off the object (in my case a circle) even if it is still touching the screen something happens (background image turns red).
Note that the circle is randomly moving
Here is my code
math.randomseed( os.time() ) bg = display.newRect(-100,0,840,1640) bubble = display.newCircle(330,500, 200) bubble:setFillColor(230,230,230) local playing = false local function gameStart (event) if event.phase == "began" then help:removeSelf() help2:removeSelf() playing = true --in the future add a count down timer local function move (evnet) local xV = math.random( 0, 500 ) local yV = math.random( 0, 1136 ) transition.to( bubble, { time=1500, x=xV, y=yV, onComplete=move} ) end move() end if event.phase == "ended" then playing = false bg:setFillColor(255,0,0) end end bubble:addEventListener("touch",gameStart)
As always, thanks for the high quality support!