how to use “enterFrame” with “began” ?
local fon = display.newImage( "fon.jpg",-100,-100); fon:scale(4,4) local w,h = display.contentWidth,display.contentHeight function getAngle (a,b) return math.atan2(a.y - b.y, a.x - b.x) / math.pi \* 180; end local player = display.newRect( w/2, h/2, 15, 15 ) function MoveAngle (a,angle) a.dx = math.cos(math.rad(angle)); a.dy = math.sin(math.rad(angle)); a.x =a.x + a.dx/2; a.y =a.y + a.dy/2; end local function Move (event) local touch = {x = event.x,y = event.y}; if event.phase == "began" then player.rotation = getAngle(touch,player) MoveAngle(player,getAngle(touch,player)); end end --Runtime:addEventListener("enterFrame",MoveAngle) Runtime:addEventListener("touch",Move)