Skip to content

Commit

Permalink
- Added new tiles
Browse files Browse the repository at this point in the history
- Changed cave background
- Changed color of beam
- Added death (partially)
etc.
  • Loading branch information
thakyZ committed Mar 20, 2015
1 parent 7470e7f commit a7e2996
Show file tree
Hide file tree
Showing 30 changed files with 591 additions and 139 deletions.
4 changes: 2 additions & 2 deletions WrathOfJohn/VoidEngine/VoidEngine/Sprite.cs
Original file line number Diff line number Diff line change
Expand Up @@ -98,15 +98,15 @@ public List<AnimationSet> AnimationSets
/// <summary>
/// Gets or sets the animations frame tick time.
/// </summary>
private int LastFrameTime
protected int LastFrameTime
{
get;
set;
}
/// <summary>
/// Gets or sets the SpriteEffects value of the sprite.
/// </summary>
private SpriteEffects flipEffect
protected SpriteEffects flipEffect
{
get;
set;
Expand Down
56 changes: 52 additions & 4 deletions WrathOfJohn/WrathOfJohn/Enemy.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand All @@ -99,7 +100,10 @@ public override void Update(GameTime gameTime)
}
}

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

Position += Direction;

Expand All @@ -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)
{
Expand All @@ -123,6 +142,11 @@ public override void Update(GameTime gameTime)
{
isJumping = true;
Position.Y -= GravityForce * 1.03f;
SetAnimation("CHASE");
}
if (canFall)
{
SetAnimation("FALLING");
}
}

Expand All @@ -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()
Expand Down
340 changes: 270 additions & 70 deletions WrathOfJohn/WrathOfJohn/GameManager.cs

Large diffs are not rendered by default.

86 changes: 43 additions & 43 deletions WrathOfJohn/WrathOfJohn/Maps.cs

Large diffs are not rendered by default.

7 changes: 4 additions & 3 deletions WrathOfJohn/WrathOfJohn/MenuManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
Expand Down Expand Up @@ -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();

Expand Down
74 changes: 73 additions & 1 deletion WrathOfJohn/WrathOfJohn/PlatformManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public PlatformManager(Vector2 pos, Game mygame, int type, List<AnimationSet> an
{
myGame = mygame;
this.type = type;
SetAnimation("IDLE1");
SetAnimation("1");
}

public override void Update(GameTime gameTime)
Expand Down Expand Up @@ -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);
}
}
Expand Down
62 changes: 57 additions & 5 deletions WrathOfJohn/WrathOfJohn/Player.cs
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,9 @@ public Mana(float maxMana, float manaRechargeTime, float manaInterval)
/// </summary>
public Game1 myGame;

public bool Dead = false;
public float Lives = 3;

#region Movement and Collision
/// <summary>
/// The player's collisions.
Expand Down Expand Up @@ -110,6 +113,10 @@ public float DefaultGravityForce
get;
set;
}
/// <summary>
/// The center of the player;
/// </summary>
public Vector2 PositionCenter;
#endregion

#region Projectiles
Expand All @@ -128,10 +135,10 @@ protected List<Sprite.AnimationSet> ProjectileAnimationSet
/// <summary>
/// Gets or sets the list of projectiles.
/// </summary>
protected List<Projectile> ProjectileList
public List<Projectile> ProjectileList
{
get;
set;
protected set;
}
/// <summary>
/// Gets or sets if the projectile list is created.
Expand Down Expand Up @@ -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();
Expand Down Expand Up @@ -349,6 +390,8 @@ public override void Update(GameTime gameTime)
base.Update(gameTime);

Position += Direction;

PositionCenter = new Vector2(Position.X, Position.Y + 21);
}

/// <summary>
Expand Down Expand Up @@ -412,7 +455,7 @@ public void ShootBeam(float shootFactor)
/// <param name="keyList">The key list to update the input method with, (for custom lists)</param>
protected virtual void InputMethod(List<Keys> 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;
Expand Down Expand Up @@ -447,10 +490,10 @@ protected virtual void InputMethod(List<Keys> keyList)
}
if (myGame.CheckKey(MovementKeys[5]))
{
if (CanShootProjectile && !isJumping && !canFall)
if (CanShootProjectile)
{
SetAnimation("SHOOT");
ShootBeam(3);
ShootBeam(5);
}
}
}
Expand Down Expand Up @@ -514,5 +557,14 @@ protected virtual void UpdateGravity()

Direction.Y = MathHelper.Clamp(Direction.Y, -GravityForce - 1f, GravityForce);
}

/// <summary>
///
/// </summary>
/// <param name="newPosition"></param>
public void SetPosition(Vector2 newPosition)
{
Position = newPosition;
}
}
}
2 changes: 1 addition & 1 deletion WrathOfJohn/WrathOfJohn/Projectile.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ namespace WrathOfJohn
{
public class Projectile : Sprite
{
Rectangle projectileRectangle;
public Rectangle projectileRectangle;

Game1 myGame;
Player player;
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified WrathOfJohn/WrathOfJohnContent/Images/projectiles/beam.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Loading

0 comments on commit a7e2996

Please sign in to comment.