Skip to content

Commit

Permalink
- Updated Enemy.cs
Browse files Browse the repository at this point in the history
- Updated Game1.cs
- Updated GameManager.cs
- Updated Maps.cs
  • Loading branch information
thakyZ committed Mar 28, 2015
1 parent 1ab95e1 commit 40daaeb
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 10 deletions.
17 changes: 9 additions & 8 deletions Predator/Predator/Enemy.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ public enum MovementType
BOUNCE,
BOSSBOUNCE,
BOSSHEAD,
RAT,
NONE
}

Expand All @@ -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)
{
Expand Down Expand Up @@ -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
{
Expand All @@ -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));
}
Expand All @@ -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)
{
Expand All @@ -121,7 +122,7 @@ public override void Update(GameTime gameTime)

if (_MovementType != MovementType.BOUNCE || _MovementType != MovementType.BOSSBOUNCE)
{
SetAnimation("CHASE");
SetAnimation("WALK1");
}

Position += Direction;
Expand All @@ -135,7 +136,7 @@ public override void Update(GameTime gameTime)
{
if (_MovementType != MovementType.BOUNCE || _MovementType != MovementType.BOSSBOUNCE)
{
SetAnimation("IDLE");
SetAnimation("IDLE1");
}
}

Expand Down Expand Up @@ -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");
}
}

Expand Down
2 changes: 1 addition & 1 deletion Predator/Predator/Game1.cs
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ public Game1()
Content.RootDirectory = "Content";
Window.Title = "Preditor";
WindowSize = new Point(1024, 768);
Fullscreen = true;
Fullscreen = false;
}

/// <summary>
Expand Down
14 changes: 14 additions & 0 deletions Predator/Predator/GameManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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();

Expand Down Expand Up @@ -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));
Expand Down
2 changes: 1 addition & 1 deletion Predator/Predator/Maps.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ public static List<string> TestLevel()
Lines.Add("..........................................................................................");
Lines.Add("..........................................................................................");
Lines.Add("..........................................................................................");
Lines.Add("..+.......................................................................................");
Lines.Add("..+=......................................................................................");
Lines.Add("..........................................................................................");
Lines.Add("111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111");
return Lines;
Expand Down

0 comments on commit 40daaeb

Please sign in to comment.