diff --git a/egp_story/Levels/DarkvilleFarmsLevel.cs b/egp_story/Levels/DarkvilleFarmsLevel.cs index f1a3218..9ca41d0 100644 --- a/egp_story/Levels/DarkvilleFarmsLevel.cs +++ b/egp_story/Levels/DarkvilleFarmsLevel.cs @@ -23,15 +23,16 @@ public class DarkvilleFarmsLevel : IStoryLevel public DarkvilleFarmsLevel( ) { - _player = new Player( CardinalDirection.EAST ); - - _player.AttackEastAnim = new AnimatedSprite( Assets.SilverboltShootEast, 10, 10 ); - _player.AttackSouthAnim = new AnimatedSprite( Assets.SilverboltShootSouth, 10, 10 ); - _player.AttackNorthAnim = new AnimatedSprite( Assets.SilverboltShootNorth, 10, 10 ); - - _player.WalkEastAnim = new AnimatedSprite( Assets.SilverboltWalkEast, 2, 10 ); - _player.WalkSouthAnim = new AnimatedSprite( Assets.SilverboltWalkSouth, 2, 10 ); - _player.WalkNorthAnim = new AnimatedSprite( Assets.SilverboltWalkNorth, 2, 10 ); + _player = new Player( CardinalDirection.EAST, + new[] { + new AnimatedSprite( Assets.SilverboltShootNorth, 10, 10 ), + new AnimatedSprite( Assets.SilverboltShootSouth, 10, 10 ), + new AnimatedSprite( Assets.SilverboltShootEast, 10, 10 ) }, + new[] { + new AnimatedSprite( Assets.SilverboltWalkNorth, 2, 10 ), + new AnimatedSprite( Assets.SilverboltWalkSouth, 2, 10 ), + new AnimatedSprite( Assets.SilverboltWalkEast, 2, 10 )} + ); } public void Update( GameTime gameTime ) diff --git a/egp_story/Player.cs b/egp_story/Player.cs index a679abe..effd9a6 100644 --- a/egp_story/Player.cs +++ b/egp_story/Player.cs @@ -34,8 +34,25 @@ public class Player : IUpdateable, IDrawable public AnimatedSprite CurrentAnimation { get; set; } - public Player( CardinalDirection initialFacingDirection ) + /// + /// + /// + /// + /// The order of the animations: North, South, East + /// The order of the animations: North, South, East + public Player( CardinalDirection initialFacingDirection, AnimatedSprite[] attackAnims, + AnimatedSprite[] walkAnims ) { + AttackNorthAnim = attackAnims[0]; + AttackSouthAnim = attackAnims[1]; + AttackEastAnim = attackAnims[2]; + + WalkNorthAnim = walkAnims[0]; + WalkSouthAnim = walkAnims[1]; + WalkEastAnim = walkAnims[2]; + + FacingDirection = initialFacingDirection; + ReplaceCurrentAnimation( ); } private void ReplaceCurrentAnimation( )