In my game, you drag around an item while trying to catch other items. Now, as this happens, the item you are dragging gets shorter. I am wondering how to make it so that as the images change, it is one continuous movement. Currently, when the images change, it acts as if your finger has been removed, and you have to press again. Any ideas?
–Player Movement-----------------------------------------------------------------------
function track_Touch (event)
if event.phase == “moved” then
if time < 10 then
fry_Physical.x = player_Fry.x - 60
hand_Physical_Diagonal.x = player_Fry.x + 25
hand_Physical_Flat.x = player_Fry.x + 70
player_Fry.x = event.x
elseif time > 10 and time < 20 then
fry_Physical.x = player_Fry.x - 60
hand_Physical_Diagonal.x = player_Fry.x + 10
hand_Physical_Flat.x = player_Fry.x + 55
player_Fry.x = event.x
elseif time > 20 and time < 30 then
fry_Physical.x = player_Fry.x - 60
hand_Physical_Diagonal.x = player_Fry.x - 10
hand_Physical_Flat.x = player_Fry.x + 35
player_Fry.x = event.x
elseif time > 30 then
fry_Physical.x = player_Fry.x - 60
hand_Physical_Diagonal.x = player_Fry.x - 20
hand_Physical_Flat.x = player_Fry.x + 25
player_Fry.x = event.x
end
end
end
Runtime:addEventListener( “touch”, track_Touch )
–Fry Smaller------------------------------------------------------------------------------
function fry_Shortened ()
player_Fry:removeSelf( )
hand_Physical_Diagonal:removeSelf()
hand_Physical_Flat:removeSelf()
fry_Physical:removeSelf()
player_Fry = display.newImage( fry_Group[#fry_Group - fry_Length_Picture] )
player_Fry.x = player_Fry.x
player_Fry.y = 480
group:insert(player_Fry)
fry_Physical = display.newRect( 0, 0, fry_Length - 50, 2 )
fry_Physical.x = player_Fry.x - 50
fry_Physical.y = player_Fry.y + 15
fry_Physical.alpha = 0
physics.addBody( fry_Physical, “static” )
fry_Physical.Name = “fry”
–Hand Physical------------------------------------------------------------------
hand_Physical = {hand_Physical_Diagonal, hand_Physical_Flat}
hand_Physical_Diagonal = display.newRect( 0, 0, 10, 45 )
hand_Physical_Diagonal.x = player_Fry.x
hand_Physical_Diagonal.y = player_Fry.y - 15
hand_Physical_Diagonal.rotation = 40
hand_Physical_Diagonal.alpha = 0
hand_Physical_Diagonal.Name = “hand_diagonal”
physics.addBody( hand_Physical_Diagonal, “static” )
hand_Physical_Flat = display.newRect( 0, 0, 10, 45 )
hand_Physical_Flat.x = player_Fry.x
hand_Physical_Flat.y = player_Fry.y - 35
hand_Physical_Flat.rotation = 90
hand_Physical_Flat.alpha = 0
physics.addBody( hand_Physical_Flat, “static” )
hand_Physical_Flat.Name = “hand_flat”
audio.play(biteSound, {loops = 0})
fry_Length_Picture = fry_Length_Picture - 1