Context of the game:
As most of the plane fighter / arcade shoot em up games nowadays, the basic control is to swipe anywhere in the screen to move the plane character.
Summary of Issue:
The Plane character "teleports to the swiping position"
Things already done:
1. The design is to move the character by swiping anywhere on the screen. Most tutorials I've searched in Google is either Plane fighter with D-pad controller or the character should be dragged (event.target during run time)
2. I came across to this topic and gave it a try. < link >
Current code chunk:
local function f_planeTouchEvent( im_event ) if ( im_event.phase == "began" ) then --Lets the program focus on the touched object display.getCurrentStage():setFocus( im_event.target, im_event.id) im_event.target.isFocus = true --Store the original X and Y values of touched object im_event.target.markX = im_event.target.x im_event.target.markY = im_event.target.y elseif ( im_event.phase == "moved" ) then --Object was moved/dragged if ( im_event.target.isFocus ) then im_event.target.x = im_event.x im_event.target.y = im_event.y end end end --< other codes of the program here > ld_s_plane:addEventListener( "touch", f_planeTouchEvent)
Simulation (please see attached image for visualization )
1. Start of simulation, image is at the bottom part
2. As I swipe the upper part, the plane character teleported to where I swiped.
The plane should still be at the bottom part with movement imitating my swipe
Corona SDK release: 2018.3326
Computer OS: Windows 10 64 bit
Simulation views encountered: All devices
-Let me know if there are statements that are confusing in my post. Apologies as I am not a native English speaker.
-If there are things that I forgot to include, please let me know.
-If this is already solved from other post/sites. Please direct me. Maybe I am using the incorrect keywords