Tuesday, June 19, 2012

[Action Script] Having Trouble Setting Up Classes June,2012

I'm working on a side-scroll platform game with AS 3.0.
This is the set up of my project as of now:
.as files (i.e. character mechanics, level/obstacles, bosses, etc.) <-(links to library objects)-> .fla file <-(sets document class as)-> main class (.as file)

For example:
My character mechanics .as file (a movieclip called playerJeebz_mc is linked to a class name of PlayerJeebz and a base class Player):
Code: package
{
        import flash.display.MovieClip;
        import PlayerJeebz;

        public class Player extends MovieClip
        {
                var _playerUnit:PlayerJeebz;

                function Player()
                {
                        _playerUnit = new PlayerJeebz;
                        addChild(_playerUnit);
                }
        }
}My document class is set to a main class called Main:
Code: package 
{
        import flash.display.MovieClip;
        import PlayerJeebz;
       
        public class Main extends MovieClip
        {
                public function Main()
                {
                        var _player:Player = new Player();
                        addChild(_player);
                        trace("Main class working");
                }
        }
       
}I'm still fairly new to this. Can someone tell me why I'm getting this error in the output (I removed some stuff from the previous codes for brevity):
Code: Error: Error #1023: Stack overflow occurred.
        at flash.display::DisplayObject()
        at flash.display::InteractiveObject()
        at flash.display::DisplayObjectContainer()
        at flash.display::Sprite()
        at flash.display::MovieClip()
        at Player()
        at PlayerJeebz()
        at Player()
        at PlayerJeebz()EDIT: Also, does anyone know where I could learn about having controlled jumps? I want tapping a key to produce a smaller jump than holding a key (I'm assuming I'm adding an eventlistener for KEY_UP or something but that's all I got).
Having Trouble Setting Up Classes

Related Post



0 comments: