void OnMarioInstanceVsA_BrickListCollisionOccurred(Super_Marios_Bros.Entities.Mario first, Entities.A_Brick second)
        {
            Console.WriteLine("Collsion occured");
            bool wasPushedDown = first.AxisAlignedRectangleInstance.LastMoveCollisionReposition.Y < 0;

            if (wasPushedDown && PassonClass.mariobig)
            {
                Console.WriteLine("was pushed down true");
                bool hasDestroyedBlock = false;
                for (int i = 0; i < A_BrickList.Count; i++)
                {
                    //Console.WriteLine("New Brick");
                    if (A_BrickList[i].AxisAlignedRectangleInstance.CollideAgainst(first.CollisionThing))
                    {
                        // New code:
                        Console.WriteLine("Collided");
                        CombinedShapeCollection.RemoveRectangle(A_BrickList[i].AxisAlignedRectangleInstance);
                        A_BrickList[i].Imdead();
                        hasDestroyedBlock = true;
                        break;
                    }
                }
                if (!hasDestroyedBlock)
                {
                    // New code:
                    Console.WriteLine("The other way");

                    CombinedShapeCollection.RemoveRectangle(second.AxisAlignedRectangleInstance);

                    second.Imdead();
                }
            }
        }
        void OnMarioInstanceVsLucky_blockListCollisionOccurred(Super_Marios_Bros.Entities.Mario first, Entities.Lucky_block second)
        {
            Console.WriteLine("Collsion occured");
            bool wasPushedDown = first.AxisAlignedRectangleInstance.LastMoveCollisionReposition.Y < 0;

            if (wasPushedDown)
            {
                bool hasDestroyedBlock = false;
                Console.WriteLine("was pushed down true");
                for (int i = 0; i < Lucky_blockList.Count; i++)
                {
                    if (Lucky_blockList[i].AxisAlignedRectangleInstance.CollideAgainst(first.CollisionThing) && Lucky_blockList[i].Used3 == false)
                    {
                        Console.WriteLine("Collided");
                        if (Lucky_blockList[i].HasPilzInIt && Lucky_blockList[i].Used3 == false)
                        {
                            var mushroom = Factories.MushroomFactory.CreateNew();
                            mushroom.X        = Lucky_blockList[i].X;
                            mushroom.Y        = Lucky_blockList[i].Y + 17;
                            hasDestroyedBlock = true;
                        }
                        if (Lucky_blockList[i].HasPilzInIt == false && !Lucky_blockList[i].Used3)
                        {
                            PassonClass.Coins += 1;
                        }
                        Lucky_blockList[i].HandleHit();
                        break;
                    }
                }
                if (!hasDestroyedBlock)
                {
                    // New code:
                    Console.WriteLine("The other way");
                    if (second.HasPilzInIt == true && second.Used3 == false)
                    {
                        var mushroom = Factories.MushroomFactory.CreateNew();
                        mushroom.X = second.X;
                        mushroom.Y = second.Y + 17;
                    }
                    if (!second.HasPilzInIt && !second.Used3)
                    {
                        PassonClass.Coins += 1;
                    }
                    second.HandleHit();
                }
            }
        }
        void OnMarioInstanceVsGumbaListAxisAlignedRectangleInstanceCollisionOccurred(Super_Marios_Bros.Entities.Mario first, Entities.Gumba second)
        {
            Console.WriteLine("Collsion occured");
            bool wasPushedDown     = first.AxisAlignedRectangleInstance.LastMoveCollisionReposition.Y > 0;
            bool hasDestroyedBlock = false;

            if (wasPushedDown)
            {
                for (int i = 0; i < GumbaList.Count; i++)
                {
                    if (GumbaList[i].AxisAlignedRectangleInstance.CollideAgainst(first.DieThing))
                    {
                        Console.WriteLine("Collided");
                        MarioInstance.Velocity.Y = 160;
                        CombinedShapeCollection.RemoveRectangle(A_BrickList[i].AxisAlignedRectangleInstance);
                        GumbaList[i].Deadgumba();
                        PassonClass.Score += 100;
                        hasDestroyedBlock  = true;
                        break;
                    }
                }
                if (!hasDestroyedBlock)
                {
                    // New code:
                    Console.WriteLine("The other way");
                    MarioInstance.Velocity.Y = 160;
                    second.Deadgumba();
                    PassonClass.Score += 100;
                }
            }
            else if (MarioInstance.AxisAlignedRectangleInstance.CollideAgainst(second.RightMarioDead) || MarioInstance.AxisAlignedRectangleInstance.CollideAgainst(second.LeftMarioDead))
            {
                second.Destroy();
                if (PassonClass.mariobig == true)
                {
                    PassonClass.mariobig = false;
                }
                else if (PassonClass.mariobig == false)
                {
                    HandleMarioDead();
                }
            }
        }
        public override void Initialize(bool addToManagers)
        {
            LoadStaticContent(ContentManagerName);
            // Not instantiating for FlatRedBall.TileGraphics.LayeredTileMap Map in Screens\GameScreen (Screen) because properties on the object prevent it
            // Not instantiating for FlatRedBall.TileCollisions.TileShapeCollection SolidCollision in Screens\GameScreen (Screen) because properties on the object prevent it
            // Not instantiating for FlatRedBall.TileCollisions.TileShapeCollection CloudCollision in Screens\GameScreen (Screen) because properties on the object prevent it
            A_BrickList                      = new FlatRedBall.Math.PositionedObjectList <Super_Marios_Bros.Entities.A_Brick>();
            A_BrickList.Name                 = "A_BrickList";
            MarioInstance                    = new Super_Marios_Bros.Entities.Mario(ContentManagerName, false);
            MarioInstance.Name               = "MarioInstance";
            Lucky_blockList                  = new FlatRedBall.Math.PositionedObjectList <Super_Marios_Bros.Entities.Lucky_block>();
            Lucky_blockList.Name             = "Lucky_blockList";
            GumbaList                        = new FlatRedBall.Math.PositionedObjectList <Super_Marios_Bros.Entities.Gumba>();
            GumbaList.Name                   = "GumbaList";
            A_Brick_being_destroyedList      = new FlatRedBall.Math.PositionedObjectList <Super_Marios_Bros.Entities.A_Brick_being_destroyed>();
            A_Brick_being_destroyedList.Name = "A_Brick_being_destroyedList";
            CombinedShapeCollection          = new FlatRedBall.TileCollisions.TileShapeCollection();
            MushroomList                     = new FlatRedBall.Math.PositionedObjectList <Super_Marios_Bros.Entities.Mushroom>();
            MushroomList.Name                = "MushroomList";
            TurtleList                       = new FlatRedBall.Math.PositionedObjectList <Super_Marios_Bros.Entities.Turtle>();
            TurtleList.Name                  = "TurtleList";
            DeadMarioInstance                = new Super_Marios_Bros.Entities.DeadMario(ContentManagerName, false);
            DeadMarioInstance.Name           = "DeadMarioInstance";
            CoinList      = new FlatRedBall.Math.PositionedObjectList <Super_Marios_Bros.Entities.Coin>();
            CoinList.Name = "CoinList";
            MarioInstanceVsGumbaListAxisAlignedRectangleInstance = FlatRedBall.Math.Collision.CollisionManager.Self.CreateRelationship(MarioInstance, GumbaList);
            MarioInstanceVsGumbaListAxisAlignedRectangleInstance.SetSecondSubCollision(item => item.AxisAlignedRectangleInstance);
            MarioInstanceVsGumbaListAxisAlignedRectangleInstance.Name = "MarioInstanceVsGumbaListAxisAlignedRectangleInstance";
            MarioInstanceVsGumbaListAxisAlignedRectangleInstance.SetMoveCollision(1f, 1f);

            {
                var temp    = new FlatRedBall.Math.Collision.DelegateCollisionRelationship <Super_Marios_Bros.Entities.Mario, FlatRedBall.TileCollisions.TileShapeCollection>(MarioInstance, SolidCollision);
                var isCloud = false;
                temp.CollisionFunction = (first, second) =>
                {
                    return(first.CollideAgainst(second, isCloud));
                }
                ;
                FlatRedBall.Math.Collision.CollisionManager.Self.Relationships.Add(temp);
                MarioInstanceVsSolidCollision = temp;
            }
            MarioInstanceVsSolidCollision.Name = "MarioInstanceVsSolidCollision";

            {
                var temp    = new FlatRedBall.Math.Collision.DelegateSingleVsListRelationship <Super_Marios_Bros.Entities.Mario, Entities.Lucky_block>(MarioInstance, Lucky_blockList);
                var isCloud = false;
                temp.CollisionFunction = (first, second) =>
                {
                    return(first.CollideAgainst(second, isCloud));
                }
                ;
                FlatRedBall.Math.Collision.CollisionManager.Self.Relationships.Add(temp);
                MarioInstanceVsLucky_blockList = temp;
            }
            MarioInstanceVsLucky_blockList.Name = "MarioInstanceVsLucky_blockList";

            GumbaListAxisAlignedRectangleInstanceVsSolidCollision = FlatRedBall.Math.Collision.CollisionManagerTileShapeCollectionExtensions.CreateTileRelationship(FlatRedBall.Math.Collision.CollisionManager.Self, GumbaList, SolidCollision);
            GumbaListAxisAlignedRectangleInstanceVsSolidCollision.SetFirstSubCollision(item => item.AxisAlignedRectangleInstance);
            GumbaListAxisAlignedRectangleInstanceVsSolidCollision.Name = "GumbaListAxisAlignedRectangleInstanceVsSolidCollision";
            GumbaListAxisAlignedRectangleInstanceVsSolidCollision.SetMoveCollision(0f, 1f);

            {
                var temp    = new FlatRedBall.Math.Collision.DelegateSingleVsListRelationship <Super_Marios_Bros.Entities.Mario, Entities.A_Brick>(MarioInstance, A_BrickList);
                var isCloud = false;
                temp.CollisionFunction = (first, second) =>
                {
                    return(first.CollideAgainst(second, isCloud));
                }
                ;
                FlatRedBall.Math.Collision.CollisionManager.Self.Relationships.Add(temp);
                MarioInstanceVsA_BrickList = temp;
            }
            MarioInstanceVsA_BrickList.Name = "MarioInstanceVsA_BrickList";

            MarioInstanceAxisAlignedRectangleInstanceVsGumbaListLeftMarioDead = FlatRedBall.Math.Collision.CollisionManager.Self.CreateRelationship(MarioInstance, GumbaList);
            MarioInstanceAxisAlignedRectangleInstanceVsGumbaListLeftMarioDead.SetFirstSubCollision(item => item.AxisAlignedRectangleInstance);
            MarioInstanceAxisAlignedRectangleInstanceVsGumbaListLeftMarioDead.SetSecondSubCollision(item => item.LeftMarioDead);
            MarioInstanceAxisAlignedRectangleInstanceVsGumbaListLeftMarioDead.Name = "MarioInstanceAxisAlignedRectangleInstanceVsGumbaListLeftMarioDead";

            MarioInstanceAxisAlignedRectangleInstanceVsGumbaListRightMarioDead = FlatRedBall.Math.Collision.CollisionManager.Self.CreateRelationship(MarioInstance, GumbaList);
            MarioInstanceAxisAlignedRectangleInstanceVsGumbaListRightMarioDead.SetFirstSubCollision(item => item.AxisAlignedRectangleInstance);
            MarioInstanceAxisAlignedRectangleInstanceVsGumbaListRightMarioDead.SetSecondSubCollision(item => item.RightMarioDead);
            MarioInstanceAxisAlignedRectangleInstanceVsGumbaListRightMarioDead.Name = "MarioInstanceAxisAlignedRectangleInstanceVsGumbaListRightMarioDead";

            MarioInstanceAxisAlignedRectangleInstanceVsMushroomListAxisAlignedRectangleInstance = FlatRedBall.Math.Collision.CollisionManager.Self.CreateRelationship(MarioInstance, MushroomList);
            MarioInstanceAxisAlignedRectangleInstanceVsMushroomListAxisAlignedRectangleInstance.SetFirstSubCollision(item => item.AxisAlignedRectangleInstance);
            MarioInstanceAxisAlignedRectangleInstanceVsMushroomListAxisAlignedRectangleInstance.SetSecondSubCollision(item => item.AxisAlignedRectangleInstance);
            MarioInstanceAxisAlignedRectangleInstanceVsMushroomListAxisAlignedRectangleInstance.Name = "MarioInstanceAxisAlignedRectangleInstanceVsMushroomListAxisAlignedRectangleInstance";
            MarioInstanceAxisAlignedRectangleInstanceVsMushroomListAxisAlignedRectangleInstance.SetMoveCollision(1f, 1f);

            {
                var temp    = new FlatRedBall.Math.Collision.DelegateListVsSingleRelationship <Entities.Mushroom, FlatRedBall.TileCollisions.TileShapeCollection>(MushroomList, SolidCollision);
                var isCloud = false;
                temp.CollisionFunction = (first, second) =>
                {
                    return(first.CollideAgainst(second, isCloud));
                }
                ;
                FlatRedBall.Math.Collision.CollisionManager.Self.Relationships.Add(temp);
                MushroomListVsSolidCollision = temp;
            }
            MushroomListVsSolidCollision.Name = "MushroomListVsSolidCollision";

            {
                var temp    = new FlatRedBall.Math.Collision.DelegateListVsListRelationship <Entities.Mushroom, Entities.A_Brick>(MushroomList, A_BrickList);
                var isCloud = false;
                temp.CollisionFunction = (first, second) =>
                {
                    return(first.CollideAgainst(second, isCloud));
                }
                ;
                FlatRedBall.Math.Collision.CollisionManager.Self.Relationships.Add(temp);
                MushroomListVsA_BrickList = temp;
            }
            MushroomListVsA_BrickList.CollisionLimit = FlatRedBall.Math.Collision.CollisionLimit.All;
            MushroomListVsA_BrickList.Name           = "MushroomListVsA_BrickList";

            {
                var temp    = new FlatRedBall.Math.Collision.DelegateListVsListRelationship <Entities.Mushroom, Entities.Lucky_block>(MushroomList, Lucky_blockList);
                var isCloud = false;
                temp.CollisionFunction = (first, second) =>
                {
                    return(first.CollideAgainst(second, isCloud));
                }
                ;
                FlatRedBall.Math.Collision.CollisionManager.Self.Relationships.Add(temp);
                MushroomListVsLucky_blockList = temp;
            }
            MushroomListVsLucky_blockList.CollisionLimit = FlatRedBall.Math.Collision.CollisionLimit.All;
            MushroomListVsLucky_blockList.Name           = "MushroomListVsLucky_blockList";

            {
                var temp    = new FlatRedBall.Math.Collision.DelegateListVsSingleRelationship <Entities.Turtle, FlatRedBall.TileCollisions.TileShapeCollection>(TurtleList, SolidCollision);
                var isCloud = false;
                temp.CollisionFunction = (first, second) =>
                {
                    return(first.CollideAgainst(second, first.AxisAlignedRectangleInstance, isCloud));
                }
                ;
                FlatRedBall.Math.Collision.CollisionManager.Self.Relationships.Add(temp);
                TurtleListAxisAlignedRectangleInstanceVsSolidCollision = temp;
            }
            TurtleListAxisAlignedRectangleInstanceVsSolidCollision.Name = "TurtleListAxisAlignedRectangleInstanceVsSolidCollision";

            {
                var temp    = new FlatRedBall.Math.Collision.DelegateListVsListRelationship <Entities.Gumba, Entities.Turtle>(GumbaList, TurtleList);
                var isCloud = false;
                temp.CollisionFunction = (first, second) =>
                {
                    return(first.CollideAgainst(second, isCloud));
                }
                ;
                FlatRedBall.Math.Collision.CollisionManager.Self.Relationships.Add(temp);
                GumbaListVsTurtleList = temp;
            }
            GumbaListVsTurtleList.CollisionLimit = FlatRedBall.Math.Collision.CollisionLimit.All;
            GumbaListVsTurtleList.Name           = "GumbaListVsTurtleList";

            MarioInstanceAxisAlignedRectangleInstanceVsTurtleListAxisAlignedRectangleInstance = FlatRedBall.Math.Collision.CollisionManager.Self.CreateRelationship(MarioInstance, TurtleList);
            MarioInstanceAxisAlignedRectangleInstanceVsTurtleListAxisAlignedRectangleInstance.SetFirstSubCollision(item => item.AxisAlignedRectangleInstance);
            MarioInstanceAxisAlignedRectangleInstanceVsTurtleListAxisAlignedRectangleInstance.SetSecondSubCollision(item => item.AxisAlignedRectangleInstance);
            MarioInstanceAxisAlignedRectangleInstanceVsTurtleListAxisAlignedRectangleInstance.Name = "MarioInstanceAxisAlignedRectangleInstanceVsTurtleListAxisAlignedRectangleInstance";
            MarioInstanceAxisAlignedRectangleInstanceVsTurtleListAxisAlignedRectangleInstance.SetMoveCollision(0f, 1f);

            {
                var temp    = new FlatRedBall.Math.Collision.DelegateListVsSingleRelationship <Entities.Turtle, FlatRedBall.TileCollisions.TileShapeCollection>(TurtleList, CombinedShapeCollection);
                var isCloud = false;
                temp.CollisionFunction = (first, second) =>
                {
                    return(first.CollideAgainst(second, first.AxisAlignedRectangleInstance, isCloud));
                }
                ;
                FlatRedBall.Math.Collision.CollisionManager.Self.Relationships.Add(temp);
                TurtleListAxisAlignedRectangleInstanceVsCombinedShapeCollection = temp;
            }
            TurtleListAxisAlignedRectangleInstanceVsCombinedShapeCollection.Name = "TurtleListAxisAlignedRectangleInstanceVsCombinedShapeCollection";

            MarioInstanceVsCoinList      = FlatRedBall.Math.Collision.CollisionManager.Self.CreateRelationship(MarioInstance, CoinList);
            MarioInstanceVsCoinList.Name = "MarioInstanceVsCoinList";

            Forms = new Super_Marios_Bros.FormsControls.Screens.Mario_Main_GUIForms(Mario_Main_GUI);
            // normally we wait to set variables until after the object is created, but in this case if the
            // TileShapeCollection doesn't have its Visible set before creating the tiles, it can result in
            // really bad performance issues, as shapes will be made visible, then invisible. Really bad perf!
            if (SolidCollision != null)
            {
                SolidCollision.Visible = false;
            }
            FlatRedBall.TileCollisions.TileShapeCollectionLayeredTileMapExtensions.AddCollisionFromTilesWithType(SolidCollision, Map, "SolidCollision", false);
            // normally we wait to set variables until after the object is created, but in this case if the
            // TileShapeCollection doesn't have its Visible set before creating the tiles, it can result in
            // really bad performance issues, as shapes will be made visible, then invisible. Really bad perf!
            if (CloudCollision != null)
            {
                CloudCollision.Visible = false;
            }
            FlatRedBall.TileCollisions.TileShapeCollectionLayeredTileMapExtensions.AddCollisionFromTilesWithType(CloudCollision, Map, "CloudCollision", false);
            // normally we wait to set variables until after the object is created, but in this case if the
            // TileShapeCollection doesn't have its Visible set before creating the tiles, it can result in
            // really bad performance issues, as shapes will be made visible, then invisible. Really bad perf!
            if (CombinedShapeCollection != null)
            {
                CombinedShapeCollection.Visible = false;
            }


            PostInitialize();
            base.Initialize(addToManagers);
            if (addToManagers)
            {
                AddToManagers();
            }
        }
 void OnMarioInstanceVsCoinListCollisionOccurred(Super_Marios_Bros.Entities.Mario first, Entities.Coin second)
 {
     second.Destroy();
     PassonClass.Coins += 1;
 }
        void OnMarioInstanceAxisAlignedRectangleInstanceVsTurtleListAxisAlignedRectangleInstanceCollisionOccurred(Super_Marios_Bros.Entities.Mario first, Entities.Turtle second)
        {
            Console.WriteLine("Collsion occured");
            bool wasPushedDown = first.AxisAlignedRectangleInstance.LastMoveCollisionReposition.Y > 0;

            if (wasPushedDown)
            {
                Console.WriteLine("was pushed down true");
                bool hasDestroyedBlock = false;
                for (int i = 0; i < TurtleList.Count; i++)
                {
                    if (TurtleList[i].AxisAlignedRectangleInstance.CollideAgainst(first.CollisionThing))
                    {
                        Console.WriteLine("Collided");
                        MarioInstance.Velocity.Y = 160;
                        TurtleList[i].GotHit     = true;
                        hasDestroyedBlock        = true;
                        break;
                    }
                }
                if (!hasDestroyedBlock)
                {
                    MarioInstance.Velocity.Y = 160;
                    second.GotHit            = true;
                }
            }
            else if (MarioInstance.AxisAlignedRectangleInstance.CollideAgainst(second.RightMarioDead) || MarioInstance.AxisAlignedRectangleInstance.CollideAgainst(second.LeftMarioDead))
            {
                second.Destroy();
                if (PassonClass.mariobig == true)
                {
                    PassonClass.mariobig = false;
                }
                else if (PassonClass.mariobig == false)
                {
                    HandleMarioDead();
                }
            }
        }
 void OnMarioInstanceAxisAlignedRectangleInstanceVsMushroomListAxisAlignedRectangleInstanceCollisionOccurred(Super_Marios_Bros.Entities.Mario first, Entities.Mushroom second)
 {
     second.Destroy();
     PassonClass.Score   += 100;
     PassonClass.mariobig = true;
 }