Example #1
0
        /// <summary>
        /// updates the game logic, so will change playerState, frame count and gametime, etc.
        /// </summary>
        /// <param name="gameTime"></param>
        public void Update(GameTime gameTime)
        {
            KeyboardState kbState = Keyboard.GetState();//initializes the keyboard state for getting movement input and other commands/actions

            if (!Game1.developerMode)
            {
                if (health <= 0)//resets health back to 0 if it goes below and kills the player
                {
                    health = 0;
                    pState = PlayerState.Dead;
                }
                if (health > maxHealth)//resets the health to maxhealth if it goes past
                {
                    health = maxHealth;
                }
                if (intox > maxIntox)//if the intox goes past the max value, then resets it to it
                {
                    intox = 150;
                }
                if (intox < 0)//keeps the intox from going below 0
                {
                    intox = 0;
                }

                // Handle animation timing
                // - Add to the time counter
                // - Check if we have enough "time" to advance the frame
                timeCounter += gameTime.ElapsedGameTime.TotalSeconds;
                if (timeCounter >= timePerFrame)
                {
                    frame += 1;                   // Adjust the frame

                    if (frame > WALK_FRAME_COUNT) // Check the bounds
                    {
                        frame = 0;
                    }

                    timeCounter -= timePerFrame;                                                                                       // Remove the time we "used"
                }
                if (!colliderArray[0] && !colliderArray[1] && !colliderArray[2] && !colliderArray[3] && pState != PlayerState.Jumping) //if the player is not colliding with anything nor jumping then it is falling
                {
                    pState = PlayerState.Falling;
                }
                if (kbState.IsKeyDown(Keys.E) && buttonInRange != null && !prevKeyboardState.IsKeyDown(Keys.E))//if you press e while in range of a button it presses the button
                {
                    buttonInRange.PressButton();
                }
                if (kbState.IsKeyDown(Keys.W) && doorInRange != null && !prevKeyboardState.IsKeyDown(Keys.W))//if you press w while in range of a door it opens the door and progresses to the next room
                {
                    doorInRange.UseDoor();
                }

                MouseState mState = Mouse.GetState();                                  //initializes the mousestate for input
                if (kbState.IsKeyDown(Keys.F) && !prevKeyboardState.IsKeyDown(Keys.F)) //if you press f, and you have bottles, and you arent in the air, it makes it so you are now holding a bottle
                {
                    if (bottlesOnHand > 0)
                    {
                        if (pState != PlayerState.Falling)
                        {
                            if (holding == false)
                            {
                                holding = true;
                            }
                        }
                    }
                }

                if (wallClimb)//if you can wall climb(intox >=40) then if you collide with something on the left or right, you no longer fall and can move up and down manually
                {
                    if (colliderArray[3] || colliderArray[1])
                    {
                        activateGravity = false;
                        if (kbState.IsKeyDown(Keys.S))
                        {
                            activateGravity = true;
                        }
                        if (kbState.IsKeyDown(Keys.A) && !prevKeyboardState.IsKeyDown(Keys.A))
                        {
                            pState = PlayerState.FaceLeft;
                        }
                        if (kbState.IsKeyDown(Keys.D) && !prevKeyboardState.IsKeyDown(Keys.D))
                        {
                            pState = PlayerState.FaceRight;
                        }
                        if (kbState.IsKeyDown(Keys.W) || kbState.IsKeyDown(Keys.Space))
                        {
                            AddForce(new Vector2(0, -20));
                        }
                    }
                    else
                    if (colliderArray[2] == false)
                    {
                        activateGravity = true;
                    }
                }

                if (holding)//if you are holding a bottle, if you dont interact with it within 2 seconds it goes back into your "inventory". otherwise(you do interact with it) if you left click you throw it, if you right click you drink it
                {
                    if (holdingCounter >= 120)
                    {
                        holdingCounter = 0;
                        holding        = false;
                    }
                    else
                    if (mState.RightButton == ButtonState.Pressed)
                    {
                        holding = false;
                        health++;
                        intoxDecreaseCounter = 0;
                        intox += 5;
                        bottlesOnHand--;
                    }
                    else if (mState.LeftButton == ButtonState.Pressed)
                    {
                        holding = false;
                        if (pState == PlayerState.FaceLeft || pState == PlayerState.WalkLeft)
                        {
                            b          = new Bottle((X - 60), Y - 10, Room.TILE_WIDTH, Room.TILE_HEIGHT, rm.bottleTexture, this, rm);
                            b.velocity = new Vector2(-20 + velocity.X, velocity.Y);
                            b.AddForce(new Vector2(-2000, -350));
                        }
                        else if (pState == PlayerState.FaceRight || pState == PlayerState.WalkRight)
                        {
                            b          = new Bottle((X + Rect.Width + 3), Y - 10, Room.TILE_WIDTH, Room.TILE_HEIGHT, rm.bottleTexture, this, rm);
                            b.velocity = new Vector2(20 + velocity.X, velocity.Y);
                            b.AddForce(new Vector2(2000, -350));
                        }
                        b.Drawing = true;
                        b.Thrown  = true;
                        b.drag    = false;
                        rm.Current.Colliders.Add(b);
                        rm.Current.Enemies.Add(b);
                        rm.Current.Drawable.Add(b);
                        b.activateGravity = true;
                        bottlesOnHand--;
                    }
                }

                if (intoxDecreaseCounter >= 1200)//after 20 seconds your intoxication level decreases by 5
                {
                    intox -= 5;
                    intoxDecreaseCounter = 0;
                }
                if (intox >= 25)//if intox is >= 25 you have greater max health and you heal by drinking bottles
                {
                    maxHealth = 150;
                }
                else
                {
                    maxHealth = 100;
                }
                if (intox >= 50)//if intox is >= 50 you can wallclimb otherwise you cant
                {
                    wallClimb = true;
                }
                else
                {
                    wallClimb = false;
                }
                if (intox >= 100)//if intox >=100 you jump higher otherwise you jump at a normal height
                {
                    jumpHeight = 700;
                }
                else
                {
                    jumpHeight = 500;
                }
                if (intox >= 150)
                {
                    Game1.DiscoMode = true;
                }
                else
                {
                    Game1.DiscoMode = false;
                }

                //switch case for the player state to determine if the player is facing/walking a certain way and then changing to the next state when a key is pressed, or lifted up.
                switch (pState)
                {
                case PlayerState.FaceLeft:
                {
                    if ((kbState.IsKeyDown(Keys.D) || kbState.IsKeyDown(Keys.Right)) && (kbState.IsKeyDown(Keys.A) || kbState.IsKeyDown(Keys.Left)))
                    {
                    }
                    else
                    {
                        if (kbState.IsKeyDown(Keys.A) || kbState.IsKeyDown(Keys.Left) && !colliderArray[1])
                        {
                            prevState = pState;
                            pState    = PlayerState.WalkLeft;
                        }
                        if (kbState.IsKeyDown(Keys.D) || kbState.IsKeyDown(Keys.Right) && !colliderArray[3])
                        {
                            prevState = pState;
                            pState    = PlayerState.WalkRight;
                        }
                    }
                    if (kbState.IsKeyDown(Keys.Space))
                    {
                        prevState = pState;
                        pState    = PlayerState.Jumping;
                    }
                    break;
                }

                case PlayerState.FaceRight:
                {
                    if ((kbState.IsKeyDown(Keys.D) || kbState.IsKeyDown(Keys.Right)) && (kbState.IsKeyDown(Keys.A) || kbState.IsKeyDown(Keys.Left)))
                    {
                    }
                    else
                    {
                        if (kbState.IsKeyDown(Keys.A) || kbState.IsKeyDown(Keys.Left) && !colliderArray[1])
                        {
                            prevState = pState;
                            pState    = PlayerState.WalkLeft;
                        }
                        if (kbState.IsKeyDown(Keys.D) || kbState.IsKeyDown(Keys.Right) && !colliderArray[3])
                        {
                            prevState = pState;
                            pState    = PlayerState.WalkRight;
                        }
                    }
                    if (kbState.IsKeyDown(Keys.Space))
                    {
                        prevState = pState;
                        pState    = PlayerState.Jumping;
                    }
                    break;
                }

                case PlayerState.WalkRight:
                {
                    if (!colliderArray[1])
                    {
                        AddForce(new Vector2(10, 0));
                    }
                    if ((kbState.IsKeyDown(Keys.D) || kbState.IsKeyDown(Keys.Right)) && (kbState.IsKeyDown(Keys.A) || kbState.IsKeyDown(Keys.Left)))
                    {
                        prevState = pState;
                        pState    = PlayerState.FaceRight;
                    }
                    else
                    {
                        if (kbState.IsKeyDown(Keys.A) || kbState.IsKeyDown(Keys.Left))
                        {
                            prevState = pState;
                            pState    = PlayerState.WalkLeft;
                        }
                        if (kbState.IsKeyUp(Keys.D) && kbState.IsKeyUp(Keys.Right))
                        {
                            prevState = pState;
                            pState    = PlayerState.FaceRight;
                        }
                    }
                    if (!colliderArray[2])
                    {
                        prevState = pState;
                        pState    = PlayerState.Falling;
                    }
                    else if (kbState.IsKeyDown(Keys.Space))
                    {
                        prevState = pState;
                        pState    = PlayerState.Jumping;
                    }
                    break;
                }

                case PlayerState.WalkLeft:
                {
                    if (!colliderArray[3])
                    {
                        AddForce(new Vector2(-10, 0));
                    }
                    if ((kbState.IsKeyDown(Keys.D) || kbState.IsKeyDown(Keys.Right)) && (kbState.IsKeyDown(Keys.A) || kbState.IsKeyDown(Keys.Left)))
                    {
                        prevState = pState;
                        pState    = PlayerState.FaceLeft;
                    }
                    else
                    {
                        if (kbState.IsKeyDown(Keys.D) || kbState.IsKeyDown(Keys.Right))
                        {
                            prevState = pState;
                            pState    = PlayerState.WalkRight;
                        }
                        if (kbState.IsKeyUp(Keys.A) && kbState.IsKeyUp(Keys.Left))
                        {
                            prevState = pState;
                            pState    = PlayerState.FaceLeft;
                        }
                    }
                    if (!colliderArray[2])
                    {
                        prevState = pState;
                        pState    = PlayerState.Falling;
                    }
                    else if (kbState.IsKeyDown(Keys.Space))
                    {
                        prevState = pState;
                        pState    = PlayerState.Jumping;
                    }
                    break;
                }

                case PlayerState.Jumping:
                {
                    if (!activateGravity && !wallClimb)
                    {
                        activateGravity = true;
                    }
                    if (colliderArray[2] == true)
                    {
                        pState          = prevState;
                        jumped          = false;
                        activateGravity = false;
                    }
                    if (!jumped)
                    {
                        AddForce(new Vector2(0, -jumpHeight));

                        activateGravity = true;
                        jumped          = true;
                        pState          = PlayerState.Falling;
                    }
                    if (colliderArray[0] || Y <= finalHeight)
                    {
                        pState = PlayerState.Falling;
                    }
                    if (kbState.IsKeyDown(Keys.A) || kbState.IsKeyDown(Keys.Left))
                    {
                        if (!colliderArray[3])
                        {
                            AddForce(new Vector2(-6, 0));
                        }
                    }
                    if (kbState.IsKeyDown(Keys.D) || kbState.IsKeyDown(Keys.Right))
                    {
                        if (!colliderArray[1])
                        {
                            AddForce(new Vector2(6, 0));
                        }
                    }
                    break;
                }

                case PlayerState.Falling:
                {
                    if (!activateGravity && !wallClimb)
                    {
                        activateGravity = true;
                    }
                    if (colliderArray[2] == true)
                    {
                        pState          = prevState;
                        jumped          = false;
                        activateGravity = false;
                    }
                    if (kbState.IsKeyDown(Keys.A) || kbState.IsKeyDown(Keys.Left))
                    {
                        if (!colliderArray[3])
                        {
                            AddForce(new Vector2(-8, 0));
                        }
                    }
                    if (kbState.IsKeyDown(Keys.D) || kbState.IsKeyDown(Keys.Right))
                    {
                        if (!colliderArray[1])
                        {
                            AddForce(new Vector2(8, 0));
                        }
                    }
                    break;
                }
                }
            }
            else
            {
                if (health <= 0)//resets health back to 0 if it goes below and kills the player
                {
                    health = 0;
                    pState = PlayerState.Dead;
                }
                if (health > maxHealth)//resets the health to maxhealth if it goes past
                {
                    health = maxHealth;
                }
                if (intox > maxIntox)//if the intox goes past the max value, then resets it to it
                {
                    intox = 150;
                }
                if (intox < 0)//keeps the intox from going below 0
                {
                    intox = 0;
                }

                if (intox >= 25)//if intox is >= 25 you have greater max health and you heal by drinking bottles
                {
                    maxHealth = 150;
                }
                else
                {
                    maxHealth = 100;
                }
                if (intox >= 50)//if intox is >= 50 you can wallclimb otherwise you cant
                {
                    wallClimb = true;
                }
                else
                {
                    wallClimb = false;
                }
                if (intox >= 100)//if intox >=100 you jump higher otherwise you jump at a normal height
                {
                    jumpHeight = 700;
                }
                else
                {
                    jumpHeight = 500;
                }
                if (intox >= 150)
                {
                    Game1.DiscoMode = true;
                }
                else
                {
                    Game1.DiscoMode = false;
                }
                if (kbState.IsKeyDown(Keys.E) && buttonInRange != null && !prevKeyboardState.IsKeyDown(Keys.E))//if you press e while in range of a button it presses the button
                {
                    buttonInRange.PressButton();
                }
                if (kbState.IsKeyDown(Keys.W) && doorInRange != null && !prevKeyboardState.IsKeyDown(Keys.W))//if you press w while in range of a door it opens the door and progresses to the next room
                {
                    doorInRange.UseDoor();
                }

                MouseState mState = Mouse.GetState();                                  //initializes the mousestate for input
                if (kbState.IsKeyDown(Keys.F) && !prevKeyboardState.IsKeyDown(Keys.F)) //if you press f, and you have bottles, and you arent in the air, it makes it so you are now holding a bottle
                {
                    if (bottlesOnHand > 0)
                    {
                        if (pState != PlayerState.Falling)
                        {
                            if (holding == false)
                            {
                                holding = true;
                            }
                        }
                    }
                    else
                    {
                        bottlesOnHand = 1;
                    }
                }
                if (holding)//if you are holding a bottle, if you dont interact with it within 2 seconds it goes back into your "inventory". otherwise(you do interact with it) if you left click you throw it, if you right click you drink it
                {
                    if (holdingCounter >= 120)
                    {
                        holdingCounter = 0;
                        holding        = false;
                    }
                    else
                    if (mState.RightButton == ButtonState.Pressed)
                    {
                        holding = false;
                        intox  += 5;
                        bottlesOnHand--;
                        health++;
                    }
                    else if (mState.LeftButton == ButtonState.Pressed)
                    {
                        holding = false;
                        if (pState == PlayerState.FaceLeft || pState == PlayerState.WalkLeft)
                        {
                            b          = new Bottle((X - 60), Y - 10, Room.TILE_WIDTH, Room.TILE_HEIGHT, rm.bottleTexture, this, rm);
                            b.velocity = new Vector2(-20 + velocity.X, velocity.Y);
                            b.AddForce(new Vector2(-2000, -350));
                        }
                        else if (pState == PlayerState.FaceRight || pState == PlayerState.WalkRight)
                        {
                            b          = new Bottle((X + Rect.Width + 3), Y - 10, Room.TILE_WIDTH, Room.TILE_HEIGHT, rm.bottleTexture, this, rm);
                            b.velocity = new Vector2(20 + velocity.X, velocity.Y);
                            b.AddForce(new Vector2(2000, -350));
                        }
                        b.Drawing = true;
                        b.Thrown  = true;
                        b.drag    = false;
                        rm.Current.Colliders.Add(b);
                        rm.Current.Enemies.Add(b);
                        rm.Current.Drawable.Add(b);
                        b.activateGravity = true;
                    }
                }
            }
            buttonInRange     = null;
            doorInRange       = null;
            prevKeyboardState = kbState;
            if (holding)
            {
                holdingCounter++;
            }
            if (intox > 0)
            {
                intoxDecreaseCounter++;
            }
            Updates(gameTime);
        }
Example #2
0
        /// <summary>
        /// Creates the actual tile objects in the world.
        /// </summary>
        public void SpawnRoom(Player player, Room lastRoom)
        {
            if (colliders.Count > 0)
            {
                foreach (Door door in doors)
                {
                    if (door.destination == lastRoom && door.destination != previousRoom)
                    {
                        player.X = door.X - TILE_WIDTH;
                        player.Y = door.Y + TILE_HEIGHT - player.Rect.Height;//made this a little more generic
                        player.positionChangedManually();
                        player.velocity = Vector2.Zero;
                    }
                    else if (door.destination == lastRoom)
                    {
                        player.X = door.X + TILE_WIDTH + 4;
                        player.Y = door.Y + TILE_HEIGHT - player.Rect.Height;//made this a little more generic
                        player.positionChangedManually();
                        player.velocity = Vector2.Zero;
                    }
                }
                return;
            }
            foreground.Clear();
            int exitNum = 0;

            for (int y = level.GetLength(1) - 1; y >= 0; y--)
            {
                for (int x = 0; x < level.GetLength(0); x++)
                {
                    switch (level[x, y])
                    {
                    case ('*'):
                        int            tileNum = rand.Next(7);
                        Texture2D      normal  = manager.content.Load <Texture2D>("Normals/frontNormals/FrontNormalMap_0" + (tileNum + 1) + ".png");
                        ForegroundTile tile    = new ForegroundTile(x * TILE_WIDTH, y * TILE_HEIGHT, TILE_WIDTH, TILE_HEIGHT, (int)(TILE_WIDTH * ISO_SCALE), (int)(TILE_HEIGHT * ISO_SCALE), tileSet, boundsTexture, normal, tileNum);
                        tile.PositionLocked = true;
                        if (Game1.RumbleMode)
                        {
                            if (NoDoors(x, y))
                            {
                                tile.PositionLocked = false;
                                int percent = rand.Next(100);
                                if (percent > 100 - depth)
                                {
                                    tile.rumble = true;

                                    enemies.Add(tile);
                                    tile.color = Color.Gray;
                                    percent    = rand.Next(100);
                                    if (percent > 110 - depth)
                                    {
                                        tile.falling = true;
                                    }
                                }
                            }
                        }
                        foreground.Add(tile);
                        colliders.Add(tile);
                        levelObjects[x, y] = tile;
                        drawable.Add(tile);
                        break;

                    // Cases for entrances and exits.
                    case ('>'):
                        if (nextRooms.Contains(lastRoom))
                        {
                            if (nextRooms[exitNum] == lastRoom)
                            {
                                player.X = (x - 1) * TILE_WIDTH;
                                player.Y = ((y + 1) * TILE_HEIGHT) - player.Rect.Height;    //made this a little more generic
                                player.positionChangedManually();
                                player.velocity = Vector2.Zero;
                            }

                            exitNum++;
                        }
                        else
                        {
                            Room room     = manager.RandomRoom(this);
                            Door nextDoor = new Door(x * TILE_WIDTH + 5, y * TILE_HEIGHT - 6, TILE_WIDTH, TILE_HEIGHT, doorTexture, manager.content.Load <Texture2D>("Normals/BlankNormal.png"), room, manager);
                            nextRooms.Add(room);
                            colliders.Add(nextDoor);
                            levelObjects[x, y] = nextDoor;
                            doors.Add(nextDoor);
                        }
                        break;

                    case ('<'):
                        if (previousRoom != null)
                        {
                            if (previousRoom == lastRoom)
                            {
                                player.X = ((x + 1) * TILE_WIDTH) + 4;
                                player.Y = ((y + 1) * TILE_HEIGHT) - player.Rect.Height;    //made this a little more generic
                                player.positionChangedManually();
                                player.velocity = Vector2.Zero;
                            }
                            Door previousDoor = new Door(x * TILE_WIDTH + 3, y * TILE_HEIGHT - 6, TILE_WIDTH, TILE_HEIGHT, doorTexture, manager.content.Load <Texture2D>("Normals/BlankNormal.png"), previousRoom, manager);
                            colliders.Add(previousDoor);
                            doors.Add(previousDoor);

                            levelObjects[x, y] = previousDoor;
                        }
                        break;

                    case ('┴'):
                        Fan fan = new Fan((x * TILE_WIDTH) - ((int)((TILE_WIDTH * ISO_SCALE) - TILE_WIDTH) / 2), (y * TILE_HEIGHT) - ((int)((TILE_HEIGHT * ISO_SCALE) - TILE_HEIGHT) / 2), (int)(TILE_WIDTH * ISO_SCALE), (int)(TILE_HEIGHT * ISO_SCALE), level[x, y], manager.content.Load <Texture2D>("fan.png"));
                        colliders.Add(fan);
                        colliders.AddRange(fan.getEffects());
                        enemies.AddRange(fan.getEffects());
                        drawable.Add(fan);
                        levelObjects[x, y] = fan;
                        break;

                    case ('┤'):
                        Fan fan1 = new Fan((x * TILE_WIDTH) - ((int)((TILE_WIDTH * ISO_SCALE) - TILE_WIDTH) / 2), (y * TILE_HEIGHT) - ((int)((TILE_HEIGHT * ISO_SCALE) - TILE_HEIGHT) / 2), (int)(TILE_WIDTH * ISO_SCALE), (int)(TILE_HEIGHT * ISO_SCALE), level[x, y], manager.content.Load <Texture2D>("fan.png"));
                        colliders.Add(fan1);
                        colliders.AddRange(fan1.getEffects());
                        enemies.AddRange(fan1.getEffects());
                        drawable.Add(fan1);
                        levelObjects[x, y] = fan1;
                        break;

                    case ('┬'):
                        Fan fan2 = new Fan((x * TILE_WIDTH) - ((int)((TILE_WIDTH * ISO_SCALE) - TILE_WIDTH) / 2), (y * TILE_HEIGHT) - ((int)((TILE_HEIGHT * ISO_SCALE) - TILE_HEIGHT) / 2), (int)(TILE_WIDTH * ISO_SCALE), (int)(TILE_HEIGHT * ISO_SCALE), level[x, y], manager.content.Load <Texture2D>("fan.png"));
                        colliders.Add(fan2);
                        colliders.AddRange(fan2.getEffects());
                        enemies.AddRange(fan2.getEffects());
                        drawable.Add(fan2);
                        levelObjects[x, y] = fan2;
                        break;

                    case ('├'):
                        Fan fan3 = new Fan((x * TILE_WIDTH) - ((int)((TILE_WIDTH * ISO_SCALE) - TILE_WIDTH) / 2), (y * TILE_HEIGHT) - ((int)((TILE_HEIGHT * ISO_SCALE) - TILE_HEIGHT) / 2), (int)(TILE_WIDTH * ISO_SCALE), (int)(TILE_HEIGHT * ISO_SCALE), level[x, y], manager.content.Load <Texture2D>("fan.png"));
                        colliders.Add(fan3);
                        colliders.AddRange(fan3.getEffects());
                        enemies.AddRange(fan3.getEffects());
                        drawable.Add(fan3);
                        levelObjects[x, y] = fan3;
                        break;

                    case ('h'):
                        HoppingEnemy hopEnemy = new HoppingEnemy(x * TILE_WIDTH, y * TILE_HEIGHT, 0.6f, hopEnemyTexture, manager.content.Load <Texture2D>("Normals/BlankNormal.png"), player);
                        colliders.Add(hopEnemy);
                        enemies.Add(hopEnemy);
                        drawable.Add(hopEnemy);
                        levelObjects[x, y] = hopEnemy;
                        break;

                    case ('o'):
                        Ooze ooze = new Ooze(x * TILE_WIDTH, y * TILE_HEIGHT, .50f, oozeTexture, manager.content.Load <Texture2D>("Normals/BlankNormal.png"), player);
                        colliders.Add(ooze);
                        enemies.Add(ooze);
                        drawable.Add(ooze);
                        levelObjects[x, y] = ooze;
                        break;

                    case ('p'):
                        int        phaseTileNum = rand.Next(7);
                        Texture2D  phaseNormal  = manager.content.Load <Texture2D>("Normals/frontNormals/FrontNormalMap_0" + (phaseTileNum + 1) + ".png");
                        PhaseBlock block        = new PhaseBlock(x * TILE_WIDTH, y * TILE_HEIGHT, TILE_WIDTH, TILE_HEIGHT, (int)(TILE_WIDTH * ISO_SCALE), (int)(TILE_HEIGHT * ISO_SCALE), tileSet, boundsTexture, phaseNormal, phaseTileNum, true);
                        colliders.Add(block);
                        drawable.Add(block);
                        levelObjects[x, y] = block;
                        break;

                    case ('b'):

                        Button button = new Button(x * TILE_WIDTH + TILE_WIDTH / 3, y * TILE_HEIGHT + TILE_HEIGHT / 3, TILE_WIDTH / 3, TILE_HEIGHT / 3, boundsTexture, roomFont, null);
                        levelObjects[x, y] = button;
                        colliders.Add(button);
                        colliders.Add(button.Box);
                        enemies.Add(button.Box);
                        drawable.Add(button);
                        break;

                    case ('T'):
                        Button button1 = new Button(x * TILE_WIDTH + TILE_WIDTH / 3, y * TILE_HEIGHT + TILE_HEIGHT / 3, TILE_WIDTH / 3, TILE_HEIGHT / 3, boundsTexture, roomFont, null, true);
                        levelObjects[x, y] = button1;
                        colliders.Add(button1);
                        colliders.Add(button1.Box);
                        enemies.Add(button1.Box);
                        drawable.Add(button1);
                        break;

                    case ('B'):
                        Bottle bottle = new Bottle(x * TILE_WIDTH, y * TILE_HEIGHT, TILE_WIDTH, TILE_HEIGHT, bottleTexture, player, manager);
                        colliders.Add(bottle);
                        drawable.Add(bottle);
                        levelObjects[x, y] = bottle;
                        break;

                    case ('s'):
                        bool onGround = false;
                        try
                        {
                            if (levelObjects[x, y + 1] == null)
                            {
                                onGround = false;
                            }
                            else
                            {
                                onGround = true;
                            }
                        }
                        catch (Exception e)
                        { }
                        Spikes spikes = new Spikes(x * TILE_WIDTH, y * TILE_HEIGHT, spikeTexture, manager.content.Load <Texture2D>("Normals/BlankNormal.png"), player, onGround);
                        colliders.Add(spikes);
                        enemies.Add(spikes);
                        drawable.Add(spikes);
                        levelObjects[x, y] = spikes;
                        break;

                    case ('S'):
                        EntitySpawner spawner = new EntitySpawner(x * TILE_WIDTH, y * TILE_HEIGHT, TILE_WIDTH, TILE_HEIGHT, this);
                        colliders.Add(spawner);
                        enemies.Add(spawner);
                        drawable.Add(spawner);
                        levelObjects[x, y] = spawner;
                        break;
                    }
                    if (level[x, y] != ' ')
                    {
                        int            tileNum = rand.Next(7);
                        Texture2D      normal  = manager.content.Load <Texture2D>("Normals/backgroundNormals/BackNormalMap_0" + (tileNum + 1) + ".png");
                        BackgroundTile back    = new BackgroundTile((x * TILE_WIDTH) + 8, (y * TILE_HEIGHT) - 8, TILE_WIDTH, TILE_HEIGHT, backgroundSet, normal, tileNum);
                        background.Add(back);
                    }
                }
            }
            checkAdditionalInformation();
            prevSize  = colliders.Count;
            prevSize2 = enemies.Count;
            drawable.Add(player);
        }