Thursday, April 3, 2008

Score, Timer, and Collision: Flash Code Examples

This was Bill's question...

Does anyone have actionscript coding for a game timer (countdown), score keeper (hittest), and drawing walls that stop character movement that work in FLASH MX2004? My kids had started their game on that platform and those are the last 3 major issues to make a fully functional game.

[[Bill]] 15:59, 1 April 2008 (EDT)

I was wondering if anyone out there could point us to some good code examples? These are very common game elements so am thinking it would be great collect several examples around each concept. I posted here first, now I will go and search around the web. I'll let you know if I find anything.


Steward Deering said...

I'm not sure on what kind of game it is but this link may be useful :

Patrick Smith said...

I know that RTC had a game called Phat Phoods that had a maze collision detection system. As for whether the code will work in MX2004, as long as it is ActionScript 2, there shouldn't be any problems I don't believe. My tutorial on collision detection:
could be modified that in the collision detection loop to increment a variable that could count as a score keeper I suppose.
As for a simple game could create a movie clip that lasts 12 frames(assuming your flash movie is 12 frames per second). On the 12th frame, you could put Actionscript code that took a particular variable(lets say a variable that represented 300 seconds) and subtracted 1 from it. That would take one unit away per second when that movie clip would run.

Hope this helps.

Lee Kraus said...

Thanks guys! I really appreciate it. I'll check with Denise on this as well. I was there the day she was coding the collision detection.