Example #1
0
        // Initialise the game
        public void InitializeGame(Difficulty difficulty, List <IntVector2> positions)
        {
            // Make sure mole list is empty
            moles.Clear();

            // Create all the moles
            for (int i = 0; i < positions.Count; i++)
            {
                Mole m = new Mole(moleChoice);
                m.AnchorPoint = CCPoint.AnchorLowerLeft;
                m.PositionX   = positions[i].x;
                m.PositionY   = positions[i].y;
                AddMoleAsChild(m);

                moles.Add(m);
            }

            // Set up lives
            lives = initialLives;

            // Set up difficulty variables
            switch (difficulty)
            {
            case Difficulty.Easy:
                moleVisibleFor   = 3f;
                timeBetweenMoles = 1.2f;
                break;

            case Difficulty.Medium:
                moleVisibleFor   = 1.5f;
                timeBetweenMoles = 0.9f;
                break;

            case Difficulty.Hard:
                moleVisibleFor   = 0.75f;
                timeBetweenMoles = 0.5f;
                break;
            }

            // Tell the game we've started
            currentState = GameState.Game;

            // Start game logic
            PickRandomMole();
        }
Example #2
0
        public void CreateMoles(Panel pMole1, Panel pMole2, Panel pMole3, Panel pMole4, Panel pMole5,
                                Panel pMole6, Panel pMole7, Panel pMole8, Panel pMole9, Panel pMole10, Panel pMole11, Panel pMole12)
        {
            mole1      = new Mole();
            mole1.name = "mole1";
            mole1.view = pMole1;
            mole1.hideMole();

            mole2      = new Mole();
            mole2.name = "mole2";
            mole2.view = pMole2;
            mole2.hideMole();

            mole3      = new Mole();
            mole3.name = "mole3";
            mole3.view = pMole3;
            mole3.hideMole();

            mole4      = new Mole();
            mole4.name = "mole4";
            mole4.view = pMole4;
            mole4.hideMole();

            mole5      = new Mole();
            mole5.name = "mole5";
            mole5.view = pMole5;
            mole5.hideMole();

            mole6      = new Mole();
            mole6.name = "mole6";
            mole6.view = pMole6;
            mole6.hideMole();

            mole7      = new Mole();
            mole7.name = "mole7";
            mole7.view = pMole7;
            mole7.hideMole();

            mole8      = new Mole();
            mole8.name = "mole8";
            mole8.view = pMole8;
            mole8.hideMole();

            mole9      = new Mole();
            mole9.name = "mole9";
            mole9.view = pMole9;
            mole9.hideMole();

            mole10      = new Mole();
            mole10.name = "mole10";
            mole10.view = pMole10;
            mole10.hideMole();

            mole11      = new Mole();
            mole11.name = "mole11";
            mole11.view = pMole11;
            mole11.hideMole();

            mole12      = new Mole();
            mole12.name = "mole12";
            mole12.view = pMole12;
            mole12.hideMole();
        }
Example #3
0
 public void AddMoleAsChild(Mole m)
 {
     AddChild(m);
 }