Unfortunately, it's very hard to replicate the example simply in an fla as I'm manipulating the timeScale of multiple units simultaneously, while also updating the globalTimeScale. From your documentation, I see this:
globalTimeScale property
globalTimeScale:Number [read-write]
Multiplier describing the speed of the root timelines where 1 is normal speed, 0.5 is half-speed, 2 is double speed, etc. The lowest globalTimeScale possible is 0.0001.
Players have the option to speed up or slow down the entire game, hence the need to update the globalTimeScale. But sometimes I need the globalTimeScale to stop altogether, without any calculations happening onUpdate. I was afraid that 0.0001 would still do calculations, so I haven't upgraded to the latest version. I'm currently using version 11.698.
The mobile game is called FireJumpers, it's available for Android and iOS. I would not have been able to build this game without your Greensock classes. It's a line-path drawing, wildfire fighting simulation game where you control a team of elite wildfire fighting units from helicopters to ground units to waterbombers as you try to contain epic wildfires on real maps from locations around the world. It's a top-down view of a map and the mechanics are similar to Flight Control.
These maps can contain up to 55,000+ terrain blits that burns differently based on its type (grass, bushes, trees, buildings, etc) and also effects the speed of the unit's linePath tween while moving over them. For example, a "Cut Team" moving along the assigned linePath can move over grass at say, timeScale = 1, while moving through dense trees at say, timeScale: 0.25. This way the unit's linePath tween can speed up or slow down based on the terrain it's on. That's done using the onUpdate variable in the tween. As a very quick example, it would look like this:
var unitTween:TweenMax;
var speed:Number = 0.2; // Different for each type of unit, smaller the number, faster the unit.
public function onmouseupUnit(e:MouseEvent = null):void
{
// calculate linePath code
calculateLinePath();
// Now tween unit along the linePath
unitTween = TweenMax.to(unit.linePath, speed * unit.linePath.totalLength, {progress:1, onUpdate: updateUnit, onComplete: arrivedAtDestination});
}
public function updateUnit():void
{
var terrain:Object = getTerrainAtLocation(unit.x, unit.y);
if (terrain.type == "Grass") unitTween.timeScale = 1;
else if (terrain.type == "Bush") unitTween.timeScale = 0.6;
else if (terrain.type == "Tree") unitTween.timeScale = 0.25;
}
public function arrivedAtDestination():void
{
if (unit.state == "SprayWater")
{
sprayWater();
}
}
Now there's a lot more obviously to this, but that's the base of what's happening.
Here's my current issue which I can't seem to solve. I have a special unit called the "Hoser Team" that essential sprays water on nearby fires in a radius area around the unit. Sometimes it's necessary to reverse the unit's tween direction if it's getting too close to the fire. Sometimes I need to reverse all the way back, other times, I only need to reverse for 0.5 secs. So I have something like this:
public function onclickUnit(e:MouseEvent = null):void
{
unitTween.reverse();
unit.isBackingUp = true;
if (_isContinuousBackingUp)
{
unitTweenReverse = TweenMax.to(unit, speed * unit.unitTween.totalLength * unit.unitTween.progress, {onUpdate:updateUnit, onComplete: doneBackingUp});
}
else
{
unitTweenReverse = TweenMax.to(unit, 0.5, {onUpdate:updateUnit, onComplete: doneBackingUp});
}
}
public function doneBackingUp():void
{
unit.isBackingUp = false;
unitTween.timeScale = 0; // This way the unit can backup a little bit on the linePath and stop.
// Now here, my trace shows that sometimes the unit ends up being at the start of the linePath, but occasionally it goes to the end of the linePath.
// Do more code stuff
arrivedAtDestination();
}
I'm also using TweenLite as a delayed function call to handle the spread of the fire, so I've had up to 1400+ simultaneous fire tweens running fairly smoothly on a phone.
Anyway, that's the long story.
You can check out the game on your phone or online at http://www.kongregat...wk/fire-jumpers
On the version online, it doesn't have the backup functionality yet.. I'm still working on that of course. But shows the game at a fairly stable state.