diff --git a/DangerousD/Content/Content.mgcb b/DangerousD/Content/Content.mgcb index 0ea387f..24e8d23 100644 --- a/DangerousD/Content/Content.mgcb +++ b/DangerousD/Content/Content.mgcb @@ -13,17 +13,12 @@ #---------------------------------- Content ---------------------------------# -#begin MonstersAnimations.png -/importer:TextureImporter -/processor:TextureProcessor -/processorParam:ColorKeyColor=255,0,255,255 -/processorParam:ColorKeyEnabled=True -/processorParam:GenerateMipmaps=False +#begin ButtonFont.spritefont +/importer:FontDescriptionImporter +/processor:FontDescriptionProcessor /processorParam:PremultiplyAlpha=True -/processorParam:ResizeToPowerOfTwo=False -/processorParam:MakeSquare=False -/processorParam:TextureFormat=Color -/build:MonstersAnimations.png +/processorParam:TextureFormat=Compressed +/build:ButtonFont.spritefont #begin deathAnimation.png /importer:TextureImporter @@ -37,13 +32,6 @@ /processorParam:TextureFormat=Color /build:deathAnimation.png -#begin ButtonFont.spritefont -/importer:FontDescriptionImporter -/processor:FontDescriptionProcessor -/processorParam:PremultiplyAlpha=True -/processorParam:TextureFormat=Compressed -/build:ButtonFont.spritefont - #begin DoomTestSong.mp3 /importer:Mp3Importer /processor:SoundEffectProcessor @@ -107,6 +95,18 @@ /processorParam:TextureFormat=Color /build:menuFon3.jpg +#begin MonstersAnimations.png +/importer:TextureImporter +/processor:TextureProcessor +/processorParam:ColorKeyColor=255,0,255,255 +/processorParam:ColorKeyEnabled=True +/processorParam:GenerateMipmaps=False +/processorParam:PremultiplyAlpha=True +/processorParam:ResizeToPowerOfTwo=False +/processorParam:MakeSquare=False +/processorParam:TextureFormat=Color +/build:MonstersAnimations.png + #begin PC_Computer_Dangerous_Dave_In_The_Haunted_Mansion_Death_Sequences.png /importer:TextureImporter /processor:TextureProcessor @@ -119,6 +119,18 @@ /processorParam:TextureFormat=Color /build:PC_Computer_Dangerous_Dave_In_The_Haunted_Mansion_Death_Sequences.png +#begin playerAnimation.png +/importer:TextureImporter +/processor:TextureProcessor +/processorParam:ColorKeyColor=255,0,255,255 +/processorParam:ColorKeyEnabled=True +/processorParam:GenerateMipmaps=False +/processorParam:PremultiplyAlpha=True +/processorParam:ResizeToPowerOfTwo=False +/processorParam:MakeSquare=False +/processorParam:TextureFormat=Color +/build:playerAnimation.png + #begin wall.jpg /importer:TextureImporter /processor:TextureProcessor diff --git a/DangerousD/Content/animations/playerMoveLeft b/DangerousD/Content/animations/playerMoveLeft new file mode 100644 index 0000000..404639c --- /dev/null +++ b/DangerousD/Content/animations/playerMoveLeft @@ -0,0 +1 @@ +{"id":"playerMoveLeft","textureName":"playerAnimation","startSpriteRectangle":{"X":26,"Y":1,"Width":24,"Height":32},"frameSecond":[{"Item1":0,"Item2":8}],"textureFrameInterval":1,"framesCount":4,"isCycle":true,"offset":"0, 0"} diff --git a/DangerousD/Content/animations/playerMoveRight b/DangerousD/Content/animations/playerMoveRight new file mode 100644 index 0000000..5ed3010 --- /dev/null +++ b/DangerousD/Content/animations/playerMoveRight @@ -0,0 +1 @@ +{"id":"playerMoveRight","textureName":"playerAnimation","startSpriteRectangle":{"X":26,"Y":34,"Width":24,"Height":32},"frameSecond":[{"Item1":0,"Item2":8}],"textureFrameInterval":1,"framesCount":4,"isCycle":true,"offset":"0, 0"} diff --git a/DangerousD/Content/animations/playerRightStay b/DangerousD/Content/animations/playerRightStay new file mode 100644 index 0000000..bbeb120 --- /dev/null +++ b/DangerousD/Content/animations/playerRightStay @@ -0,0 +1 @@ +{"id":"playerRightStay","textureName":"playerAnimation","startSpriteRectangle":{"X":1,"Y":1,"Width":24,"Height":32},"frameSecond":[{"Item1":0,"Item2":12}],"textureFrameInterval":1,"framesCount":1,"isCycle":true,"offset":"0, 0"} diff --git a/DangerousD/Content/animations/playerStayLeft b/DangerousD/Content/animations/playerStayLeft new file mode 100644 index 0000000..993f1e1 --- /dev/null +++ b/DangerousD/Content/animations/playerStayLeft @@ -0,0 +1 @@ +{"id":"playerStayLeft","textureName":"playerAnimation","startSpriteRectangle":{"X":1,"Y":34,"Width":24,"Height":32},"frameSecond":[{"Item1":0,"Item2":12}],"textureFrameInterval":1,"framesCount":1,"isCycle":true,"offset":"0, 0"} diff --git a/DangerousD/Content/playerAnimation.png b/DangerousD/Content/playerAnimation.png new file mode 100644 index 0000000..ed061f3 Binary files /dev/null and b/DangerousD/Content/playerAnimation.png differ diff --git a/DangerousD/GameCore/GameObjects/LivingEntities/Monsters/Zombie.cs b/DangerousD/GameCore/GameObjects/LivingEntities/Monsters/Zombie.cs index b679a37..b5402e8 100644 --- a/DangerousD/GameCore/GameObjects/LivingEntities/Monsters/Zombie.cs +++ b/DangerousD/GameCore/GameObjects/LivingEntities/Monsters/Zombie.cs @@ -25,8 +25,8 @@ namespace DangerousD.GameCore.GameObjects.LivingEntities.Monsters Height = 40; monster_speed = 3; name = "Zombie"; - leftBorder = (int)position.X - 100; - rightBorder = (int)position.X + 100; + leftBorder = (int)position.X - 50; + rightBorder = (int)position.X + 50; physicsManager = new PhysicsManager(); } protected override GraphicsComponent GraphicsComponent { get; } = new(new List { "ZombieMoveRight", "ZombieMoveLeft", "ZombieRightAttack", "ZombieLeftAttack" }, "ZombieMoveLeft"); @@ -48,9 +48,9 @@ namespace DangerousD.GameCore.GameObjects.LivingEntities.Monsters isAttaking = true; if (isGoRight) { - if (GraphicsComponent.GetCurrentAnimation != "ZombieMoveRight") + if (GraphicsComponent.GetCurrentAnimation != "ZombieRightAttack") { - GraphicsComponent.StartAnimation("ZombieAttackRight"); + GraphicsComponent.StartAnimation("ZombieRightAttack"); } AppManager.Instance.GameManager.players[0].Death(name); } @@ -71,7 +71,6 @@ namespace DangerousD.GameCore.GameObjects.LivingEntities.Monsters public override void Move(GameTime gameTime) { - float delta = (float)gameTime.ElapsedGameTime.TotalSeconds; if (isGoRight) { if (GraphicsComponent.GetCurrentAnimation != "ZombieMoveRight") diff --git a/DangerousD/GameCore/GameObjects/LivingEntities/Player/DeathRectangle.cs b/DangerousD/GameCore/GameObjects/LivingEntities/Player/DeathRectangle.cs index 1867b60..7dda1b1 100644 --- a/DangerousD/GameCore/GameObjects/LivingEntities/Player/DeathRectangle.cs +++ b/DangerousD/GameCore/GameObjects/LivingEntities/Player/DeathRectangle.cs @@ -13,8 +13,8 @@ namespace DangerousD.GameCore.GameObjects.PlayerDeath { public DeathRectangle(Vector2 pos, string DeathType) : base(pos) { - Height = 128; - Width = 128; + Height = 48; + Width = 48; PlayDeath(DeathType); } diff --git a/DangerousD/GameCore/GameObjects/LivingEntities/Player/Player.cs b/DangerousD/GameCore/GameObjects/LivingEntities/Player/Player.cs index 0122b50..df59603 100644 --- a/DangerousD/GameCore/GameObjects/LivingEntities/Player/Player.cs +++ b/DangerousD/GameCore/GameObjects/LivingEntities/Player/Player.cs @@ -12,16 +12,18 @@ namespace DangerousD.GameCore.GameObjects.LivingEntities public class Player : LivingEntity { bool isAlive = true; + bool isRight; + string stayAnimation; public Player(Vector2 position) : base(position) { - Width = 32; - Height = 64; - AppManager.Instance.InputManager.MovEventJump += AnimationJump; + Width = 24; + Height = 32; + AppManager.Instance.InputManager.MovEventJump += Jump; } public bool IsAlive { get { return isAlive; } } - protected override GraphicsComponent GraphicsComponent { get; } = new(new List { "ZombieMoveRight", "ZombieMoveLeft", "ZombieRightAttack", "ZombieLeftAttack", "DeathFromZombie" }, "ZombieMoveLeft");//TODO: Change to player + protected override GraphicsComponent GraphicsComponent { get; } = new(new List { "playerMoveLeft", "playerMoveRight", "DeathFromZombie", "playerRightStay", "playerStayLeft" }, "playerStayLeft"); public void Kill() { @@ -43,9 +45,15 @@ namespace DangerousD.GameCore.GameObjects.LivingEntities } isAlive = false; } - public void AnimationJump() + public override void Update(GameTime gameTime) + { + + base.Update(gameTime); + } + public void Jump() { velocity.Y = -300; + //сюда анимацию и доделать } } } diff --git a/DangerousD/GameCore/Levels/Level1.cs b/DangerousD/GameCore/Levels/Level1.cs index 7bf184b..7a0f8d9 100644 --- a/DangerousD/GameCore/Levels/Level1.cs +++ b/DangerousD/GameCore/Levels/Level1.cs @@ -10,8 +10,8 @@ namespace DangerousD.GameCore.Levels { public void InitLevel() { - new Player(new Vector2(80,0)); - var Zombie = new Zombie(new Vector2(250, 128)); + new Player(new Vector2(350,0)); + var Zombie = new Zombie(new Vector2(100, 128)); //var Frank = new Frank(new Vector2(384, 128)); //var Spider = new Spider(new Vector2(112, 0)); //var FlameSkull = new FlameSkull(new Vector2(512, 0)); @@ -27,7 +27,7 @@ namespace DangerousD.GameCore.Levels } new GrassBlock(new Vector2(500, 224)); Player player = new Player(new Vector2(400, 64)); - player.AnimationJump(); + player.Jump(); //new GrassBlock(new Vector2(500, 224)); }