Thank you very much for your help and the code!
local check=false GameLoop = function (event) if check==false then check=true -- CODE HERE check=false else -- ENTERED AREA check=false else end
Here is a part of the code from the – CODE HERE area above:
for x=#Weapons,1,-1 do if Weapons[x].active==true and Weapons[x].isVisible==true and Weapons[x].lockedOnEnemy and Weapons[x].shootingAllowed==true and \_G.paused==0 then if not Weapons[x].freqTimer then -- we only shoot if we are not still rotating this weapon: -- allow shooting if we have the rotation of the weapon finished: if not Weapons[x].transTo then shootAtEnemy (Weapons[x]) -- shooting as long in given Frequency as it is in range else -- here we are if we have a rotation towards an enemy -- we check if the current aimed at enemy is visible and in case not we set back the target for this weapon if Weapons[x].lockedOnEnemy and Weapons[x].lockedOnEnemy.isVisible==false then Weapons[x].lockedOnEnemy=nil end end end end end
It is the shootAtEnemy function which on a slow device is making the GameLoop enter the ENTERED AREA (see code above!). In the simulator or a fast device the ENTERED AREA is not getting entered at all.
The shootAtEnemy function is first checking if the weapon is still active before creating bullets, moving the bullets towards enemies and doing collision checks for the bullets with the enemy or other enemies.
Is there a way to running the GameLoop on the slow device using shootAtEnemy without entering the ENTERED AREA? Or how can I make sure the stuff happening in shootAtEnemy is NOT delaying the GameLoop?