开发者

Games and accurate timing

I am new to Actionscript and making a game to learn its ways. The game relies heavily on timing as it will be spawning enemies timed with music. For example spawn 2 enemies at exactly 1:31 minutes, start firing at exactly 1:32 etc.

An example of ways I have thought to approach was using timers with events.for example: to spawn an enemy I would have have a timer that has timer(100000,0); which when up will active a spawning enemy. Problems with this approach is 1, that would require too many timers and 2, I have heard the timer is not very accurate.

Is there any accurate ways to time many events which won'开发者_StackOverflow中文版t slow down the game greatly?


flv with embedded cuepoints

see this links http://www.kirupa.com/forum/showthread.php?277542-Cue-Points-flv-embedded http://edutechwiki.unige.ch/en/Flash_video_component_tutorial


Using cuepoints within an FLV is probably the most accurate and consistent way to get your spawns to sync up.

If for some reason, you can't do that, you could call getTimer() to get the number of milliseconds that have elapsed since your application started. Do a getTimer() lookup every ENTER_FRAME, and if the result is greater than your desired time then spawn an enemy. I would worry about your Sound object not being in sync with this technique, and there would be very little you could do to fix it.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜