Full refund within 14 days of purchase date.
First link the "libs"-folder as swc-folder to your project and add the "math"-package. (In the libs-folder you'll find a file named greensock.swc, this file can be downloaded for free on http://www.greensock.com/tweenlite/)
To convert degrees to radials, do it like this:
trace("45degrees = " + MathUtilities.degreesToRadius(45) + "rad");
To convert radials to degrees, do it like this:
trace("1rad = " + MathUtilities.radiusToDegrees(1) + "degrees");
Here's an example of how to create moving circles and calculate the distance between them with this package (view demo to see how it works):
package{
import math.Circle;
import math.MathUtilities;
import com.greensock.TweenLite;
import com.greensock.TweenMax;
import flash.display.Sprite;
public class Main extends Sprite{
private var circle1:Circle;
private var circle2:Circle;
public function Main(){
drawCircles();
}
public function drawCircles():void{
circle1 = new Circle( 50, 0xff0000 );
circle2 = new Circle( 10, 0x00ffff );
circle1.x = 0;
circle2.x = stage.stageWidth;
circle1.y = circle2.y = 100;
TweenLite.to( circle1, 5, {x:stage.stageWidth, onUpdate:checkDistance} );
TweenLite.to( circle2, 5, {x:0, onUpdate:checkDistance} );
addChild( circle1 );
addChild( circle2 );
}
public function checkDistance():void{
var distance:Number = MathUtilities.checkDistance( circle1, circle2);
var hitzone:Number = (circle1.width + circle2.width) /2;
if( (distance - hitzone) <=0 ){
trace("HIT");
TweenMax.killAll();
}
trace(distance - hitzone);
}
}
}
Questions & Comments