Prev | Current Page 1005 | Next

L. McColl-Sylvester and F. Ponticelli

"Professional haXe and Neko"

Luckily, Timer s use minimal resources; certainly a lot less than it costs to defer a thread
with delay .
var milliseconds : Int = 1 / preferredFPS;
var timer : Timer = new Timer( milliseconds );
Once a Timer is in use, you can check whether the required amount of time has passed by querying its
isTime method. Now, in an ideal world, the Timer would fire an event when such a time has passed,
but seeing as games aren ??™ t usually event based, you aren ??™ t offered that luxury. The isTime method will
return true if the set amount of time comes to pass.
For ad hoc occasions, one could query the getCurrent method to acquire the number of milliseconds
passed since the NME library was initialized, while the getPrevious method returns the number of
milliseconds since isTime last returned true .
The Wonderful World of Sprites
Now you ??™ re getting to the fun stuff. Sprites, managed by the Sprite class, represent the animation
control of the graphical assets in your applications. With these babies, you can do just about anything,
from a simple game character to a business presentation.


Pages:
993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017