diff --git a/Predator/Predator/Enemy.cs b/Predator/Predator/Enemy.cs index a333f02..a22b1ff 100644 --- a/Predator/Predator/Enemy.cs +++ b/Predator/Predator/Enemy.cs @@ -18,6 +18,7 @@ public enum MovementType BOUNCE, BOSSBOUNCE, BOSSHEAD, + RAT, NONE } @@ -38,7 +39,7 @@ public Enemy(Vector2 position, float gravity, MovementType movementType, Color c : base(position, color, animationSetList) { this.myGame = myGame; - SetAnimation("IDLE"); + SetAnimation("IDLE" + 1); if (movementType == MovementType.BOSSHEAD) { @@ -70,7 +71,7 @@ public Enemy(Vector2 position, float gravity, MovementType movementType, Color c if (movementType != MovementType.HORIZONTAL) { - playerCollisions = new Rectangle((int)Position.X, (int)Position.Y - 20, animationSetList[0].frameSize.X, animationSetList[0].frameSize.Y + 20); + playerCollisions = new Rectangle((int)Position.X, (int)Position.Y, animationSetList[0].frameSize.X, animationSetList[0].frameSize.Y); } else { @@ -87,7 +88,7 @@ public override void Update(GameTime gameTime) { Direction = new Vector2((_Player.GetPosition.X + (_Player.PositionCenter.X)) - (Position.X + (PositionCenter.X)), (_Player.GetPosition.Y + (_Player.PositionCenter.Y)) - (Position.Y + (PositionCenter.Y))); } - else if (_MovementType == MovementType.HORIZONTAL || _MovementType == MovementType.BOUNCE || _MovementType == MovementType.BOSSBOUNCE) + else if (_MovementType == MovementType.HORIZONTAL || _MovementType == MovementType.BOUNCE || _MovementType == MovementType.BOSSBOUNCE || _MovementType == MovementType.RAT) { Direction.X = (_Player.GetPosition.X + (_Player.PositionCenter.X)) - (Position.X + (PositionCenter.X)); } @@ -96,7 +97,7 @@ public override void Update(GameTime gameTime) Direction = Vector2.Zero; } - if (_MovementType != MovementType.BOSSHEAD && Collision.Magnitude(Direction) <= 200) + if (Collision.Magnitude(Direction) <= 200) { if (_MovementType != MovementType.FLY) { @@ -121,7 +122,7 @@ public override void Update(GameTime gameTime) if (_MovementType != MovementType.BOUNCE || _MovementType != MovementType.BOSSBOUNCE) { - SetAnimation("CHASE"); + SetAnimation("WALK1"); } Position += Direction; @@ -135,7 +136,7 @@ public override void Update(GameTime gameTime) { if (_MovementType != MovementType.BOUNCE || _MovementType != MovementType.BOSSBOUNCE) { - SetAnimation("IDLE"); + SetAnimation("IDLE1"); } } @@ -194,11 +195,11 @@ public override void Update(GameTime gameTime) { isJumping = true; Position.Y -= GravityForce * 1.03f; - SetAnimation("CHASE"); + SetAnimation("JUMP1"); } if (canFall) { - SetAnimation("FALLING"); + SetAnimation("FALL1"); } } diff --git a/Predator/Predator/Game1.cs b/Predator/Predator/Game1.cs index bcf573b..a38a219 100644 --- a/Predator/Predator/Game1.cs +++ b/Predator/Predator/Game1.cs @@ -116,7 +116,7 @@ public Game1() Content.RootDirectory = "Content"; Window.Title = "Preditor"; WindowSize = new Point(1024, 768); - Fullscreen = true; + Fullscreen = false; } /// diff --git a/Predator/Predator/GameManager.cs b/Predator/Predator/GameManager.cs index 67cad3f..b5d1591 100644 --- a/Predator/Predator/GameManager.cs +++ b/Predator/Predator/GameManager.cs @@ -196,6 +196,11 @@ public override void Update(GameTime gameTime) { player.Update(gameTime); + foreach (Enemy e in EnemyList1) + { + e.Update(gameTime); + } + if (!LevelLoaded) { SpawnTiles(0); @@ -218,6 +223,11 @@ public override void Draw(GameTime gameTime) spriteBatch.Begin(); { player.Draw(gameTime, spriteBatch); + + foreach (Enemy e in EnemyList1) + { + e.Draw(gameTime, spriteBatch); + } } spriteBatch.End(); @@ -261,6 +271,10 @@ public void SpawnTiles(int level) { mapTiles.Add(new Rectangle(x * 50, y * 50, 50, 50)); } + else if (tiles[x, y] == 71) + { + EnemyList1.Add(new Enemy(new Vector2(x * 50, y * 50), 1.5f, Enemy.MovementType.RAT, Color.White, playerAnimationSet, player, mapTiles, mapBoarders)); + } else if (tiles[x, y] == 70) { player.SetPosition(new Vector2(x * 50, y * 50)); diff --git a/Predator/Predator/Maps.cs b/Predator/Predator/Maps.cs index 88ea27c..ef836e6 100644 --- a/Predator/Predator/Maps.cs +++ b/Predator/Predator/Maps.cs @@ -14,7 +14,7 @@ public static List TestLevel() Lines.Add(".........................................................................................."); Lines.Add(".........................................................................................."); Lines.Add(".........................................................................................."); - Lines.Add("..+......................................................................................."); + Lines.Add("..+=......................................................................................"); Lines.Add(".........................................................................................."); Lines.Add("111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111"); return Lines;