| Home | Tutorials | Forums | Articles | Blogs | Movies | Library | Employment | Press | Buy templates |
|
|
#1 |
|
Registered User
|
OK...I have a game that contains about 12 animated movie clips, each controlled by actionscript. They consist of the following:
1. A "Field" movie clip that contains mouseDown and keyDown handlers controlling basic quit commands and stuff 2. A "Piece" movie clip containing 9 "Block" movie clips and scripted with simple x axis motion 3. Nine "Block" movie clips each containing a mouseDown handler to check when they are clicked on 4. A "Crosshair" movie clip with an enterFrame handler to reset it to the mouses current position So my question is this...I get slowup...how do I get rid of it?? I don't see that this is too many handlers for Flash to handle or anything, but I want it to run at 30 fps or so and I'm currently getting about 10-15. The biggest issue is the crosshair, which produces noticeable slowup when in motion, but not when the mouse is still. This makes no sense to me since Flash should be setting the coordinates of the clip regardless of the motion of the mouse. Also, I suppose I could somehow alter my code so that the individual hit tests weren't assigned to "block", but instead existed in a for loop in "Field". That would knock out 9 handlers, but I want to know if this is worth doing before I start messing with all the target paths and such. And of course, I still have to add some additional code dealing with my matrices to check for when the "Block" movie clips "land", which is essentially 9 if statements in a for loop. THANKS! Oh, and I can post the .fla if someone wants to see it...just let me know. |
|
|
|
|
|
#2 |
|
Administrator
Join Date: Nov 2000
Location: Australia
Posts: 8,612
|
That shouldn't be too many handlers, if you make your code efficient. EnterFrame in Flash 5 was the work of the Devil. In FlashMX we can delete the actions when they have served their purpose so they're not so bad.
In general: - Anything you can do to minimize the use of hitTest is a good thing. Personally I try to avoid it as much as possible. - You might consider little things like removing ourlines from shapes. An circle without a line around it animates much more easily than does a circle with a border. - Consider using mouseMove as your crosshair trigger event in place of enterFrame. .. ahh that's all I can think of. It's late at night.
__________________
Cheers Jesse Stratford ActionScript.org Cofounder Email: presented in this way to stop spam-bots: My email is composed of my first name (jesse) followed by my last name (stratford) followed by @ followed by actionscript.org Please don't email or PM me Flash questions, that's what the Forums are for! ![]() Please don't rely on me reading my PMs either. Email me about important stuff. |
|
|
|
|
|
|
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Game performance issues | hlindley | Gaming and Game Development | 8 | 03-11-2005 07:44 PM |
| [AS2] Problems with platform game (jumping and collision issues) | Amaster | Gaming and Game Development | 6 | 09-14-2004 10:26 PM |
| [AS2] Tile game or not tile game? | krolben | Gaming and Game Development | 4 | 07-28-2004 01:41 PM |
| Html FPS issues | Chrille | Other Flash General Questions | 0 | 02-09-2004 04:49 AM |
| retain fps of loaded movie? | Paul Ferrie | ActionScript 1.0 (and below) | 0 | 12-14-2003 01:22 PM |