On the PC, this code works great, it punches the object in a smooth fashion. On the iPhone it is “choppy”. Almost as if it had to skip frames or something. Can someone help me figure out how to make this work just as nicely on the iPhone as it does the PC?
SymbolHolder is a GameObject that holds 30+ sub objects (symbols). When the reel stops moving I punch it here to simulate a “reel bounce” just as it stops. This is the only iTween call in the game so far. This itween call and this script is on 5 different SymbolHolder objects.
Here is my code:
else if (reelStopped) //If the reel has stopped lock the symbols into their proper place
{
//Make this false so we don't keep locking the symbols into place
reelStopped = false;
float yDistanceToMove = 0;
for (int x = 0; x < Symbols.Length; x++)
{
//If the symbol position is higher than the top reel symbol position and if the symbol is less than
//the top reel Y position + the height of the symbol
if (Symbols[x].transform.position.y > ReelTopStartPosition.y)
{
if (Symbols[x].transform.position.y < (ReelTopStartPosition.y + symbolHeight))
{
//Calculate and store the distance that each symbol needs to be moved to lock into place
yDistanceToMove = Symbols[x].transform.position.y - ReelTopStartPosition.y;
break;
}
}
}
//If the reel wasn't prematurely stopped then play stopping sounds
if (!quickStop)
//Play stopping sound
soundManager.PlayReelStopStandard();
//Move symbols into the locked position
for (int x = 0; x < Symbols.Length; x++)
{
Symbols[x].transform.position = new Vector3(Symbols[x].transform.position.x,Symbols[x].transform.position.y - yDistanceToMove,Symbols[x].transform.position.z);
}
//Simulates 'bump' on reel stop
//If you don't have a delay it will corrupt the symbol ordering
if (!quickStop)
iTween.PunchPosition(SymbolHolder,iTween.Hash("y",-80f,"time",.4f,"delay",.01f));
}
What exactly are the 30 objects? Are you Punching the holder or every individual object? From all of the work I’ve done so far with iTween on the iPhone I can say that it’s probably not iTween causing your slow down. I’m pretty sure it’s how much you are trying to move.