void move_towards_target(Enemy monster)
        {
            if (monster.getTarget() == null)
            {
                return;
            }
            int dist_x = monster.getTarget().loc_x - (monster.getX() + (monster.getWidth() / 2)) / game_state.tile_engine.getTileSize();
            int dist_y = monster.getTarget().loc_y - (monster.getY() + (monster.getHeight())) / game_state.tile_engine.getTileSize();

            if (dist_x == 0 && dist_y == 0)
            {
                monster.nextTarget();
                return;
            }

            if (Math.Abs(dist_x) > Math.Abs(dist_y))
            {
                //Advance in the X direction
                if (dist_x > 0)
                {
                    monster.setX(monster.getX() + monster.getSpeed());
                    monster.setDirection(PlayerDir.RIGHT);
                }
                else
                {
                    monster.setX(monster.getX() - monster.getSpeed());
                    monster.setDirection(PlayerDir.LEFT);
                }
            }
            else
            {
                //Advance in the Y direction
                if (dist_y > 0)
                {
                    monster.setY(monster.getY() + monster.getSpeed());
                    monster.setDirection(PlayerDir.DOWN);
                }
                else
                {
                    monster.setY(monster.getY() - monster.getSpeed());
                    monster.setDirection(PlayerDir.UP);
                }
            }
            if (monster.getLastDirection() != monster.getDirection())
            {
                monster.getSprite().StartAnimating((int)monster.getDirection() * 3, ((int)monster.getDirection() * 3) + 2);
            }
        }
        /// <summary>
        /// This is called when the game should draw itself.
        /// </summary>
        /// <param name="gameTime">Provides a snapshot of timing values.</param>
        public void Draw(GameTime gameTime, SpriteBatch spriteBatch) // draw everything on the screen
        {
            game_state.tile_engine.getCurrentMap().drawBackground(spriteBatch, game_state.local_player.getX(), game_state.local_player.getY());
            game_state.tile_engine.getCurrentMap().drawObjects(spriteBatch, game_state.local_player.getX(), game_state.local_player.getY());

            if (game_state.local_player.getX() <= 400 - 16)
            {
                character_sprite[(int)game_state.local_player.getWeapon()].loc.X = game_state.local_player.getX();
            }
            else
            {
                if (game_state.local_player.getX() >= game_state.tile_engine.getCurrentMap().getWidth() * game_state.tile_engine.getTileSize() - 400 - 16)
                {
                    character_sprite[(int)game_state.local_player.getWeapon()].loc.X = game_state.local_player.getX() - (game_state.tile_engine.getCurrentMap().getWidth() * game_state.tile_engine.getTileSize() - 800);
                }
                else
                {
                    character_sprite[(int)game_state.local_player.getWeapon()].loc.X = (800 / 2) - 16;// -(32 / 2);
                }
            }

            if (game_state.local_player.getY() <= 240 - 16)
            {
                character_sprite[(int)game_state.local_player.getWeapon()].loc.Y = game_state.local_player.getY();
            }
            else
            {
                if (game_state.local_player.getY() >= game_state.tile_engine.getCurrentMap().getHeight() * game_state.tile_engine.getTileSize() - 240 - 16)
                {
                    character_sprite[(int)game_state.local_player.getWeapon()].loc.Y = game_state.local_player.getY() - (game_state.tile_engine.getCurrentMap().getHeight() * game_state.tile_engine.getTileSize() - 480);
                }
                else
                {
                    character_sprite[(int)game_state.local_player.getWeapon()].loc.Y = (480 / 2) - 16;// - (32 / 2);
                }
            }

            // Fade a color over the player if they are hurt or have a boost active
            bool  shouldFadeHurt    = game_state.local_player.hurt;
            bool  shouldFadeAttack  = game_state.local_player.getAttackBonus() > 0;
            bool  shouldFadeDefense = game_state.local_player.getDefenseBonus() > 0;
            Color toFade;

            //choose arbitrary colors for boosts
            if (shouldFadeHurt)
            {
                toFade = Color.Red;
            }
            else if (shouldFadeAttack && shouldFadeDefense)
            {
                toFade = Color.LightGreen;
            }
            else if (shouldFadeAttack)
            {
                toFade = Color.LightYellow;
            }
            else if (shouldFadeDefense)
            {
                toFade = Color.LightBlue;
            }
            else
            {
                toFade = Color.White;
            }

            if (sword_swing) // if the sword has been swung
            {
                sword_sprite.loc = character_sprite[(int)game_state.local_player.getWeapon()].loc;
                sword_sprite.Draw(spriteBatch, (int)game_state.local_player.getDirection(), (shouldFadeHurt || shouldFadeAttack || shouldFadeDefense), toFade);
            }
            else
            {
                character_sprite[(int)game_state.local_player.getWeapon()].Draw(spriteBatch, (shouldFadeHurt || shouldFadeAttack || shouldFadeDefense), toFade);
            }

            //Draw monsters
            List <Enemy> monsters = game_state.monster_engine.GetMonsters();
            int          offset_x = game_state.local_player.getX() - (int)character_sprite[(int)game_state.local_player.getWeapon()].loc.X;
            int          offset_y = game_state.local_player.getY() - (int)character_sprite[(int)game_state.local_player.getWeapon()].loc.Y;

            for (int i = 0; i < monsters.Count(); ++i)
            {
                Enemy monster = monsters.ElementAt(i);
                if (game_state.monster_engine.IsVisible(monster))
                {
                    Sprite mons_sprite = monster.getSprite();
                    mons_sprite.loc.X = monster.getX() - offset_x;
                    mons_sprite.loc.Y = monster.getY() - offset_y;
                    if (mons_sprite.loc.X > 0 && mons_sprite.loc.X < 800)
                    {
                        if (mons_sprite.loc.Y > 0 && mons_sprite.loc.Y < 400)
                        {
                            mons_sprite.Draw(spriteBatch); //Draw if the location is not negative
                        }
                    }
                }
            }

            List <Bullet> bullets = game_state.bullet_engine.GetBullets();

            //draw the bullets appropriately
            for (int i = 0; i < bullets.Count(); ++i)
            {
                Bullet bullet = bullets.ElementAt(i);
                if (bullet.type != bulletType.SWORD)
                {
                    bullet_sprite.loc.X = bullet.x - offset_x;
                    bullet_sprite.loc.Y = bullet.y - offset_y;
                    bullet_sprite.Draw(spriteBatch);
                }
            }

            game_state.tile_engine.getCurrentMap().drawForeground(spriteBatch, game_state.local_player.getX(), game_state.local_player.getY());
            game_state.fx_engine.Draw(spriteBatch, offset_x, offset_y);

            //Draw HUD

            //begin operations on display textures
            //gets spritebatch in a state to be 'ready' to draw

            //******************DRAWING ARROWS**************************//
            spriteBatch.Draw(uparrow, uparrowpos, null, trans, 0, imageOffset, 4.0f, SpriteEffects.None, 0);
            spriteBatch.Draw(downarrow, downarrowpos, null, trans, 0, imageOffset, 4.0f, SpriteEffects.None, 0);
            spriteBatch.Draw(leftarrow, leftarrowpos, null, trans, 0, imageOffset, 4.0f, SpriteEffects.None, 0);
            spriteBatch.Draw(rightarrow, rightarrowpos, null, trans, 0, imageOffset, 4.0f, SpriteEffects.None, 0);
            spriteBatch.Draw(fire_button, fire_button_pos, null, trans, 0, imageOffset, 3.0f, SpriteEffects.None, 0);
            spriteBatch.DrawString(displayFont, "FIRE!", new Vector2(fire_button_pos.X + 38, fire_button_pos.Y + 45), Color.Black);
            //draw the arrow graphics to the screen with given position, 3x as big as original size, no effects
            //************************************************************//


            //***********************DRAWING GRAPHIC SPRITES***********************//
            spriteBatch.Draw(backpack, backpackpos, null, trans, 0, imageOffset, new Vector2(0.4f, 1.0f), SpriteEffects.None, 0); //draw the backpack "button"
            spriteBatch.DrawString(displayFont, "Inventory", new Vector2(backpackpos.X + 20, backpackpos.Y + 12), Color.Black);
            spriteBatch.Draw(healthbar_empty, health_bar_empty_rec, null, trans);                                                 //draw health bar
            spriteBatch.Draw(healthbar_full, health_bar_rec, null, trans);                                                        //draw health bar
            string curHealth = "" + game_state.local_player.getHealth();
            string maxHealth = "" + game_state.local_player.getMaxHealth();

            spriteBatch.DrawString(displayFont, "Health: " + curHealth + "/" + maxHealth, new Vector2(health_bar_rec.X + 42, health_bar_rec.Y + 5), Color.Black);
            //********************************************************************//


            //***************************DRAWING STRINGS***********************************//
            spriteBatch.DrawString(displayFont, levelstring, scoreStringPos, Color.Cyan);                                // draw "level: "
            spriteBatch.DrawString(displayFont, game_state.tile_engine.getCurrentLevelName(), currScorePos, Color.Cyan); // draw level number
            spriteBatch.DrawString(displayFont, livesString + livesRemaining.ToString(), livesStringPos, Color.Cyan);    // draw lives remaining
            //****************************************************************************//


            //check to see if the score needs to continue to be drawn (if time hasn't run out)
            //if it has, undraw it and display time expired string and menu
            if (!hasTimeLeft())
            {
                die();
                if (hasMoreLives())
                {
                    timex.Show(spriteBatch); // brings up time expired screen
                }
            }
            else
            {
                spriteBatch.DrawString(displayFont, timeLeft, timeLeftPos, Color.Cyan);
                spriteBatch.DrawString(displayFont, ((int)(currTime.TotalSeconds)).ToString(), timePos, Color.Cyan);
            }
            if (backpackmenu.backpack_touched)        // backpack button has been pressed
            {
                if (hasTimeLeft())                    // if time hasnt run out during the period where the inventory is brought up by the user, show the inventory
                {
                    backpackmenu.Show(spriteBatch);   // draw backpack menu
                    drawItems(spriteBatch, itemfont); // draw items according to layout in itemfont
                }
                else // time has run out while the inventory is up, hide inventory and bring up time expired menu
                {
                    backpackmenu.Hide();
                    timex.Show(spriteBatch);
                }
            }
        } // end draw function
        void move_towards_target(Enemy monster)
        {
            if (monster.getTarget() == null)
            {
                return;
            }
            int dist_x = monster.getTarget().loc_x - (monster.getX()+(monster.getWidth()/2))/game_state.tile_engine.getTileSize();
            int dist_y = monster.getTarget().loc_y - (monster.getY()+(monster.getHeight())) / game_state.tile_engine.getTileSize();
            if (dist_x == 0 && dist_y == 0)
            {
                monster.nextTarget();
                return;
            }

            if (Math.Abs(dist_x) > Math.Abs(dist_y))
            {
                //Advance in the X direction
                if (dist_x > 0)
                {
                    monster.setX(monster.getX() + monster.getSpeed());
                    monster.setDirection(PlayerDir.RIGHT);
                }
                else
                {
                    monster.setX(monster.getX() - monster.getSpeed());
                    monster.setDirection(PlayerDir.LEFT);
                }
            }
            else
            {
                //Advance in the Y direction
                if (dist_y > 0)
                {
                    monster.setY(monster.getY() + monster.getSpeed());
                    monster.setDirection(PlayerDir.DOWN);

                }
                else
                {
                    monster.setY(monster.getY() - monster.getSpeed());
                    monster.setDirection(PlayerDir.UP);

                }
            }
            if (monster.getLastDirection() != monster.getDirection())
            {
                monster.getSprite().StartAnimating((int)monster.getDirection() * 3, ((int)monster.getDirection() * 3) + 2);
            }
        }