I've written Pacman in AS2, now I want to port it to AS3 using classes....
I'm looking for ADVICE on my approach to tackling this so far (feels like I'm going wrong already)...
I've made a Console Class that holds program output and a container for a stage, which contains the Maze Class (with dots and scores), then there's a Pacman Class and a Monsters Class, and a Fruits Class too.
public class Console Extends MovieClip
// creates a stage and consoles for development (extending MovieClip)
// (see image link below).
public var gameStage:MovieClip = new MovieClip();
// to gameStage I've added the maze and all the dots (working fine).
public class Maze Extends Console
var maze:maze1 = new maze1(); // simplified for here
gameStage.addChild(maze);
public class Monsters Extends Maze
// bla bla bla
public class Fruits Extends Monsters
// bla bla bla
public class Pacman Extends Fruits
var pac:MsPacman = new MsPacman(); //from library
gameStage.addChild(pac);
//now I just add this Pacman Class to the main timeline
//...and the ALL the others are added through inheritance.
I'm trying to give every class access to public gameStage MovieClip in the Console Class, without creating multiple instances of the Console.
So...should I be nesting each Class in a 'stack' like this, with each one extending the former, with the last one being the Pacman Class, and then just add that to the main timeline? Or am I about to head down a dark alley? I've had a look at MVC Patterns, very confusing for me.
Am I inadvertently using some other design pattern without realising it? Is it safe to continue is this direction? I'm hoping to get this done properly so I can refer back to it as a template for future projects.
Many thanks for your time.
Digi
(image output (same as above)) - as you might be able to see, I use Console for many things, including a central stage, it helps me a lot in development and I just disable it at production time.