You can use this to for further function processing, such as
collision detection.
The following example shows the transform method in use, along with one of the ways to avoid using
a single image Surface object:
import nme.Manager;
import nme.Surface;
import nme.Rect;
import nme.Point;
import nme.TTF;
class TransformSurface
{
static var mainObject : TransformSurface;
var running : Bool;
var mng : Manager;
var batSrf : Surface;
var dispSrf : Surface;
static function main()
{
mainObject = new TransformSurface();
}
public function new()
{
mng = new Manager( 200, 200, ???Surface Draw???, false, ???ico.gif??? );
batSrf = new Surface( ???bat.png??? );
dispSrf = new Surface( ???bat.png??? );
dispSrf.setKey( 0xFF, 0x00, 0xFF );
var dir = true;
var angle = 0;
running = true;
while (running)
{
mng.clear( 0x00000000 );
dispSrf.clear( 0xFF00FF );
batSrf.transform( untyped dispSrf.__srf, angle, new Point(1, 1),
new Point(56, 87), new Point(70, 70), Surface.DEFAULT );
dispSrf.draw( Manager.getScreen(), new Rect(35, 35, 90, 70),
new Point( 70, 70 ) );
if ( dir == true )
angle += 10;
else
angle -= 10;
if ( angle > 350 ) dir = false;
if ( angle < 10 ) dir = true;
mng.
Pages:
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010