This content has been marked as final. Show 1 reply
> Most of the Flash game books are still written in procedural
> code, sometimes with a small example of oop in .as files. I'm
> looking for some really good examples of simple arcade
> games written using best practise AS2 OOP (compatible
> with AS3 practises).
The difference between AS2 and AS3 are, in many cases, fundamental. The
very structure of MovieClips is different (base class in AS2, extension of
Sprite, DisplayObjectContainer, InteractiveObject, DisplayObject, etc., in
AS3). Object events are dispatched in a completely new way. I guess the
long and short of it is, you won't find a book written for AS2 that will be
compatible with AS3 -- but you did say "AS3 practices," and certainly OOP as
a concept is key in both languages.
Have you looked at Glen Rhodes' "Macromedia Flash Professional 8 Game
> 1. I'm assuming this will include most of the code in external .as
> class files.
I would assume the same. :)
> 2. There are several ways of including movieclips, which is best
> for arcades. linking it in the fla or passing it to a class?
I'm not sure I follow your quesiton. If a given class needs access to a
movie clip, you'll have to provide a reference of that clip to the class,
> 3. Would creating the main game objects as components ad
> too much overhead - ie. game would run slower.
I've written quite a few Components. They're cool ... they definitely
have their place, but I probably wouldn't write a Component for my own use
in my own games. I doubt the Component would add much noticeable overhead,
but they can be a pain to write. In something like this, classes would
probably be all you need.
> 4. Is there a better way of handling collision detection with OOP.
Better than what?
> Even those game books that do have as2 oop code still seem to just
> loop through all the possible collision objects from a central enterframe
> function then act directly on the objects if there is a collision.
OOP is nothing more than an organized way to wrap procedural code.
There are easily half a dozen ways to determine collisions, from
MovieClip.hitTest() to completely math-oriented approaches. Makes no
difference if those algorithms are written into a class or in a frame
> Do listeners/broadcasters have a roll here? ie. broadcast a 'die'
> message to the object and let it work out how to do that.
Sure, I'd use EventDispatcher or AsBroadcaster.
> 5. Should the game handle the collision detection centrally or
> each individual object in their own enterframe function.
Depends on the game, I'd say. ;)
Adobe Community Expert
Dev blog, http://www.quip.net/blog/
"Luck is the residue of good design."