Пример #1
0
        public PlayArea()
        {
            //this.m_bNoScalingOnSetRect = true;
            m_spBg            = new Sprite();
            m_spBg.Name       = "Bg";
            m_spBg.MemberName = "PlayArea";
            m_spBg.Parent     = this;
            m_spBg.RegPoint   = new EPoint(30, 30);

            m_spBgFill        = new Sprite();
            m_spBgFill.Parent = this;
            m_spBgFill.Name   = "BgFill";

            m_pathCalc = new PathCalc(this);
            Grid       = new Grid(this);


            m_aCollisionLines = new ArrayList();
            EPointF pntTopLeft     = Grid.GetGfxLocFromGridLoc(new EPointF(-1f, -0.0f));
            EPointF pntBottomRight = Grid.GetGfxLocFromGridLoc(new EPointF(Grid.GridSize.Width + 0.5f, Grid.GridSize.Height));

            //first line is ceiling (where balls stick)
            m_aCollisionLines.Add(ERectangleF.FromLTRB(pntTopLeft.X, pntTopLeft.Y, pntBottomRight.X, pntTopLeft.Y));
            m_aCollisionLines.Add(ERectangleF.FromLTRB(pntTopLeft.X, pntTopLeft.Y, pntTopLeft.X, pntBottomRight.Y));
            m_aCollisionLines.Add(ERectangleF.FromLTRB(pntBottomRight.X, pntTopLeft.Y, pntBottomRight.X, pntBottomRight.Y));

            m_aPlayers = new ArrayList();
            AddPlayer(new Hashtable());

            Hashtable htKeysForPlayer2 = new Hashtable();

            htKeysForPlayer2.Add("left", System.Windows.Forms.Keys.A);
            htKeysForPlayer2.Add("right", System.Windows.Forms.Keys.D);
            htKeysForPlayer2.Add("up", System.Windows.Forms.Keys.W);
            htKeysForPlayer2.Add("shoot", System.Windows.Forms.Keys.S);
            AddPlayer(htKeysForPlayer2);
            //TODO: A fun cooperative mode would be to force players to take turns.


            //TODO: write a main game class which manages levels and multiple playAreas.
            m_level = new LevelManager(this);
            NextLevel();
        }
Пример #2
0
        public PlayArea()
        {
            //this.m_bNoScalingOnSetRect = true;
            m_spBg = new Sprite();
            m_spBg.Name = "Bg";
            m_spBg.MemberName = "PlayArea";
            m_spBg.Parent = this;
            m_spBg.RegPoint = new EPoint(30,30);

            m_spBgFill = new Sprite();
            m_spBgFill.Parent = this;
            m_spBgFill.Name = "BgFill";

            m_pathCalc = new PathCalc(this);
            Grid = new Grid(this);

            m_aCollisionLines = new ArrayList();
            EPointF pntTopLeft = Grid.GetGfxLocFromGridLoc(new EPointF(-1f,-0.0f));
            EPointF pntBottomRight = Grid.GetGfxLocFromGridLoc(new EPointF(Grid.GridSize.Width+0.5f,Grid.GridSize.Height));

            //first line is ceiling (where balls stick)
            m_aCollisionLines.Add(ERectangleF.FromLTRB(pntTopLeft.X,pntTopLeft.Y,pntBottomRight.X,pntTopLeft.Y));
            m_aCollisionLines.Add(ERectangleF.FromLTRB(pntTopLeft.X,pntTopLeft.Y,pntTopLeft.X,pntBottomRight.Y));
            m_aCollisionLines.Add(ERectangleF.FromLTRB(pntBottomRight.X,pntTopLeft.Y,pntBottomRight.X,pntBottomRight.Y));

            m_aPlayers = new ArrayList();
            AddPlayer(new Hashtable());

            Hashtable htKeysForPlayer2 = new Hashtable();
            htKeysForPlayer2.Add("left", System.Windows.Forms.Keys.A);
            htKeysForPlayer2.Add("right", System.Windows.Forms.Keys.D);
            htKeysForPlayer2.Add("up", System.Windows.Forms.Keys.W);
            htKeysForPlayer2.Add("shoot", System.Windows.Forms.Keys.S);
            AddPlayer(htKeysForPlayer2);
            //TODO: A fun cooperative mode would be to force players to take turns.

            //TODO: write a main game class which manages levels and multiple playAreas.
            m_level = new LevelManager(this);
            NextLevel();
        }