TouchControls works on SGS5 but slows on LG G PAD

Hi.

I have a strange problem and cant solve it after 3 days of debugging and coding.
Touch listener is used to control my ship.

On my Samsung S5 (stock rom 5.02) it works like a charm. Also in simulator.
But. Playing it on my LG G Pad (also Quadcore, 2 Gig Ram) it slows down after a period of time.
After finishing the boss (a lots of bullets (but will all be deleted)) and comming to level 2, the FPS drops down to 15.
On the simulator and SGS5 not! Always full FPS. I have no clue what is the problem.

Also the touch works fine for 3 minutes on the LG G PAD.
But then. Dropping down the FPS.
May one of you have any ideas what to look for?

## Edit.

The slowdown ist only if i touch the display.

Without the program runs on 30FPS. Touch and drag - FPS down to 15.
But only on LG G PAD. Samsung S5 no slow downs.

## Edit 2

I have a gamepad code also inside. It is optional to choose between touch and gamepad.

Gamepad is also with event listener and the gampad code from corona sample.
There is no slowdown with the gamepad on both devices.
Here the code for the touch

So.
I did a lot of investigations. Reading tutorials. Also checking the touch function.
But. In fact.
I will not work. On both devices. The S5 is more powerfull and it slows down later.
But also slows after 4-5 minutes.

###edit

What i did also.

– deactivate the collision lisitener. No effect. Also slow down.

####### FOUND IT ###########

####### SOLUTION ##########

What i did. Particles… I am drawing the flame on the ship.

This is done via Particle engine. But not once!! I drawed every frame a new particle!
With a very short emitter time (duration). But still every frame a new particle.

You cant see that on the screen. But after a while i think the engine is overloaded.
So. Put the “duration” to -1 and draw it one time.
Solved the problem with the touch…

Hope this helps anyone anytime.

####### SOLUTION ##########

FPS drops at 1:00 app…

[media]https://www.youtube.com/watch?v=j1MCiSHxGrM[/media]

-- TOUCH INPUT ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- local TextEvent = display.newText( " ", 500, 460, "font", 24 ) TextEvent:setFillColor( 1, 1, 1 ) function getTouchControls() ---------------------------------------------------------- function touchListener(event) local phase=event.phase local texterid = tostring(event.id) if TouchIdSave==nil then TouchIdSave=texterid end TextEvent.text = ""..TouchIdSave.."" if phase == "began" and TouchIdSave==texterid then tempBody = display.newCircle(event.x, event.y, 24) tempBody:setFillColor( 0.8, 0.2, 0.2,0.5 ) physics.addBody(tempBody) tempBody.isSensor = true tempBody.isVisible=true tempBody.joint = physics.newJoint("touch", tempBody, event.x, event.y) ---------------------------------------------------------- function tempBody.enterFrame(event) if tempBody~=nil then local vx, vy = tempBody:getLinearVelocity() if vx\>=500 then vx=500 elseif vx\<=-500 then vx=-500 end if vy\>=500 then vy=500 elseif vy\<=-500 then vy=-500 end myShip:setLinearVelocity(vx, vy) end end ---------------------------------------------------------- Runtime:addEventListener("enterFrame", tempBody) ---------------------------------------------------------- elseif phase == "moved" and tempBody~=nil and TouchIdSave==texterid then tempBody.joint:setTarget(event.x, event.y) elseif TouchIdSave==texterid and phase == "cancelled" or phase == "ended" then Runtime:removeEventListener("enterFrame", tempBody) if tempBody~=nil then display.remove(tempBody.joint) tempBody.joint=nil display.remove(tempBody) tempBody=nil end if TouchIdSave~=nil then display.remove(TouchIdSave) TouchIdSave=nil end end return true end ---------------------------------------------------------- Runtime:addEventListener("touch", touchListener) end

So.
I did a lot of investigations. Reading tutorials. Also checking the touch function.
But. In fact.
I will not work. On both devices. The S5 is more powerfull and it slows down later.
But also slows after 4-5 minutes.

###edit

What i did also.

– deactivate the collision lisitener. No effect. Also slow down.

####### FOUND IT ###########

####### SOLUTION ##########

What i did. Particles… I am drawing the flame on the ship.

This is done via Particle engine. But not once!! I drawed every frame a new particle!
With a very short emitter time (duration). But still every frame a new particle.

You cant see that on the screen. But after a while i think the engine is overloaded.
So. Put the “duration” to -1 and draw it one time.
Solved the problem with the touch…

Hope this helps anyone anytime.

####### SOLUTION ##########

FPS drops at 1:00 app…

[media]https://www.youtube.com/watch?v=j1MCiSHxGrM[/media]

-- TOUCH INPUT ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- local TextEvent = display.newText( " ", 500, 460, "font", 24 ) TextEvent:setFillColor( 1, 1, 1 ) function getTouchControls() ---------------------------------------------------------- function touchListener(event) local phase=event.phase local texterid = tostring(event.id) if TouchIdSave==nil then TouchIdSave=texterid end TextEvent.text = ""..TouchIdSave.."" if phase == "began" and TouchIdSave==texterid then tempBody = display.newCircle(event.x, event.y, 24) tempBody:setFillColor( 0.8, 0.2, 0.2,0.5 ) physics.addBody(tempBody) tempBody.isSensor = true tempBody.isVisible=true tempBody.joint = physics.newJoint("touch", tempBody, event.x, event.y) ---------------------------------------------------------- function tempBody.enterFrame(event) if tempBody~=nil then local vx, vy = tempBody:getLinearVelocity() if vx\>=500 then vx=500 elseif vx\<=-500 then vx=-500 end if vy\>=500 then vy=500 elseif vy\<=-500 then vy=-500 end myShip:setLinearVelocity(vx, vy) end end ---------------------------------------------------------- Runtime:addEventListener("enterFrame", tempBody) ---------------------------------------------------------- elseif phase == "moved" and tempBody~=nil and TouchIdSave==texterid then tempBody.joint:setTarget(event.x, event.y) elseif TouchIdSave==texterid and phase == "cancelled" or phase == "ended" then Runtime:removeEventListener("enterFrame", tempBody) if tempBody~=nil then display.remove(tempBody.joint) tempBody.joint=nil display.remove(tempBody) tempBody=nil end if TouchIdSave~=nil then display.remove(TouchIdSave) TouchIdSave=nil end end return true end ---------------------------------------------------------- Runtime:addEventListener("touch", touchListener) end