///////////////////////////////////////////||\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ ///////////////////////////////////// CONSTRUCTOR \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ ///////////////////////////////////////////||\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ //Pre: The x and y position of the player, the width and height of the player, and the screen width and height //Post: The player is created //Desc: A constructor for the player public Player(int xPos, int yPos, int playerWidth, int playerHeight, int screenWidth, int screenHeight) { //Sets the current weapon of the player and its textures currentWeapon = handgun; frameAnimation = new FrameAnimation(currentWeapon.GetTextures(AnimationState.Idle), IDLE_FRAME_DELAY); //Sets the player to neither need to shoot or reload NeedShooting = false; NeedReload = false; //Sets the human to not moving HumanMoving = false; //Updates the position of the player Position = new Vector2(xPos, yPos); bounds = new Rectangle((int)Position.X, (int)Position.Y, playerWidth, playerHeight); //Sets the screen width and height this.screenWidth = screenWidth; this.screenHeight = screenHeight; //Creates a list of projectiles for the enemy Projectiles = new List <Projectile>(); //Sets the health to full Health = 100; }
///////////////////////////////////////////||\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ ///////////////////////////////////// CONSTRUCTOR \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ ///////////////////////////////////////////||\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ //Pre: The game tiles, x and y position fo the enemy, width and height of the enemy, and the width and height of the screen //Post: The enemy is created //Desc: A constructor for the enemy public Enemy(Tile[,] gameTiles, int xPos, int yPos, int enemyWidth, int enemyHeight, int screenWidth, int screenHeight) { //Sets the pathfinding and frame animation objects pathFinding = new PathFinding(gameTiles); frameAnimation = new FrameAnimation(rifle.GetTextures(AnimationState.Idle), IDLE_FRAME_DELAY); //Sets the human to not moving HumanMoving = false; //Sets the position and bounds of the enemy Position = new Vector2(xPos, yPos); bounds = new Rectangle((int)Position.X, (int)Position.Y, enemyWidth, enemyHeight); //Creates a new list of projectiles Projectiles = new List <Projectile>(); //Sets the width and height of the screen this.screenWidth = screenWidth; this.screenHeight = screenHeight; //Sets the health to full Health = 100; }