Example #1
0
        public void tick(float t, float dt)
        {
            playerScore = (float)Math.Pow(t, 2);
            // check for collisions between all our objects and the player
            collide();

            if (this.currentlevel.isLevelDone(t, 0))
            {
                all = new List <GameObject>();

                currentlevel = new Level2(t);

                player = currentlevel.setupLevel(this.AddNewObject);
                all.Remove(player);
                all.Add(player);

                return;
            }

            // go through every single game object and get them to update their position/logic/etc
            for (int x = 0; x < all.Count; x++)
            {
                all[x].Tick(t, dt, AddNewObject);
            }
        }
Example #2
0
        // constructor
        public GameLogic()
        {
            // score starts at zero
            playerScore = 0;
            // initilizing isDead to false at the start of the Game
            isDead = false;
            // creating all to a list for the enemy
            // intilizied to empty list and not null object
            all = new List <GameObject>();

            currentlevel = new Level1(0);

            player = currentlevel.setupLevel(this.AddNewObject);
            all.Remove(player);
            all.Add(player);
        }