Camera and touch event

Currently, to implement the camera function, I used the following function.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
local myTouchListener = function( event ) 
        if(event.phase == "began")then
                lastTouchLocation = { x= event.x, y = event.y}          
        end
 
        if(event.phase == "ended")then
                lastTouchLocation = { x= event.x, y = event.y}
        end
                
        if(event.phase == "moved")then
                local delta = { x = event.x - lastTouchLocation.x, 
                                                y = event.y - lastTouchLocation.y};
                lastTouchLocation = { x= event.x, y = event.y}
 
                localGroup.x = localGroup.x + delta.x
                localGroup.y = localGroup.y + delta.y           
        end
end 
views:1550 update:2012/1/2 12:52:55
corona forums © 2003-2011