use "enterFrame"

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)

What do you want achieve?

The enterFrame event doesn’t have phases.

как использовать события enterframe с MoveAngle в ход?

function dubrLibrary.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 function dubrLibrary.getAngle (a,b) return math.atan2(a.y - b.y, a.x - b.x) / math.pi \* 180; end the code itself: local player = display.newRect( w/2, h/2, 15, 15 ) local function Move (event) local touch = {x = event.x,y = event.y}; if event.phase == "began" then player.rotation = dubrLibrary.getAngle(player,touch) a = dubrLibrary.getAngle(touch,player) dubrLibrary.MoveAngle(player,a) Runtime:addEventListener("enterFrame",dubrLibrary.MoveAngle) problem end end Runtime:addEventListener("touch",Move)

Read documentation about enterFrame and Basic Interactivity and Event Detection.

Example 

local myListener = function( event )     print( "Listener called with event of type " .. event.name ) end Runtime:addEventListener( "enterFrame", myListener )

Look carfully enterFrame listener take event table as argument.

What do you want achieve?

The enterFrame event doesn’t have phases.

как использовать события enterframe с MoveAngle в ход?

function dubrLibrary.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 function dubrLibrary.getAngle (a,b) return math.atan2(a.y - b.y, a.x - b.x) / math.pi \* 180; end the code itself: local player = display.newRect( w/2, h/2, 15, 15 ) local function Move (event) local touch = {x = event.x,y = event.y}; if event.phase == "began" then player.rotation = dubrLibrary.getAngle(player,touch) a = dubrLibrary.getAngle(touch,player) dubrLibrary.MoveAngle(player,a) Runtime:addEventListener("enterFrame",dubrLibrary.MoveAngle) problem end end Runtime:addEventListener("touch",Move)

Read documentation about enterFrame and Basic Interactivity and Event Detection.

Example 

local myListener = function( event )     print( "Listener called with event of type " .. event.name ) end Runtime:addEventListener( "enterFrame", myListener )

Look carfully enterFrame listener take event table as argument.