Ejemplo n.º 1
0
        public void CLICK(engine.Engine e, Point p)
        {
            miniCluster();

            foreach (Box b in MiniCluster)
            {
                b.CLICK(e, p, INEPTS);
            }

            e.C();
            this.DRAW(e);
        }
Ejemplo n.º 2
0
        public void KEYPRESS(engine.Engine e, KeyEventArgs key)
        {
            //Box.Position ps = this.getInact();

            //getHero();


            if (key.KeyCode == Keys.W || key.KeyCode == Keys.Up || key.KeyCode == Keys.NumPad8)
            {
                for (int k = 0; k < Hero.Count; k++)
                {
                    Box          b     = Hero[k];
                    Box          INEPT = b;
                    Box.Position ps    = b.Pos;

                    if (ps.J - 1 >= CEIL)
                    {
                        if ((int)ClusterBox[ps.I, ps.J - 1].Knd == 2)
                        {
                            remEnemyAt(new Box.Position(ps.I, ps.J - 1));
                            ClusterBox[ps.I, ps.J - 1].Knd = Box.Kind.ACTIVE;
                        }

                        INEPT.Knd = Box.Kind.ACTIVE;
                        //remHeroAt(INEPT.Pos);
                        ClusterBox[ps.I, ps.J - 1].Knd = Box.Kind.INACTIVE;
                        //Hero.Add(ClusterBox[ps.I, ps.J - 1]);
                    }
                }
            }
            if (key.KeyCode == Keys.S || key.KeyCode == Keys.Down || key.KeyCode == Keys.NumPad2)
            {
                for (int k = 0; k < Hero.Count; k++)
                {
                    Box          b = Hero[k]; Box INEPT = b;
                    Box.Position ps = b.Pos;
                    if (ps.J + 1 <= NO - 1)
                    {
                        if ((int)ClusterBox[ps.I, ps.J + 1].Knd == 2)
                        {
                            remEnemyAt(new Box.Position(ps.I, ps.J + 1));
                            ClusterBox[ps.I, ps.J + 1].Knd = Box.Kind.ACTIVE;
                        }

                        INEPT.Knd = Box.Kind.ACTIVE;
                        //remHeroAt(INEPT.Pos);
                        ClusterBox[ps.I, ps.J + 1].Knd = Box.Kind.INACTIVE;
                        //Hero.Add(ClusterBox[ps.I, ps.J + 1]);
                    }
                }
            }
            if (key.KeyCode == Keys.A || key.KeyCode == Keys.Left || key.KeyCode == Keys.NumPad4)
            {
                for (int k = 0; k < Hero.Count; k++)
                {
                    Box          b = Hero[k]; Box INEPT = b;
                    Box.Position ps = b.Pos;

                    if (ps.I - 1 >= 0 && (ClusterBox[ps.I - 1, ps.J].Knd != Box.Kind.INACTIVE))
                    {
                        if ((int)ClusterBox[ps.I - 1, ps.J].Knd == 2)
                        {
                            remEnemyAt(new Box.Position(ps.I - 1, ps.J));
                            ClusterBox[ps.I - 1, ps.J].Knd = Box.Kind.ACTIVE;
                            SCORE++;
                        }


                        INEPT.Knd = Box.Kind.ACTIVE;
                        //remHeroAt(INEPT.Pos);
                        ClusterBox[ps.I - 1, ps.J].Knd = Box.Kind.INACTIVE;
                        //Hero.Add(ClusterBox[ps.I - 1, ps.J]);
                    }
                }
            }
            if (key.KeyCode == Keys.D || key.KeyCode == Keys.Right || key.KeyCode == Keys.NumPad6)
            {
                for (int k = Hero.Count - 1; k >= 0; k--)
                {
                    Box          b     = Hero[k];
                    Box          INEPT = b;
                    Box.Position ps    = b.Pos;

                    if (ps.I + 1 < NO && (ClusterBox[ps.I + 1, ps.J].Knd != Box.Kind.INACTIVE))
                    {
                        if ((int)ClusterBox[ps.I + 1, ps.J].Knd == 2)
                        {
                            remEnemyAt(new Box.Position(ps.I + 1, ps.J));
                            ClusterBox[ps.I + 1, ps.J].Knd = Box.Kind.ACTIVE;
                            SCORE++;
                        }

                        INEPT.Knd = Box.Kind.ACTIVE;
                        //remHeroAt(INEPT.Pos);
                        ClusterBox[ps.I + 1, ps.J].Knd = Box.Kind.INACTIVE;
                        //Hero.Add(ClusterBox[ps.I + 1, ps.J]);
                    }
                }
            }

            if (key.KeyCode == Keys.NumPad7)
            {
                for (int k = 0; k < Hero.Count; k++)
                {
                    Box          b = Hero[k]; Box INEPT = b;
                    Box.Position ps = b.Pos;
                    if (ps.I - 1 >= 0 && ps.J - 1 >= CEIL)
                    {
                        if ((int)ClusterBox[ps.I - 1, ps.J - 1].Knd == 2)
                        {
                            remEnemyAt(new Box.Position(ps.I - 1, ps.J - 1));
                            ClusterBox[ps.I - 1, ps.J - 1].Knd = Box.Kind.ACTIVE;
                        }
                        INEPT.Knd = Box.Kind.ACTIVE;
                        //remHeroAt(INEPT.Pos);
                        ClusterBox[ps.I - 1, ps.J - 1].Knd = Box.Kind.INACTIVE;
                        //Hero.Add(ClusterBox[ps.I - 1, ps.J - 1]);
                    }
                }
            }

            if (key.KeyCode == Keys.NumPad3)
            {
                for (int k = 0; k < Hero.Count; k++)
                {
                    Box          b = Hero[k]; Box INEPT = b;
                    Box.Position ps = b.Pos;
                    if (ps.I + 1 <= NO - 1 && ps.J + 1 <= NO - 1)
                    {
                        if ((int)ClusterBox[ps.I + 1, ps.J + 1].Knd == 2)
                        {
                            remEnemyAt(new Box.Position(ps.I + 1, ps.J + 1));
                            ClusterBox[ps.I + 1, ps.J + 1].Knd = Box.Kind.ACTIVE;
                        }

                        INEPT.Knd = Box.Kind.ACTIVE;
                        //remHeroAt(INEPT.Pos);
                        ClusterBox[ps.I + 1, ps.J + 1].Knd = Box.Kind.INACTIVE;
                        //Hero.Add(ClusterBox[ps.I + 1, ps.J + 1]);
                    }
                }
            }

            if (key.KeyCode == Keys.NumPad9)
            {
                for (int k = 0; k < Hero.Count; k++)
                {
                    Box          b = Hero[k]; Box INEPT = b;
                    Box.Position ps = b.Pos;
                    if (ps.I + 1 <= NO - 1 && ps.J - 1 >= CEIL)
                    {
                        if ((int)ClusterBox[ps.I + 1, ps.J - 1].Knd == 2)
                        {
                            remEnemyAt(new Box.Position(ps.I + 1, ps.J - 1));
                            ClusterBox[ps.I + 1, ps.J - 1].Knd = Box.Kind.ACTIVE;
                        }

                        INEPT.Knd = Box.Kind.ACTIVE;
                        //remHeroAt(INEPT.Pos);
                        ClusterBox[ps.I + 1, ps.J - 1].Knd = Box.Kind.INACTIVE;
                        //Hero.Add(ClusterBox[ps.I + 1, ps.J - 1]);
                    }
                }
            }

            if (key.KeyCode == Keys.NumPad1)
            {
                for (int k = 0; k < Hero.Count; k++)
                {
                    Box          b = Hero[k]; Box INEPT = b;
                    Box.Position ps = b.Pos;
                    if (ps.I - 1 >= 0 && ps.J + 1 <= NO - 1)
                    {
                        if ((int)ClusterBox[ps.I - 1, ps.J + 1].Knd == 2)
                        {
                            remEnemyAt(new Box.Position(ps.I - 1, ps.J + 1));
                            ClusterBox[ps.I - 1, ps.J + 1].Knd = Box.Kind.ACTIVE;
                        }

                        INEPT.Knd = Box.Kind.ACTIVE;
                        //remHeroAt(INEPT.Pos);
                        ClusterBox[ps.I - 1, ps.J + 1].Knd = Box.Kind.INACTIVE;
                        //Hero.Add(ClusterBox[ps.I - 1, ps.J + 1]);
                    }
                }
            }

            getHero();
            e.C();
            this.DRAW(e);
        }