diff --git a/WrathOfJohn/VoidEngine/VoidEngine/Sprite.cs b/WrathOfJohn/VoidEngine/VoidEngine/Sprite.cs index 663f1ce..25d8999 100644 --- a/WrathOfJohn/VoidEngine/VoidEngine/Sprite.cs +++ b/WrathOfJohn/VoidEngine/VoidEngine/Sprite.cs @@ -98,7 +98,7 @@ public List AnimationSets /// /// Gets or sets the animations frame tick time. /// - private int LastFrameTime + protected int LastFrameTime { get; set; @@ -106,7 +106,7 @@ private int LastFrameTime /// /// Gets or sets the SpriteEffects value of the sprite. /// - private SpriteEffects flipEffect + protected SpriteEffects flipEffect { get; set; diff --git a/WrathOfJohn/WrathOfJohn/Enemy.cs b/WrathOfJohn/WrathOfJohn/Enemy.cs index 9409452..5123201 100644 --- a/WrathOfJohn/WrathOfJohn/Enemy.cs +++ b/WrathOfJohn/WrathOfJohn/Enemy.cs @@ -41,6 +41,7 @@ public Enemy(Vector2 position, float gravity, MovementType movementType, Color c if (movementType == MovementType.FLY) { RotationCenter = new Vector2(animationSetList[0].frameSize.X / 2, animationSetList[0].frameSize.Y / 2); + Offset = new Vector2(-(animationSetList[0].frameSize.X / 2), -(animationSetList[0].frameSize.Y / 2)); } #region Reset Gravity @@ -69,11 +70,11 @@ public override void Update(GameTime gameTime) if (_MovementType == MovementType.FLY) { - Direction = new Vector2(_Player.GetPosition.X - Position.X, _Player.GetPosition.Y - Position.Y); + Direction = new Vector2(_Player.PositionCenter.X - 10 - Position.X, _Player.PositionCenter.Y - Position.Y); } else if (_MovementType == MovementType.HORIZONTAL || _MovementType == MovementType.BOUNCE) { - Direction.X = _Player.GetPosition.X - Position.X; + Direction.X = _Player.PositionCenter.X - Position.X; } if (Collision.Magnitude(Direction) <= 200) @@ -99,7 +100,10 @@ public override void Update(GameTime gameTime) } } - SetAnimation("CHASE"); + if (_MovementType != MovementType.BOUNCE) + { + SetAnimation("CHASE"); + } Position += Direction; @@ -108,6 +112,21 @@ public override void Update(GameTime gameTime) Rotation += 0.05f; } } + else + { + if (_MovementType != MovementType.BOUNCE) + { + SetAnimation("IDLE"); + } + } + + foreach (Projectile p in _Player.ProjectileList) + { + if (playerCollisions.TouchLeftOf(p.projectileRectangle) || playerCollisions.TouchTopOf(p.projectileRectangle) || playerCollisions.TouchRightOf(p.projectileRectangle) || playerCollisions.TouchBottomOf(p.projectileRectangle)) + { + DeleteMe = true; + } + } foreach (Rectangle r in MapTiles) { @@ -123,6 +142,11 @@ public override void Update(GameTime gameTime) { isJumping = true; Position.Y -= GravityForce * 1.03f; + SetAnimation("CHASE"); + } + if (canFall) + { + SetAnimation("FALLING"); } } @@ -132,8 +156,32 @@ public override void Update(GameTime gameTime) } UpdateGravity(); + LastFrameTime += gameTime.ElapsedGameTime.Milliseconds; - SetAnimation("IDLE"); + if (LastFrameTime >= CurrentAnimation.framesPerMillisecond) + { + CurrentFrame.X++; + + if (CurrentFrame.X >= CurrentAnimation.sheetSize.X) + { + CurrentFrame.Y++; + if (_MovementType != MovementType.BOUNCE) + { + CurrentFrame.X = 0; + } + else + { + CurrentFrame.X = CurrentAnimation.sheetSize.X; + } + + if (CurrentFrame.Y >= CurrentAnimation.sheetSize.Y) + { + CurrentFrame.Y = 0; + } + } + + LastFrameTime = 0; + } } protected override void UpdateGravity() diff --git a/WrathOfJohn/WrathOfJohn/GameManager.cs b/WrathOfJohn/WrathOfJohn/GameManager.cs index 472c461..4677954 100644 --- a/WrathOfJohn/WrathOfJohn/GameManager.cs +++ b/WrathOfJohn/WrathOfJohn/GameManager.cs @@ -30,6 +30,10 @@ public class GameManager : Microsoft.Xna.Framework.DrawableGameComponent /// Camera camera; + Song forestSong; + Song finalBoss; + bool musicStarted; + #region Player Variables /// /// The player class. @@ -88,7 +92,19 @@ public List platformList /// /// The texture sheet of blocks. /// - Texture2D platformTexture; + Texture2D plainsPlatformTexture; + /// + /// + /// + Texture2D forestPlatformTexture; + /// + /// + /// + Texture2D cavePlatformTexture; + /// + /// + /// + Texture2D villagePlatformTexture; /// /// The animation set list of the blocks. /// @@ -135,7 +151,7 @@ public bool levelLoaded public bool wonLevel { get; - protected set; + set; } #endregion @@ -143,27 +159,83 @@ public bool wonLevel /// /// The first parallax texture. /// - Texture2D parallax1; + Texture2D plainsParallax1; + /// + /// The second parallax texture. + /// + Texture2D plainsParallax2; + /// + /// The third parallax texture. + /// + Texture2D plainsParallax3; + /// + /// The first parallax background class. + /// + ParallaxBackground plainsParallax1Background; + /// + /// The second parallax background class. + /// + ParallaxBackground plainsParallax2Background; + /// + /// The third parallax background class. + /// + ParallaxBackground plainsParallax3Background; + /// + /// The first parallax texture. + /// + Texture2D forestParallax1; /// /// The second parallax texture. /// - Texture2D parallax2; + Texture2D forestParallax2; /// /// The third parallax texture. /// - Texture2D parallax3; + Texture2D forestParallax3; /// /// The first parallax background class. /// - ParallaxBackground parallax1Background; + ParallaxBackground forestParallax1Background; /// /// The second parallax background class. /// - ParallaxBackground parallax2Background; + ParallaxBackground forestParallax2Background; /// /// The third parallax background class. /// - ParallaxBackground parallax3Background; + ParallaxBackground forestParallax3Background; + /// + /// The first parallax texture. + /// + Texture2D caveParallax1; + /// + /// The second parallax texture. + /// + Texture2D caveParallax2; + /// + /// The third parallax texture. + /// + Texture2D caveParallax3; + /// + /// The first parallax background class. + /// + ParallaxBackground caveParallax1Background; + /// + /// The second parallax background class. + /// + ParallaxBackground caveParallax2Background; + /// + /// The third parallax background class. + /// + ParallaxBackground caveParallax3Background; + /// + /// The first parallax texture. + /// + Texture2D villageParallax1; + /// + /// The first parallax background class. + /// + ParallaxBackground villageParallax1Background; #endregion #region Enemy Variables @@ -226,7 +298,7 @@ public override void Initialize() mapSegments = new List(); - level = 1; + level = 2; for (int i = 0; i < DebugLines.Length; i++) { @@ -246,13 +318,25 @@ protected override void LoadContent() playerTexture = Game.Content.Load(@"images\players\mage"); debugDotTexture = Game.Content.Load(@"images\debug\line"); ProjectileTexture = Game.Content.Load(@"images\projectiles\beam"); - parallax1 = Game.Content.Load(@"images\parallax\plainsbackground1"); - parallax2 = Game.Content.Load(@"images\parallax\plainsbackground2"); - parallax3 = Game.Content.Load(@"images\parallax\plainsbackground3"); + plainsParallax1 = Game.Content.Load(@"images\parallax\plainsbackground1"); + plainsParallax2 = Game.Content.Load(@"images\parallax\plainsbackground2"); + plainsParallax3 = Game.Content.Load(@"images\parallax\plainsbackground3"); + forestParallax1 = Game.Content.Load(@"images\parallax\forestbackground1"); + forestParallax2 = Game.Content.Load(@"images\parallax\forestbackground2"); + forestParallax3 = Game.Content.Load(@"images\parallax\forestbackground3"); + caveParallax1 = Game.Content.Load(@"images\parallax\cavebackground1"); + caveParallax2 = Game.Content.Load(@"images\parallax\cavebackground2"); + caveParallax3 = Game.Content.Load(@"images\parallax\cavebackground3"); + villageParallax1 = Game.Content.Load(@"images\parallax\village"); cEnemyTexture = Game.Content.Load(@"images\enemies\CircleEnemy"); sEnemyTexture = Game.Content.Load(@"images\enemies\SquareEnemy"); tEnemyTexture = Game.Content.Load(@"images\enemies\TriangleEnemy"); - platformTexture = Game.Content.Load(@"images\tiles\platforms"); + plainsPlatformTexture = Game.Content.Load(@"images\tiles\plainsTiles"); + forestPlatformTexture = Game.Content.Load(@"images\tiles\forestTiles"); + cavePlatformTexture = Game.Content.Load(@"images\tiles\caveTiles"); + villagePlatformTexture = Game.Content.Load(@"images\tiles\villageTiles"); + forestSong = Game.Content.Load(@"sounds\music\forest"); + finalBoss = Game.Content.Load(@"sounds\music\finalboss"); camera = new Camera(GraphicsDevice.Viewport, new Point(6400, 450), 1f); camera.Position = new Vector2(0, 0); @@ -260,38 +344,69 @@ protected override void LoadContent() mapSegments.Add(new Rectangle(-5, 0, 5, (int)camera.Size.Y)); mapSegments.Add(new Rectangle((int)camera.Size.X, 0, 5, (int)camera.Size.Y)); - parallax1Background = new ParallaxBackground(parallax1, new Vector2(camera.Position.X - (myGame.WindowSize.X / 2), 0), Color.White, 1.000f, camera); - parallax2Background = new ParallaxBackground(parallax2, new Vector2(camera.Position.X - (myGame.WindowSize.X / 2), 0), Color.White, 1.125f, camera); - parallax3Background = new ParallaxBackground(parallax3, new Vector2(camera.Position.X - (myGame.WindowSize.X / 2), 0), Color.White, 1.250f, camera); + plainsParallax1Background = new ParallaxBackground(plainsParallax1, new Vector2(camera.Position.X - (myGame.WindowSize.X / 2), 0), Color.White, 1.000f, camera); + plainsParallax2Background = new ParallaxBackground(plainsParallax2, new Vector2(camera.Position.X - (myGame.WindowSize.X / 2), 0), Color.White, 1.125f, camera); + plainsParallax3Background = new ParallaxBackground(plainsParallax3, new Vector2(camera.Position.X - (myGame.WindowSize.X / 2), 0), Color.White, 1.250f, camera); + + villageParallax1Background = new ParallaxBackground(villageParallax1, new Vector2(camera.Position.X - (myGame.WindowSize.X / 2), 0), Color.White, 1.000f, camera); + + forestParallax1Background = new ParallaxBackground(forestParallax1, new Vector2(camera.Position.X - (myGame.WindowSize.X / 2), 0), Color.White, 1.000f, camera); + forestParallax2Background = new ParallaxBackground(forestParallax2, new Vector2(camera.Position.X - (myGame.WindowSize.X / 2), 0), Color.White, 1.125f, camera); + forestParallax3Background = new ParallaxBackground(forestParallax3, new Vector2(camera.Position.X - (myGame.WindowSize.X / 2), 0), Color.White, 1.250f, camera); + + caveParallax1Background = new ParallaxBackground(caveParallax1, new Vector2(camera.Position.X - (myGame.WindowSize.X / 2), 0), Color.White, 1.000f, camera); + caveParallax2Background = new ParallaxBackground(caveParallax2, new Vector2(camera.Position.X - (myGame.WindowSize.X / 2), 0), Color.White, 1.125f, camera); + caveParallax3Background = new ParallaxBackground(caveParallax3, new Vector2(camera.Position.X - (myGame.WindowSize.X / 2), 0), Color.White, 1.250f, camera); - playerAnimationSetList.Add(new Sprite.AnimationSet("IDLE", playerTexture, new Point(124, 148), new Point(4, 1), new Point(0, 2), 1000)); + playerAnimationSetList.Add(new Sprite.AnimationSet("IDLE", playerTexture, new Point(124, 148), new Point(4, 1), new Point(0, 2), 1600)); playerAnimationSetList.Add(new Sprite.AnimationSet("WALK", playerTexture, new Point(100, 140), new Point(8, 1), new Point(0, 476), 100)); - playerAnimationSetList.Add(new Sprite.AnimationSet("JUMP", playerTexture, new Point(187, 174), new Point(4, 1), new Point(0, 302), 1000)); - playerAnimationSetList.Add(new Sprite.AnimationSet("SHOOT", playerTexture, new Point(124, 148), new Point(5, 1), new Point(0, 154), 250)); + playerAnimationSetList.Add(new Sprite.AnimationSet("JUMP", playerTexture, new Point(187, 174), new Point(4, 1), new Point(0, 302), 1600)); + playerAnimationSetList.Add(new Sprite.AnimationSet("SHOOT", playerTexture, new Point(124, 148), new Point(5, 1), new Point(0, 154), 1600)); - cEnemyAnimationSetList.Add(new Sprite.AnimationSet("IDLE", cEnemyTexture, new Point(25, 25), new Point(1, 1), new Point(0, 0), 1000)); + cEnemyAnimationSetList.Add(new Sprite.AnimationSet("IDLE", cEnemyTexture, new Point(25, 25), new Point(1, 1), new Point(0, 0), 1600)); + cEnemyAnimationSetList.Add(new Sprite.AnimationSet("CHASE", cEnemyTexture, new Point(25, 25), new Point(9, 1), new Point(25, 0), 100)); //Needs rest of animations ^ - sEnemyAnimationSetList.Add(new Sprite.AnimationSet("IDLE", sEnemyTexture, new Point(25, 25), new Point(1, 1), new Point(0, 0), 1000)); + sEnemyAnimationSetList.Add(new Sprite.AnimationSet("IDLE", sEnemyTexture, new Point(25, 25), new Point(1, 1), new Point(0, 0), 1600)); + sEnemyAnimationSetList.Add(new Sprite.AnimationSet("CHASE", sEnemyTexture, new Point(25, 25), new Point(5, 1), new Point(0, 0), 100)); + sEnemyAnimationSetList.Add(new Sprite.AnimationSet("FALLING", sEnemyTexture, new Point(25, 25), new Point(4, 1), new Point(150, 0), 100)); //Needs edit ^ tEnemyAnimationSetList.Add(new Sprite.AnimationSet("IDLE", tEnemyTexture, new Point(25, 25), new Point(1, 1), new Point(0, 0), 1000)); //Needs edit ^ - platformAnimationSetList.Add(new Sprite.AnimationSet("1", platformTexture, new Point(25, 25), new Point(1, 1), new Point(0, 0), 0)); - platformAnimationSetList.Add(new Sprite.AnimationSet("2", platformTexture, new Point(25, 25), new Point(1, 1), new Point(25, 0), 0)); - platformAnimationSetList.Add(new Sprite.AnimationSet("3", platformTexture, new Point(25, 25), new Point(1, 1), new Point(50, 0), 0)); - platformAnimationSetList.Add(new Sprite.AnimationSet("4", platformTexture, new Point(25, 25), new Point(1, 1), new Point(75, 0), 0)); - platformAnimationSetList.Add(new Sprite.AnimationSet("5", platformTexture, new Point(25, 25), new Point(1, 1), new Point(0, 25), 0)); - platformAnimationSetList.Add(new Sprite.AnimationSet("6", platformTexture, new Point(25, 25), new Point(1, 1), new Point(25, 25), 0)); - platformAnimationSetList.Add(new Sprite.AnimationSet("7", platformTexture, new Point(25, 25), new Point(1, 1), new Point(50, 25), 0)); - platformAnimationSetList.Add(new Sprite.AnimationSet("8", platformTexture, new Point(25, 25), new Point(1, 1), new Point(75, 25), 0)); - platformAnimationSetList.Add(new Sprite.AnimationSet("9", platformTexture, new Point(25, 25), new Point(1, 1), new Point(0, 50), 0)); - platformAnimationSetList.Add(new Sprite.AnimationSet("10", platformTexture, new Point(25, 25), new Point(1, 1), new Point(25, 50), 0)); - platformAnimationSetList.Add(new Sprite.AnimationSet("11", platformTexture, new Point(25, 25), new Point(1, 1), new Point(50, 50), 0)); - platformAnimationSetList.Add(new Sprite.AnimationSet("12", platformTexture, new Point(25, 25), new Point(1, 1), new Point(75, 50), 0)); - platformAnimationSetList.Add(new Sprite.AnimationSet("13", platformTexture, new Point(25, 25), new Point(1, 1), new Point(0, 75), 0)); - platformAnimationSetList.Add(new Sprite.AnimationSet("14", platformTexture, new Point(25, 25), new Point(1, 1), new Point(25, 75), 0)); - platformAnimationSetList.Add(new Sprite.AnimationSet("15", platformTexture, new Point(25, 25), new Point(1, 1), new Point(50, 75), 0)); - platformAnimationSetList.Add(new Sprite.AnimationSet("16", platformTexture, new Point(25, 25), new Point(1, 1), new Point(75, 75), 0)); + platformAnimationSetList.Add(new Sprite.AnimationSet("1", plainsPlatformTexture, new Point(25, 25), new Point(1, 1), new Point(0, 0), 0)); + platformAnimationSetList.Add(new Sprite.AnimationSet("2", plainsPlatformTexture, new Point(25, 25), new Point(1, 1), new Point(25, 0), 0)); + platformAnimationSetList.Add(new Sprite.AnimationSet("3", plainsPlatformTexture, new Point(25, 25), new Point(1, 1), new Point(50, 0), 0)); + platformAnimationSetList.Add(new Sprite.AnimationSet("4", plainsPlatformTexture, new Point(25, 25), new Point(1, 1), new Point(75, 0), 0)); + platformAnimationSetList.Add(new Sprite.AnimationSet("5", plainsPlatformTexture, new Point(25, 25), new Point(1, 1), new Point(0, 25), 0)); + platformAnimationSetList.Add(new Sprite.AnimationSet("6", plainsPlatformTexture, new Point(25, 25), new Point(1, 1), new Point(25, 25), 0)); + platformAnimationSetList.Add(new Sprite.AnimationSet("7", plainsPlatformTexture, new Point(25, 25), new Point(1, 1), new Point(50, 25), 0)); + platformAnimationSetList.Add(new Sprite.AnimationSet("8", plainsPlatformTexture, new Point(25, 25), new Point(1, 1), new Point(75, 25), 0)); + platformAnimationSetList.Add(new Sprite.AnimationSet("9", plainsPlatformTexture, new Point(25, 25), new Point(1, 1), new Point(0, 50), 0)); + platformAnimationSetList.Add(new Sprite.AnimationSet("10", plainsPlatformTexture, new Point(25, 25), new Point(1, 1), new Point(25, 50), 0)); + platformAnimationSetList.Add(new Sprite.AnimationSet("11", plainsPlatformTexture, new Point(25, 25), new Point(1, 1), new Point(50, 50), 0)); + platformAnimationSetList.Add(new Sprite.AnimationSet("12", plainsPlatformTexture, new Point(25, 25), new Point(1, 1), new Point(75, 50), 0)); + platformAnimationSetList.Add(new Sprite.AnimationSet("13", plainsPlatformTexture, new Point(25, 25), new Point(1, 1), new Point(0, 75), 0)); + platformAnimationSetList.Add(new Sprite.AnimationSet("14", plainsPlatformTexture, new Point(25, 25), new Point(1, 1), new Point(25, 75), 0)); + platformAnimationSetList.Add(new Sprite.AnimationSet("15", plainsPlatformTexture, new Point(25, 25), new Point(1, 1), new Point(50, 75), 0)); + platformAnimationSetList.Add(new Sprite.AnimationSet("16", plainsPlatformTexture, new Point(25, 25), new Point(1, 1), new Point(75, 75), 0)); + platformAnimationSetList.Add(new Sprite.AnimationSet("17", forestPlatformTexture, new Point(25, 25), new Point(1, 1), new Point(0, 0), 0)); + platformAnimationSetList.Add(new Sprite.AnimationSet("18", forestPlatformTexture, new Point(25, 25), new Point(1, 1), new Point(25, 0), 0)); + platformAnimationSetList.Add(new Sprite.AnimationSet("19", forestPlatformTexture, new Point(25, 25), new Point(1, 1), new Point(50, 0), 0)); + platformAnimationSetList.Add(new Sprite.AnimationSet("20", forestPlatformTexture, new Point(25, 25), new Point(1, 1), new Point(75, 0), 0)); + platformAnimationSetList.Add(new Sprite.AnimationSet("21", forestPlatformTexture, new Point(25, 25), new Point(1, 1), new Point(0, 25), 0)); + platformAnimationSetList.Add(new Sprite.AnimationSet("22", forestPlatformTexture, new Point(25, 25), new Point(1, 1), new Point(25, 25), 0)); + platformAnimationSetList.Add(new Sprite.AnimationSet("23", forestPlatformTexture, new Point(25, 25), new Point(1, 1), new Point(50, 25), 0)); + platformAnimationSetList.Add(new Sprite.AnimationSet("24", forestPlatformTexture, new Point(25, 25), new Point(1, 1), new Point(75, 25), 0)); + platformAnimationSetList.Add(new Sprite.AnimationSet("25", forestPlatformTexture, new Point(25, 25), new Point(1, 1), new Point(0, 50), 0)); + platformAnimationSetList.Add(new Sprite.AnimationSet("26", forestPlatformTexture, new Point(25, 25), new Point(1, 1), new Point(25, 50), 0)); + platformAnimationSetList.Add(new Sprite.AnimationSet("27", forestPlatformTexture, new Point(25, 25), new Point(1, 1), new Point(50, 50), 0)); + platformAnimationSetList.Add(new Sprite.AnimationSet("28", forestPlatformTexture, new Point(25, 25), new Point(1, 1), new Point(75, 50), 0)); + platformAnimationSetList.Add(new Sprite.AnimationSet("29", forestPlatformTexture, new Point(25, 25), new Point(1, 1), new Point(0, 75), 0)); + platformAnimationSetList.Add(new Sprite.AnimationSet("30", forestPlatformTexture, new Point(25, 25), new Point(1, 1), new Point(25, 75), 0)); + platformAnimationSetList.Add(new Sprite.AnimationSet("31", forestPlatformTexture, new Point(25, 25), new Point(1, 1), new Point(50, 75), 0)); + platformAnimationSetList.Add(new Sprite.AnimationSet("32", forestPlatformTexture, new Point(25, 25), new Point(1, 1), new Point(75, 75), 0)); + platformAnimationSetList.Add(new Sprite.AnimationSet("33", cavePlatformTexture, new Point(25, 25), new Point(1, 1), new Point(0, 0), 0)); + platformAnimationSetList.Add(new Sprite.AnimationSet("34", villagePlatformTexture, new Point(25, 25), new Point(1, 1), new Point(0, 0), 0)); MovementKeys.Add(Keys.A); MovementKeys.Add(Keys.W); @@ -321,25 +436,38 @@ public override void Update(GameTime gameTime) DebugLines[5] = "true"; camera.Position = new Vector2(player.GetPosition.X + 200f, 0); } - - parallax1Background.position = new Vector2(camera.Position.X - (myGame.WindowSize.X / 2), 0); - parallax1Background.Update(gameTime); - parallax2Background.position = new Vector2(camera.Position.X - (myGame.WindowSize.X / 2), 0); - parallax2Background.Update(gameTime); - parallax3Background.position = new Vector2(camera.Position.X - (myGame.WindowSize.X / 2), 0); - parallax3Background.Update(gameTime); + // + plainsParallax1Background.position = new Vector2(camera.Position.X - (myGame.WindowSize.X / 2), 0); + plainsParallax1Background.Update(gameTime); + plainsParallax2Background.position = new Vector2(camera.Position.X - (myGame.WindowSize.X / 2), 0); + plainsParallax2Background.Update(gameTime); + plainsParallax3Background.position = new Vector2(camera.Position.X - (myGame.WindowSize.X / 2), 0); + plainsParallax3Background.Update(gameTime); + + villageParallax1Background.position = new Vector2(camera.Position.X - (myGame.WindowSize.X / 2), 0); + villageParallax1Background.Update(gameTime); + + forestParallax1Background.position = new Vector2(camera.Position.X - (myGame.WindowSize.X / 2), 0); + forestParallax1Background.Update(gameTime); + forestParallax2Background.position = new Vector2(camera.Position.X - (myGame.WindowSize.X / 2), 0); + forestParallax2Background.Update(gameTime); + forestParallax3Background.position = new Vector2(camera.Position.X - (myGame.WindowSize.X / 2), 0); + forestParallax3Background.Update(gameTime); + + caveParallax1Background.position = new Vector2(camera.Position.X - (myGame.WindowSize.X / 2), 0); + caveParallax1Background.Update(gameTime); + caveParallax2Background.position = new Vector2(camera.Position.X - (myGame.WindowSize.X / 2), 0); + caveParallax2Background.Update(gameTime); + caveParallax3Background.position = new Vector2(camera.Position.X - (myGame.WindowSize.X / 2), 0); + caveParallax3Background.Update(gameTime); #endregion - mapSegments[1] = new Rectangle(camera.Size.X - 5, mapSegments[1].Y, mapSegments[1].Width, mapSegments[1].Height); + mapSegments[1] = new Rectangle(camera.Size.X, mapSegments[1].Y, mapSegments[1].Width, mapSegments[1].Height); if (myGame.CheckKey(Keys.G) && !wonLevel) { wonLevel = true; } - if (!myGame.CheckKey(Keys.G) && wonLevel) - { - wonLevel = false; - } if (wonLevel) { @@ -347,27 +475,67 @@ public override void Update(GameTime gameTime) if (level > 6) { - level = 0; + level = 1; } levelLoaded = false; + + wonLevel = false; + + if (musicStarted) + { + MediaPlayer.Stop(); + } + + musicStarted = false; } PlayerCollisions = player.GetPlayerRectangles(); player.Update(gameTime); - foreach (Enemy ce in cEnemyList) + for (int i = 0; i < cEnemyList.Count; i++) + { + if (cEnemyList[i].DeleteMe) + { + cEnemyList.RemoveAt(i); + i--; + } + else + { + cEnemyList[i].Update(gameTime); + } + } + for (int i = 0; i < sEnemyList.Count; i++) { - ce.Update(gameTime); + if (sEnemyList[i].DeleteMe) + { + sEnemyList.RemoveAt(i); + i--; + } + else + { + sEnemyList[i].Update(gameTime); + } } - foreach (Enemy se in sEnemyList) + for (int i = 0; i < tEnemyList.Count; i++) { - se.Update(gameTime); + if (tEnemyList[i].DeleteMe) + { + tEnemyList.RemoveAt(i); + i--; + } + else + { + tEnemyList[i].Update(gameTime); + } } - foreach (Enemy te in tEnemyList) + if (player.Dead) { - te.Update(gameTime); + level = 1; + levelLoaded = false; + wonLevel = false; + player.Dead = false; } debugLabel.Update(gameTime, DebugLines[0] + "\n" + DebugLines[1] + "\n" + @@ -379,14 +547,7 @@ public override void Update(GameTime gameTime) DebugLines[0] = "IsGrounded=" + player.isGrounded + " IsJumping=" + player.isJumping + " IsFalling=" + player.isFalling + " Direction=(" + player.GetDirection.X + "," + player.GetDirection.Y + ")"; DebugLines[3] = "mana=" + player._Mana.mana + " maxMana=" + player._Mana.maxMana + " manaRechargeTime=" + player._Mana.manaRechargeTime + " manaInterval=" + player._Mana.manaInterval; DebugLines[4] = "CanShoot=" + player.CanShootProjectile + " CreateNew=" + player.CreateNewProjectile + " HasShot=" + player.HasShotProjectile + " projectileListCreated=" + player.ProjectileListCreated; - if (sEnemyList.Count > 0) - { - DebugLines[6] = "sEnemy Direction=(" + (int)sEnemyList[0].GetDirection.X + "," + (int)sEnemyList[0].GetDirection.Y + ") sEnemy Position=(" + (int)sEnemyList[0].GetPosition.X + "," + (int)sEnemyList[0].GetPosition.Y + ") sEnemy Gravity=" + sEnemyList[0].GravityForce + " isJumping=" + sEnemyList[0].isJumping + " isFalling=" + sEnemyList[0].isFalling + " canFall=" + sEnemyList[0].canFall; - } - if (cEnemyList.Count > 0) - { - DebugLines[7] = "cEnemy Direction=(" + cEnemyList[0].GetDirection.X + "," + cEnemyList[0].GetDirection.Y + ") cEnemy Position=(" + cEnemyList[0].GetPosition.X + "," + cEnemyList[0].GetPosition.Y + ")"; - } + DebugLines[6] = "Player Dead=" + player.Dead + " Player Lives=" + player.Lives; base.Update(gameTime); } @@ -413,9 +574,43 @@ public override void Draw(GameTime gameTime) levelLoaded = true; } - parallax1Background.Draw(gameTime, spriteBatch); - parallax2Background.Draw(gameTime, spriteBatch); - parallax3Background.Draw(gameTime, spriteBatch); + if (level <= 2) + { + plainsParallax1Background.Draw(gameTime, spriteBatch); + plainsParallax2Background.Draw(gameTime, spriteBatch); + plainsParallax3Background.Draw(gameTime, spriteBatch); + } + if (level == 3) + { + plainsParallax1Background.Draw(gameTime, spriteBatch); + plainsParallax2Background.Draw(gameTime, spriteBatch); + plainsParallax3Background.Draw(gameTime, spriteBatch); + villageParallax1Background.Draw(gameTime, spriteBatch); + } + if (level == 4) + { + forestParallax1Background.Draw(gameTime, spriteBatch); + forestParallax2Background.Draw(gameTime, spriteBatch); + forestParallax3Background.Draw(gameTime, spriteBatch); + } + if (level >= 5) + { + caveParallax1Background.Draw(gameTime, spriteBatch); + caveParallax2Background.Draw(gameTime, spriteBatch); + caveParallax3Background.Draw(gameTime, spriteBatch); + } + if (level == 4 && !musicStarted) + { + MediaPlayer.Stop(); + MediaPlayer.Play(forestSong); + musicStarted = true; + } + if (level == 6 && !musicStarted) + { + MediaPlayer.Stop(); + MediaPlayer.Play(finalBoss); + musicStarted = true; + } foreach (PlatformManager pm in platformList) { @@ -445,7 +640,7 @@ public override void Draw(GameTime gameTime) spriteBatch.End(); // Debug Rectangles - /* + spriteBatch.Begin(SpriteSortMode.Deferred, null, SamplerState.PointWrap, null, null, null, camera.GetTransformation()); { for (int i = 0; i < platformRectangles.Count; i++) @@ -489,7 +684,7 @@ public override void Draw(GameTime gameTime) } } spriteBatch.End(); - */ + spriteBatch.Begin(); { @@ -547,10 +742,15 @@ public void SpawnBricks(int level) { for (int y = 0; y < height; y++) { - if (brickspawn[x, y] > 0 && brickspawn[x, y] < 80) + if (brickspawn[x, y] > 0 && brickspawn[x, y] < 79) { platformList.Add(new PlatformManager(new Vector2(x * 25, y * 25), myGame, (int)brickspawn[x, y], platformAnimationSetList)); } + if (brickspawn[x, y] == 79) + { + player.SetPosition(new Vector2(x * 25, y * 25)); + camera.Position = new Vector2(player.GetPosition.X + 200f, player.GetPosition.Y); + } if (brickspawn[x, y] == 80) { cEnemyList.Add(new Enemy(new Vector2(x * 25, y * 25), 1.75f, Enemy.MovementType.HORIZONTAL, Color.White, cEnemyAnimationSetList, player, platformRectangles, mapSegments)); diff --git a/WrathOfJohn/WrathOfJohn/Maps.cs b/WrathOfJohn/WrathOfJohn/Maps.cs index 4aee392..baf7d6f 100644 --- a/WrathOfJohn/WrathOfJohn/Maps.cs +++ b/WrathOfJohn/WrathOfJohn/Maps.cs @@ -22,12 +22,12 @@ public static List HappyFace() Lines.Add(".........................................................................................."); Lines.Add(".........................................................................................."); Lines.Add(".........................................................................................."); - Lines.Add("..bbb....................................................................................."); - Lines.Add("..b>b....................................................................................."); - Lines.Add("..bbb...........................................68........................>..............."); + Lines.Add(".........................................................................................."); + Lines.Add("...>......................................................................................"); + Lines.Add("................................................68........................>..............."); Lines.Add("...........3..................................63bb34....24....68.........................."); - Lines.Add("...........b.....<...........................6bbbg...........6bb8........................."); - Lines.Add(".........63b38.............,.....,..........6bbbb......<....6bbbb8.............,.........."); + Lines.Add("....;......b.................................6bbbg...........6bb8........................."); + Lines.Add(".........63b38...<.........,.....,..........6bbbb......<....6bbbb8.............,.........."); Lines.Add("333333333bbbbb333333333333333333333333333333bbbbb33333333333bbbbbb333333333333333333333333"); return Lines; } @@ -50,7 +50,7 @@ public static List Plains() Lines.Add(".......................................................................................................................................................633338.....................................33333333333333................................................"); Lines.Add(".......................................................................................234............................................................3..............................33..........3bbbbbbbbbbbbbb3....333333333333333333333......................"); Lines.Add("............>...................................................................234....bbb8.....................................................3..................................33bb33.......3bbbbbbbbbbbbbbbb3.33bbbbbbbbbbbbbbbbbbbbb3....................."); - Lines.Add("................................3..................3...............638....638..........bbbb8...................................................6b.................................6bbbbbb3....33bbbbbbbbbbbbbbbbbb3bbbbbbbbbbbbbbbbbbbbbbbb....................."); + Lines.Add("....;...........................3..................3...............638....638..........bbbb8...................................................6b.................................6bbbbbb3....33bbbbbbbbbbbbbbbbbb3bbbbbbbbbbbbbbbbbbbbbbbb....................."); Lines.Add("......................3.........b.................6b8.............6bbb....bbb8.........bbbbb38................................................6bb38..............................6bbbbbbbb3333bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb3...................."); Lines.Add("3333333333333333333333b333333333b33333333333333333bbb3333333333333bbbb....bbbb333333333bbbbbbb33333333333333..6333333.....33333333333333333333bbbbb33333333..............63333333bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb33333333333333333333"); return Lines; @@ -74,9 +74,9 @@ public static List Village() Lines.Add("............................................................................................................................................................................................................................................................"); Lines.Add("............................................................................................................................................................................................................................................................"); Lines.Add("............................................................................................................................................................................................................................................................"); + Lines.Add("....;......................................................................................................................................................................................................................................................."); Lines.Add("............................................................................................................................................................................................................................................................"); - Lines.Add("............................................................................................................................................................................................................................................................"); - Lines.Add("333333333333333333333333333333333333338.68...68..633333333333333333333333333333333333333333333333333333333333333338.....6333333333333333333333333333333333333333333333333333333338....3....63333333333333333333333333333333333333333333333333333333333333333"); + Lines.Add("yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy.yy...yy..yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy.....yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy....y....yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy"); return Lines; } @@ -89,18 +89,18 @@ public static List Forest() Lines.Add("...................................................................................................................................................................................................................................................................................................................................................................................................................................................................."); Lines.Add("...................................................................................................................................................................................................................................................................................................................................................................................................................................................................."); Lines.Add("...................................................................................................................................................................................................................................................................................................................................................................................................................................................................."); - Lines.Add("..................................................................................................................3................................................................................................................................................................................................................................................................................................................................................."); - Lines.Add("..................................................................................................................b................................................................................................................................................................................................................................................................................................................................................."); - Lines.Add("..................................................................................................................b......................................................................................................................................................................................................................................................................................................638........................................"); - Lines.Add("..................................................................................................................b...........................................................................................................................................................................................................................................................................68.........63338......................................................"); - Lines.Add("..............................................................................................................633.b..........................................................................................................................................................................................................................................................................6................8....................................................."); - Lines.Add("...........................................................................................................633....b8........................................................................................................................................................................................................................................................................6..................8...................................................."); - Lines.Add("........................................................................................................633.........8.....................................................................3................................................................................................................................................................................................6....................8..................................................."); - Lines.Add(".....................................................................................................633............b.....................................................................b...............................................................................................................................................................................................6......................8.................................................."); - Lines.Add("...............................................................................................63333.........6333333.....................................................................6...............................................................................................................................................................................................6........................8................................................."); - Lines.Add("......................6338.3.63338................................63333333333333333333333338......................................................................................638...........................................................................................................68...........3...3.................................68...........6338....638.............6..........................8................................................"); - Lines.Add("...............63338...................6338...................68................................................................6338......................3...................3................................................................633338..............3.........................633bb33333338..6b333b8...............................6bb.....68.................8.........6............................8..............................................."); - Lines.Add("333333333333333bbbbb..........................6333338.....3...........................................6333333333333333333338..............638....3....3.......3....68.....3........................6333333333333333333333333333333333338......6bbbbbb8....638.....6b3333333333333333333333333bbbbbbbbbbbbb33bbbbbbb333333333333333333333333338...6bbb........................b333333333b............................b33333333333333333333333333333333333333333333333"); + Lines.Add("..................................................................................................................n................................................................................................................................................................................................................................................................................................................................................."); + Lines.Add("..................................................................................................................r................................................................................................................................................................................................................................................................................................................................................."); + Lines.Add("..................................................................................................................r......................................................................................................................................................................................................................................................................................................mno........................................"); + Lines.Add("..................................................................................................................r...........................................................................................................................................................................................................................................................................mo.........mnnno......................................................"); + Lines.Add("..............................................................................................................mnn.r..........................................................................................................................................................................................................................................................................m................o....................................................."); + Lines.Add("...........................................................................................................mnn....ro........................................................................................................................................................................................................................................................................m..................o...................................................."); + Lines.Add("........................................................................................................mnn.........o.....................................................................n................................................................................................................................................................................................m....................o..................................................."); + Lines.Add(".....................................................................................................mnn............r.....................................................................r...............................................................................................................................................................................................m......................o.................................................."); + Lines.Add("...............................................................................................mnnnn.........mnnnnnn.....................................................................m...............................................................................................................................................................................................m........................o................................................."); + Lines.Add("....;.................mnno.n.mnnno................................mnnnnnnnnnnnnnnnnnnnnnnnno......................................................................................mno...........................................................................................................mo...........n...n.................................mo...........mnno....mno.............m..........................o................................................"); + Lines.Add("...............mnnno...................mnno...................mo................................................................mnno......................n...................n................................................................mnnnno..............n.........................mnnrrnnnnnnno..mrnnnro...............................mrr.....mo.................o.........m............................o..............................................."); + Lines.Add("nnnnnnnnnnnnnnnrrrrr..........................mnnnnno.....n...........................................mnnnnnnnnnnnnnnnnnnnno..............mno....n....n.......n....mo.....n........................mnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnno......mrrrrrro....mno.....mrnnnnnnnnnnnnnnnnnnnnnnnnnrrrrrrrrrrrrrnnrrrrrrrnnnnnnnnnnnnnnnnnnnnnnnnnno...mrrr........................rnnnnnnnnnr............................rnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnn"); return Lines; } @@ -117,38 +117,38 @@ public static List Cave() Lines.Add(".........................................................................................................................................................................................................................................................................................................................."); Lines.Add(".........................................................................................................................................................................................................................................................................................................................."); Lines.Add(".........................................................................................................................................................................................................................................................................................................................."); - Lines.Add(".........................633333333333333333333333333333333333333333333333333338.......................................................................................................63333333333333333333333333333338...................................................................................................."); - Lines.Add("......................633bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb338........................................................................................63338..........................................................................................................................................."); - Lines.Add(".....................6bbbbbb...................................................bbb...............................................................................638......................................................638............................................................................................."); - Lines.Add("..................633bbbb.................................................................................................................................6338............................................................................................................................................................"); - Lines.Add("..................bbbbbbb.............................................................638..........638..................63338.......................6338.......................................................................6333338...................................................................................."); - Lines.Add("................63bbbbbbb33333333333333333338.......333333333333333333333333333338...........638.........638....638..........638..................63bbbb.....................................................................................633333333333333333333333333333333333338......................................"); - Lines.Add("...............6bbbbbbbbb.......................................................................................................638..638...638....bbbbbb.....................................................................................bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb8....................................."); - Lines.Add("333333333333333bbbbbbbbbb.....................................................................................................................3333bbbbbb.....................................................................................bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb3333333333333333333333333333333333333"); + Lines.Add(".........................xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx.......................................................................................................xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx...................................................................................................."); + Lines.Add("......................xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx........................................................................................xxxxx..........................................................................................................................................."); + Lines.Add(".....................xxxxxxx...................................................xxx...............................................................................xxx......................................................xxx............................................................................................."); + Lines.Add("..................xxxxxxx.................................................................................................................................xxxx............................................................................................................................................................"); + Lines.Add("..................xxxxxxx.............................................................xxx..........xxx..................xxxxx.......................xxxx.......................................................................xxxxxxx...................................................................................."); + Lines.Add("....;...........xxxxxxxxxxxxxxxxxxxxxxxxxxxxx.......xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx...........xxx.........xxx....xxx..........xxx..................xxxxxx.....................................................................................xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx......................................"); + Lines.Add("...............xxxxxxxxxx.......................................................................................................xxx..xxx...xxx....xxxxxx.....................................................................................xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx....................................."); + Lines.Add("xxxxxxxxxxxxxxxxxxxxxxxxx.....................................................................................................................xxxxxxxxxx.....................................................................................xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"); return Lines; } public static List Hell() { List Lines = new List(); - Lines.Add("..............................................................................................................................................................................................................................................................bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb"); - Lines.Add("..............................................................................................................................................................................................................................................................bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb"); + Lines.Add("..............................................................................................................................................................................................................................................................xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"); + Lines.Add("..............................................................................................................................................................................................................................................................xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"); Lines.Add(".........................................................................................................................................................................................................................................................................................................................."); Lines.Add(".........................................................................................................................................................................................................................................................................................................................."); Lines.Add(".........................................................................................................................................................................................................................................................................................................................."); - Lines.Add("...................................................................638...................................................................................................................................................................................................................................................."); - Lines.Add("...................................................................bbb...................................................................................................................................................................................................................................................."); - Lines.Add(".................................................................63b......................................................................................................................................................................................................................................................"); - Lines.Add(".................................................................bb......3................................................................................................................................................................................................................................................"); - Lines.Add("...............................................................63........b................................................................................................................................................................................................................................................"); - Lines.Add("...............................................................bb.................................................................................................................633333333338.......6333333333338........................................................................................................"); - Lines.Add("......................638.....6338.........................6333.............638.........................63338..........................................................63338......bbb.bbbb.bbb.......bbbbbbbbbbbbb........................................................................................................"); - Lines.Add(".....................6bbb...bb..bb......68................6bbb..............bbb........................3..b..3..................................................638...............bb.b.bb.b.bb.......bbbbbbbbbbbbb....638................................................................................................."); - Lines.Add("..................633bbbbbb3.....b338...bb38.............6bbb........................................3...6b8...........................................63338......................bbbbbbbbbbbb.......bbb.bbbbb.bbb........................................................................................................"); - Lines.Add("..................bbbb............bbb8..bbbb38.......6333bbb.......................638..........638.....6bbb8.....6333338......................6338.....bbb.......................bb.bbbbbb.bb.......bbbbbbbbbbbbb.........6333338........................................................................................"); - Lines.Add("................63bbb................b33b...bb.......bbbbb..........................b.....638....b.....6bbbbb8..................................bb.......b........................bbb......bbb.......bbbb.....bbbb.......................633333333338.....6333333333333333333338.........................................."); - Lines.Add("...............6bbbb..................bb.....b.......bbbb..................................b..........6bbbbbbb8............63338....63338....6....................................bbbbbbbbbbbb.......bbb.bbbbb.bbb..............................................................8........................................."); - Lines.Add("333333333333333bb............................b.......bbbb............................................6bbbbbbbbb8............bbb......bbb.....b....................................bbbbbbbbbbbb.......bbbbbbbbbbbbb...............................................................33333333333333333333333333333333333333333"); + Lines.Add("...................................................................xxx...................................................................................................................................................................................................................................................."); + Lines.Add("...................................................................xxx...................................................................................................................................................................................................................................................."); + Lines.Add(".................................................................xxx......................................................................................................................................................................................................................................................"); + Lines.Add(".................................................................xx......x................................................................................................................................................................................................................................................"); + Lines.Add("...............................................................xx........x................................................................................................................................................................................................................................................"); + Lines.Add("...............................................................xx.................................................................................................................xxxxxxxxxxxx.......xxxxxxxxxxxxx........................................................................................................"); + Lines.Add("......................xxx.....xxxx.........................xxxx.............xxx.........................xxxxx..........................................................xxxxx......xxx.xxxx.xxx.......xxxxxxxxxxxxx........................................................................................................"); + Lines.Add(".....................xxxx...xx..xx......xx................xxxx..............xxx........................x..x..x..................................................xxx...............xx.x.xx.x.xx.......xxxxxxxxxxxxx....xxx................................................................................................."); + Lines.Add("..................xxxxxxxxxx.....xxxx...xxxx.............xxxx........................................x...xxx...........................................xxxxx......................xxxxxxxxxxxx.......xxx.xxxxx.xxx........................................................................................................"); + Lines.Add("..................xxxx............xxxx..xxxxxx.......xxxxxxx.......................xxx..........xxx.....xxxxx.....xxxxxxx......................xxxx.....xxx.......................xx.xxxxxx.xx.......xxxxxxxxxxxxx.........xxxxxxx........................................................................................"); + Lines.Add("....;...........xxxxx................xxxx...xx.......xxxxx..........................x.....xxx....x.....xxxxxxx..................................xx.......x........................xxx......xxx.......xxxx.....xxxx.......................xxxxxxxxxxxx.....xxxxxxxxxxxxxxxxxxxxxx.........................................."); + Lines.Add("...............xxxxx..................xx.....x.......xxxx..................................x..........xxxxxxxxx............xxxxx....xxxxx....x....................................xxxxxxxxxxxx.......xxx.xxxxx.xxx..............................................................x........................................."); + Lines.Add("xxxxxxxxxxxxxxxxx............................x.......xxxx............................................xxxxxxxxxxx............xxx......xxx.....x....................................xxxxxxxxxxxx.......xxxxxxxxxxxxx...............................................................xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"); return Lines; } diff --git a/WrathOfJohn/WrathOfJohn/MenuManager.cs b/WrathOfJohn/WrathOfJohn/MenuManager.cs index b2a1239..bf30fd1 100644 --- a/WrathOfJohn/WrathOfJohn/MenuManager.cs +++ b/WrathOfJohn/WrathOfJohn/MenuManager.cs @@ -53,8 +53,8 @@ protected override void LoadContent() animationSpriteList.Add(new Sprite.AnimationSet("PRESSED", buttonTexture, new Point(170, 46), new Point(2, 0), new Point(340, 0), 0)); exitButton = new Button(new Vector2((myGame.WindowSize.X - 170) / 2, 366), myGame.segoeUIRegular, 1f, Color.Black, "EXIT", Color.White, animationSpriteList); - playButton = new Button(new Vector2((myGame.WindowSize.X - 170) / 2, 190), myGame.segoeUIRegular, 1f, Color.Black, "PLAY", Color.White, animationSpriteList); - optionsButton = new Button(new Vector2((myGame.WindowSize.X - 170) / 2, 275), myGame.segoeUIRegular, 1f, Color.Black, "OPTIONS", Color.White, animationSpriteList); + playButton = new Button(new Vector2(100, 190), myGame.segoeUIRegular, 1f, Color.Black, "PLAY", Color.White, animationSpriteList); + optionsButton = new Button(new Vector2((myGame.WindowSize.X - 170) - 100, 190), myGame.segoeUIRegular, 1f, Color.Black, "OPTIONS", Color.White, animationSpriteList); base.LoadContent(); } @@ -83,9 +83,10 @@ public override void Update(GameTime gameTime) public override void Draw(GameTime gameTime) { + GraphicsDevice.Clear(new Color(25, 25, 25)); spriteBatch.Begin(SpriteSortMode.BackToFront, null, SamplerState.PointWrap, null, null); { - spriteBatch.Draw(background, new Rectangle(0, 0, (int)myGame.WindowSize.X, (int)myGame.WindowSize.Y), Color.White); + spriteBatch.Draw(background, new Rectangle((int)(background.Width - myGame.WindowSize.X) / 4, 0, (int)(((myGame.WindowSize.Y / myGame.WindowSize.X) / 1.25) * background.Width), (int)myGame.WindowSize.Y), Color.White); } spriteBatch.End(); diff --git a/WrathOfJohn/WrathOfJohn/PlatformManager.cs b/WrathOfJohn/WrathOfJohn/PlatformManager.cs index 7681c6a..1af2071 100644 --- a/WrathOfJohn/WrathOfJohn/PlatformManager.cs +++ b/WrathOfJohn/WrathOfJohn/PlatformManager.cs @@ -21,7 +21,7 @@ public PlatformManager(Vector2 pos, Game mygame, int type, List an { myGame = mygame; this.type = type; - SetAnimation("IDLE1"); + SetAnimation("1"); } public override void Update(GameTime gameTime) @@ -95,6 +95,78 @@ public override void Draw(GameTime gameTime, SpriteBatch spriteBatch) { SetAnimation("16"); } + if (type == 17) + { + SetAnimation("17"); + } + if (type == 18) + { + SetAnimation("18"); + } + if (type == 19) + { + SetAnimation("19"); + } + if (type == 20) + { + SetAnimation("20"); + } + if (type == 21) + { + SetAnimation("21"); + } + if (type == 22) + { + SetAnimation("22"); + } + if (type == 23) + { + SetAnimation("23"); + } + if (type == 24) + { + SetAnimation("24"); + } + if (type == 25) + { + SetAnimation("25"); + } + if (type == 26) + { + SetAnimation("26"); + } + if (type == 27) + { + SetAnimation("27"); + } + if (type == 28) + { + SetAnimation("28"); + } + if (type == 29) + { + SetAnimation("29"); + } + if (type == 30) + { + SetAnimation("30"); + } + if (type == 31) + { + SetAnimation("31"); + } + if (type == 32) + { + SetAnimation("32"); + } + if (type == 33) + { + SetAnimation("33"); + } + if (type == 34) + { + SetAnimation("34"); + } base.Draw(gameTime, spriteBatch); } } diff --git a/WrathOfJohn/WrathOfJohn/Player.cs b/WrathOfJohn/WrathOfJohn/Player.cs index 78c7b02..13f124e 100644 --- a/WrathOfJohn/WrathOfJohn/Player.cs +++ b/WrathOfJohn/WrathOfJohn/Player.cs @@ -57,6 +57,9 @@ public Mana(float maxMana, float manaRechargeTime, float manaInterval) /// public Game1 myGame; + public bool Dead = false; + public float Lives = 3; + #region Movement and Collision /// /// The player's collisions. @@ -110,6 +113,10 @@ public float DefaultGravityForce get; set; } + /// + /// The center of the player; + /// + public Vector2 PositionCenter; #endregion #region Projectiles @@ -128,10 +135,10 @@ protected List ProjectileAnimationSet /// /// Gets or sets the list of projectiles. /// - protected List ProjectileList + public List ProjectileList { get; - set; + protected set; } /// /// Gets or sets if the projectile list is created. @@ -247,6 +254,40 @@ public override void Update(GameTime gameTime) { CheckCollision(playerCollisions, r); } + if (playerCollisions.TouchLeftOf(myGame.gameManager.mapSegments[1]) || playerCollisions.TouchTopOf(myGame.gameManager.mapSegments[1]) || playerCollisions.TouchRightOf(myGame.gameManager.mapSegments[1]) || playerCollisions.TouchBottomOf(myGame.gameManager.mapSegments[1])) + { + myGame.gameManager.wonLevel = true; + Position = Vector2.Zero; + } + foreach (Enemy e in myGame.gameManager.cEnemyList) + { + if (playerCollisions.TouchLeftOf(e.playerCollisions) || playerCollisions.TouchTopOf(e.playerCollisions) || playerCollisions.TouchRightOf(e.playerCollisions) || playerCollisions.TouchBottomOf(e.playerCollisions)) + { + Dead = true; + Lives -= 1; + } + } + foreach (Enemy e in myGame.gameManager.sEnemyList) + { + if (playerCollisions.TouchLeftOf(e.playerCollisions) || playerCollisions.TouchTopOf(e.playerCollisions) || playerCollisions.TouchRightOf(e.playerCollisions) || playerCollisions.TouchBottomOf(e.playerCollisions)) + { + Dead = true; + Lives -= 1; + } + } + foreach (Enemy e in myGame.gameManager.tEnemyList) + { + if (playerCollisions.TouchLeftOf(e.playerCollisions) || playerCollisions.TouchTopOf(e.playerCollisions) || playerCollisions.TouchRightOf(e.playerCollisions) || playerCollisions.TouchBottomOf(e.playerCollisions)) + { + Dead = true; + Lives -= 1; + } + } + if (Dead == true) + { + ProjectileList.RemoveRange(0, ProjectileList.Count); + } + Lives = MathHelper.Clamp(Lives, 0, 3); #endregion UpdateGravity(); @@ -349,6 +390,8 @@ public override void Update(GameTime gameTime) base.Update(gameTime); Position += Direction; + + PositionCenter = new Vector2(Position.X, Position.Y + 21); } /// @@ -412,7 +455,7 @@ public void ShootBeam(float shootFactor) /// The key list to update the input method with, (for custom lists) protected virtual void InputMethod(List keyList) { - if (myGame.keyboardState.IsKeyDown(keyList[4]) && (!isJumping && !canFall)) + if ((myGame.keyboardState.IsKeyDown(keyList[4]) || myGame.keyboardState.IsKeyDown(keyList[1])) && (!isJumping && !canFall)) { isJumping = true; Position.Y -= GravityForce * 1.5f; @@ -447,10 +490,10 @@ protected virtual void InputMethod(List keyList) } if (myGame.CheckKey(MovementKeys[5])) { - if (CanShootProjectile && !isJumping && !canFall) + if (CanShootProjectile) { SetAnimation("SHOOT"); - ShootBeam(3); + ShootBeam(5); } } } @@ -514,5 +557,14 @@ protected virtual void UpdateGravity() Direction.Y = MathHelper.Clamp(Direction.Y, -GravityForce - 1f, GravityForce); } + + /// + /// + /// + /// + public void SetPosition(Vector2 newPosition) + { + Position = newPosition; + } } } \ No newline at end of file diff --git a/WrathOfJohn/WrathOfJohn/Projectile.cs b/WrathOfJohn/WrathOfJohn/Projectile.cs index a60be17..4da3e20 100644 --- a/WrathOfJohn/WrathOfJohn/Projectile.cs +++ b/WrathOfJohn/WrathOfJohn/Projectile.cs @@ -15,7 +15,7 @@ namespace WrathOfJohn { public class Projectile : Sprite { - Rectangle projectileRectangle; + public Rectangle projectileRectangle; Game1 myGame; Player player; diff --git a/WrathOfJohn/WrathOfJohnContent/Images/parallax/cavebackground1.png b/WrathOfJohn/WrathOfJohnContent/Images/parallax/cavebackground1.png new file mode 100644 index 0000000..2246068 Binary files /dev/null and b/WrathOfJohn/WrathOfJohnContent/Images/parallax/cavebackground1.png differ diff --git a/WrathOfJohn/WrathOfJohnContent/Images/parallax/cavebackground2.png b/WrathOfJohn/WrathOfJohnContent/Images/parallax/cavebackground2.png new file mode 100644 index 0000000..f13d104 Binary files /dev/null and b/WrathOfJohn/WrathOfJohnContent/Images/parallax/cavebackground2.png differ diff --git a/WrathOfJohn/WrathOfJohnContent/Images/parallax/cavebackground3.png b/WrathOfJohn/WrathOfJohnContent/Images/parallax/cavebackground3.png new file mode 100644 index 0000000..7d2832d Binary files /dev/null and b/WrathOfJohn/WrathOfJohnContent/Images/parallax/cavebackground3.png differ diff --git a/WrathOfJohn/WrathOfJohnContent/Images/parallax/forestbackground1.png b/WrathOfJohn/WrathOfJohnContent/Images/parallax/forestbackground1.png new file mode 100644 index 0000000..3f0914d Binary files /dev/null and b/WrathOfJohn/WrathOfJohnContent/Images/parallax/forestbackground1.png differ diff --git a/WrathOfJohn/WrathOfJohnContent/Images/parallax/forestbackground2.png b/WrathOfJohn/WrathOfJohnContent/Images/parallax/forestbackground2.png new file mode 100644 index 0000000..d29730e Binary files /dev/null and b/WrathOfJohn/WrathOfJohnContent/Images/parallax/forestbackground2.png differ diff --git a/WrathOfJohn/WrathOfJohnContent/Images/parallax/forestbackground3.png b/WrathOfJohn/WrathOfJohnContent/Images/parallax/forestbackground3.png new file mode 100644 index 0000000..4ab9b0f Binary files /dev/null and b/WrathOfJohn/WrathOfJohnContent/Images/parallax/forestbackground3.png differ diff --git a/WrathOfJohn/WrathOfJohnContent/Images/parallax/village.png b/WrathOfJohn/WrathOfJohnContent/Images/parallax/village.png new file mode 100644 index 0000000..be0334d Binary files /dev/null and b/WrathOfJohn/WrathOfJohnContent/Images/parallax/village.png differ diff --git a/WrathOfJohn/WrathOfJohnContent/Images/projectiles/beam.png b/WrathOfJohn/WrathOfJohnContent/Images/projectiles/beam.png index 059e826..260ca9b 100644 Binary files a/WrathOfJohn/WrathOfJohnContent/Images/projectiles/beam.png and b/WrathOfJohn/WrathOfJohnContent/Images/projectiles/beam.png differ diff --git a/WrathOfJohn/WrathOfJohnContent/Images/tiles/caveTiles.png b/WrathOfJohn/WrathOfJohnContent/Images/tiles/caveTiles.png new file mode 100644 index 0000000..49b34b5 Binary files /dev/null and b/WrathOfJohn/WrathOfJohnContent/Images/tiles/caveTiles.png differ diff --git a/WrathOfJohn/WrathOfJohnContent/Images/tiles/caveTiles.xcf b/WrathOfJohn/WrathOfJohnContent/Images/tiles/caveTiles.xcf new file mode 100644 index 0000000..71406b6 Binary files /dev/null and b/WrathOfJohn/WrathOfJohnContent/Images/tiles/caveTiles.xcf differ diff --git a/WrathOfJohn/WrathOfJohnContent/Images/tiles/forestTiles.png b/WrathOfJohn/WrathOfJohnContent/Images/tiles/forestTiles.png new file mode 100644 index 0000000..7ca8765 Binary files /dev/null and b/WrathOfJohn/WrathOfJohnContent/Images/tiles/forestTiles.png differ diff --git a/WrathOfJohn/WrathOfJohnContent/Images/tiles/forestTiles.xcf b/WrathOfJohn/WrathOfJohnContent/Images/tiles/forestTiles.xcf new file mode 100644 index 0000000..d9319fa Binary files /dev/null and b/WrathOfJohn/WrathOfJohnContent/Images/tiles/forestTiles.xcf differ diff --git a/WrathOfJohn/WrathOfJohnContent/Images/tiles/forestTiles_sheet.png b/WrathOfJohn/WrathOfJohnContent/Images/tiles/forestTiles_sheet.png new file mode 100644 index 0000000..0586792 Binary files /dev/null and b/WrathOfJohn/WrathOfJohnContent/Images/tiles/forestTiles_sheet.png differ diff --git a/WrathOfJohn/WrathOfJohnContent/Images/tiles/plainsTiles.png b/WrathOfJohn/WrathOfJohnContent/Images/tiles/plainsTiles.png new file mode 100644 index 0000000..ee7a5e4 Binary files /dev/null and b/WrathOfJohn/WrathOfJohnContent/Images/tiles/plainsTiles.png differ diff --git a/WrathOfJohn/WrathOfJohnContent/Images/tiles/plainsTiles.xcf b/WrathOfJohn/WrathOfJohnContent/Images/tiles/plainsTiles.xcf new file mode 100644 index 0000000..9b625f4 Binary files /dev/null and b/WrathOfJohn/WrathOfJohnContent/Images/tiles/plainsTiles.xcf differ diff --git a/WrathOfJohn/WrathOfJohnContent/Images/tiles/plainsTiles_sheet.png b/WrathOfJohn/WrathOfJohnContent/Images/tiles/plainsTiles_sheet.png new file mode 100644 index 0000000..d1095e1 Binary files /dev/null and b/WrathOfJohn/WrathOfJohnContent/Images/tiles/plainsTiles_sheet.png differ diff --git a/WrathOfJohn/WrathOfJohnContent/Images/tiles/screens/menu.png b/WrathOfJohn/WrathOfJohnContent/Images/tiles/screens/menu.png new file mode 100644 index 0000000..a48c957 Binary files /dev/null and b/WrathOfJohn/WrathOfJohnContent/Images/tiles/screens/menu.png differ diff --git a/WrathOfJohn/WrathOfJohnContent/Images/tiles/screens/splash1.png b/WrathOfJohn/WrathOfJohnContent/Images/tiles/screens/splash1.png new file mode 100644 index 0000000..47e69d7 Binary files /dev/null and b/WrathOfJohn/WrathOfJohnContent/Images/tiles/screens/splash1.png differ diff --git a/WrathOfJohn/WrathOfJohnContent/Images/tiles/screens/splash2.png b/WrathOfJohn/WrathOfJohnContent/Images/tiles/screens/splash2.png new file mode 100644 index 0000000..0b7a0c9 Binary files /dev/null and b/WrathOfJohn/WrathOfJohnContent/Images/tiles/screens/splash2.png differ diff --git a/WrathOfJohn/WrathOfJohnContent/Images/tiles/villageTiles.png b/WrathOfJohn/WrathOfJohnContent/Images/tiles/villageTiles.png new file mode 100644 index 0000000..bdda5ce Binary files /dev/null and b/WrathOfJohn/WrathOfJohnContent/Images/tiles/villageTiles.png differ diff --git a/WrathOfJohn/WrathOfJohnContent/Images/tiles/villageTiles.xcf b/WrathOfJohn/WrathOfJohnContent/Images/tiles/villageTiles.xcf new file mode 100644 index 0000000..fb1e447 Binary files /dev/null and b/WrathOfJohn/WrathOfJohnContent/Images/tiles/villageTiles.xcf differ diff --git a/WrathOfJohn/WrathOfJohnContent/WrathOfJohnContent.contentproj b/WrathOfJohn/WrathOfJohnContent/WrathOfJohnContent.contentproj index 2f67a57..9451c6f 100644 --- a/WrathOfJohn/WrathOfJohnContent/WrathOfJohnContent.contentproj +++ b/WrathOfJohn/WrathOfJohnContent/WrathOfJohnContent.contentproj @@ -116,29 +116,22 @@ - + menu TextureImporter TextureProcessor - + splash1 TextureImporter TextureProcessor - + splash2 TextureImporter TextureProcessor - - - platforms - TextureImporter - TextureProcessor - - finalboss @@ -217,6 +210,92 @@ TextureProcessor + + + cavebackground1 + TextureImporter + TextureProcessor + + + cavebackground2 + TextureImporter + TextureProcessor + + + cavebackground3 + TextureImporter + TextureProcessor + + + forestbackground1 + TextureImporter + TextureProcessor + + + forestbackground2 + TextureImporter + TextureProcessor + + + forestbackground3 + TextureImporter + TextureProcessor + + + village + TextureImporter + TextureProcessor + + + + + forestTiles + TextureImporter + TextureProcessor + + + + + plainsTiles + TextureImporter + TextureProcessor + + + + + villageTiles + TextureImporter + TextureProcessor + + + + + caveTiles + TextureImporter + TextureProcessor + + + + + menu + TextureImporter + TextureProcessor + + + + + splash1 + TextureImporter + TextureProcessor + + + + + splash2 + TextureImporter + TextureProcessor + +