//making a random path at the start of the game for creeps to run down
        public void drawRandomTiles(Game1 game)
        {
            int var = RandomNumber(0, backWidth);//same as backbufferedwidth
            //System.Diagnostics.Debug.WriteLine(Game1.SCALE);
            Vector2 tempPos;
            //Creep cr;
            for (int y = 0; y < backHeight; y++)
            {
                tempPos = new Vector2(var*Game1.SCALE ,y*Game1.SCALE);
                game.Path.Add(tempPos);
                this.tile = new Tile(tempPos, game.texTile, game);
                game.Tiles.Add(this.tile);

                //cr = new Creep(tempPos, game.texCreep, game);
                //game.Creeps.Add(cr);
                //System.Diagnostics.Debug.WriteLine("start");
                //System.Diagnostics.Debug.WriteLine(var);
                //System.Diagnostics.Debug.WriteLine(y);
            }
        }
        public void HandleInput(float dt, GameTime gameTime)
        {
            Game1 game = Game as Game1;
            if (game.Creeps.Count > 0)
            {
                moveCreep(gameTime, game);
                for (int x=0;x<game.Towers.Count;x++)
                {
                    findClosestCreep(gameTime,game.Towers.ElementAt(x), game);
                }
            }
            if (this.count < 1)
            {
                drawRandomTiles(game);
                this.count++;
                //create practuse creep at start of path

            }
            vec = new Vector2(game.Path.ElementAt(0).X, game.Path.ElementAt(0).Y);
            spawnCreep(gameTime, vec, game);

            KeyboardState keyboardState = game.keyboardState;
            MouseState mouseState = game.mouseState;

            float xDifference = mouseState.X - 200;
            float yDifference = mouseState.Y - 200;

            //Mouse.SetPosition(200, 200);

            #region 1-5 key binds

            //Ball Selected
            if (keyboardState.IsKeyDown(Keys.D1))
            {
                game.towerType = 1;
            }
            //Handgun Selected
            if (keyboardState.IsKeyDown(Keys.D2))
            {
                game.towerType = 2;
            }

            #endregion

            if (mouseState.LeftButton == ButtonState.Pressed)
            {
                if (allowedToClick)
                {
                    mPressed = true;
                }

            }

            newState = Keyboard.GetState();
            //pressed = KeypressTest(Keys.LeftAlt);
            //if left alt key pressed
             if (newState.IsKeyUp(Keys.LeftAlt) && oldState.IsKeyDown(Keys.LeftAlt))
             {
                 if (isTower)
                 {
                     isTower = false;
                     isTile = true;
                 }
                 else if (isTile)
                 {
                     isTile = false;
                     isTower = true;
                 }
             }
             oldState = newState;

            Vector2 tempMouse;
            Tower tower;
            //Tile tile ;
            bool valid = false;
            int count = 0;
            if (mouseState.LeftButton == ButtonState.Released)
            {
                if (mPressed == true)
                {
                    if (isTower || isTile)
                    {
                        //Box toAdd = new Box(camera.position, 1, 1, 1, 1);
                        mPressed = false;
                        tempMouse = new Vector2(mouseState.X - mouseState.X % Game1.SCALE, mouseState.Y - mouseState.Y % Game1.SCALE);

                        foreach (Tower t in game.Towers)
                        {
                            if (t.pos.Equals(tempMouse))
                                valid = true;
                            count++;

                        }
                        if (!valid)
                        {
                            foreach (Tile tt in game.Tiles)
                            {
                                if (tt.pos.Equals(tempMouse))
                                    valid = true;
                                count++;

                            }
                        }
                        //game.test = new Tower(new Vector2(mouseState.X, mouseState.Y), game.tex, game);

                        //TODO
                        //check if tower not already in same place / if NOT on path
                        if (!valid)
                        {
                            if (isTower)
                            {
                                tower = new Tower(tempMouse, game.texTower, game);
                                if (game.money >= 50)
                                {
                                    game.Towers.Add(tower);
                                    game.money -= 50;
                                }
                            }
                            if (isTile)
                            {
                                this.tile = new Tile(tempMouse, game.texTile, game);
                                if (game.money >= 50)
                                {
                                    game.Tiles.Add(this.tile);
                                    game.money -= 50;
                                }
                            }

                        }
                        allowedToClick = false;
                        timer = 0f;
                    }

                }
            }

                //Scoot the camera around depending on what keys are pressed.

                /*
                if (keyboardState.IsKeyDown(Keys.W))
                    camera.MoveForward(dt);
                if (keyboardState.IsKeyDown(Keys.S))
                    camera.MoveForward(-dt);
                if (keyboardState.IsKeyDown(Keys.D))
                    camera.MoveRight(dt);
                if (keyboardState.IsKeyDown(Keys.A))
                    camera.MoveRight(-dt);
                if (keyboardState.IsKeyDown(Keys.Space))
                    camera.MoveUp(dt);
                if (keyboardState.IsKeyDown(Keys.C))
                    camera.MoveUp(-dt);
                */
        }
 public bool CompareTo(Tile t)
 {
     if (this.pos.X > t.pos.X)
         return true;
     return false;
 }