Merge branch 'livingEntities' into livingEntitiesHunchMan

This commit is contained in:
bmvolf 2023-08-17 16:26:58 +03:00 committed by GitHub
commit 6a76f8e22a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
13 changed files with 60 additions and 36 deletions

View file

@ -13,17 +13,12 @@
#---------------------------------- Content ---------------------------------# #---------------------------------- Content ---------------------------------#
#begin MonstersAnimations.png #begin ButtonFont.spritefont
/importer:TextureImporter /importer:FontDescriptionImporter
/processor:TextureProcessor /processor:FontDescriptionProcessor
/processorParam:ColorKeyColor=255,0,255,255
/processorParam:ColorKeyEnabled=True
/processorParam:GenerateMipmaps=False
/processorParam:PremultiplyAlpha=True /processorParam:PremultiplyAlpha=True
/processorParam:ResizeToPowerOfTwo=False /processorParam:TextureFormat=Compressed
/processorParam:MakeSquare=False /build:ButtonFont.spritefont
/processorParam:TextureFormat=Color
/build:MonstersAnimations.png
#begin deathAnimation.png #begin deathAnimation.png
/importer:TextureImporter /importer:TextureImporter
@ -37,13 +32,6 @@
/processorParam:TextureFormat=Color /processorParam:TextureFormat=Color
/build:deathAnimation.png /build:deathAnimation.png
#begin ButtonFont.spritefont
/importer:FontDescriptionImporter
/processor:FontDescriptionProcessor
/processorParam:PremultiplyAlpha=True
/processorParam:TextureFormat=Compressed
/build:ButtonFont.spritefont
#begin DoomTestSong.mp3 #begin DoomTestSong.mp3
/importer:Mp3Importer /importer:Mp3Importer
/processor:SoundEffectProcessor /processor:SoundEffectProcessor
@ -107,6 +95,18 @@
/processorParam:TextureFormat=Color /processorParam:TextureFormat=Color
/build:menuFon3.jpg /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 #begin PC_Computer_Dangerous_Dave_In_The_Haunted_Mansion_Death_Sequences.png
/importer:TextureImporter /importer:TextureImporter
/processor:TextureProcessor /processor:TextureProcessor
@ -119,6 +119,18 @@
/processorParam:TextureFormat=Color /processorParam:TextureFormat=Color
/build:PC_Computer_Dangerous_Dave_In_The_Haunted_Mansion_Death_Sequences.png /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 #begin wall.jpg
/importer:TextureImporter /importer:TextureImporter
/processor:TextureProcessor /processor:TextureProcessor

View file

@ -1 +1,3 @@
{"id":"HunchmanMoveRight","textureName":"MonstersAnimations","startSpriteRectangle":{"X":1,"Y":99,"Width":24,"Height":24},"frameSecond":[{"Item1":0,"Item2":10}],"textureFrameInterval":1,"framesCount":4,"isCycle":true,"offset":"0, 0"} {"id":"HunchmanMoveRight","textureName":"MonstersAnimations","startSpriteRectangle":{"X":1,"Y":99,"Width":24,"Height":24},"frameSecond":[{"Item1":0,"Item2":10}],"textureFrameInterval":1,"framesCount":4,"isCycle":true,"offset":"0, 0"}

View file

@ -0,0 +1 @@
{"id":"playerJumpLeft","textureName":"playerAnimation","startSpriteRectangle":{"X":101,"Y":34,"Width":24,"Height":32},"frameSecond":[{"Item1":0,"Item2":12}],"textureFrameInterval":1,"framesCount":3,"isCycle":false,"offset":"0, 0"}

View file

@ -0,0 +1 @@
{"id":"playerJumpRight","textureName":"playerAnimation","startSpriteRectangle":{"X":126,"Y":1,"Width":24,"Height":32},"frameSecond":[{"Item1":0,"Item2":12}],"textureFrameInterval":1,"framesCount":3,"isCycle":false,"offset":"0, 0"}

View file

@ -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"}

View file

@ -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"}

View file

@ -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"}

View file

@ -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"}

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

View file

@ -25,8 +25,8 @@ namespace DangerousD.GameCore.GameObjects.LivingEntities.Monsters
Height = 40; Height = 40;
monster_speed = 3; monster_speed = 3;
name = "Zombie"; name = "Zombie";
leftBorder = (int)position.X - 100; leftBorder = (int)position.X - 50;
rightBorder = (int)position.X + 100; rightBorder = (int)position.X + 50;
physicsManager = new PhysicsManager(); physicsManager = new PhysicsManager();
} }
protected override GraphicsComponent GraphicsComponent { get; } = new(new List<string> { "ZombieMoveRight", "ZombieMoveLeft", "ZombieRightAttack", "ZombieLeftAttack" }, "ZombieMoveLeft"); protected override GraphicsComponent GraphicsComponent { get; } = new(new List<string> { "ZombieMoveRight", "ZombieMoveLeft", "ZombieRightAttack", "ZombieLeftAttack" }, "ZombieMoveLeft");
@ -48,9 +48,9 @@ namespace DangerousD.GameCore.GameObjects.LivingEntities.Monsters
isAttaking = true; isAttaking = true;
if (isGoRight) if (isGoRight)
{ {
if (GraphicsComponent.GetCurrentAnimation != "ZombieMoveRight") if (GraphicsComponent.GetCurrentAnimation != "ZombieRightAttack")
{ {
GraphicsComponent.StartAnimation("ZombieAttackRight"); GraphicsComponent.StartAnimation("ZombieRightAttack");
} }
AppManager.Instance.GameManager.players[0].Death(name); AppManager.Instance.GameManager.players[0].Death(name);
} }
@ -71,7 +71,6 @@ namespace DangerousD.GameCore.GameObjects.LivingEntities.Monsters
public override void Move(GameTime gameTime) public override void Move(GameTime gameTime)
{ {
float delta = (float)gameTime.ElapsedGameTime.TotalSeconds;
if (isGoRight) if (isGoRight)
{ {
if (GraphicsComponent.GetCurrentAnimation != "ZombieMoveRight") if (GraphicsComponent.GetCurrentAnimation != "ZombieMoveRight")

View file

@ -13,8 +13,8 @@ namespace DangerousD.GameCore.GameObjects.PlayerDeath
{ {
public DeathRectangle(Vector2 pos, string DeathType) : base(pos) public DeathRectangle(Vector2 pos, string DeathType) : base(pos)
{ {
Height = 128; Height = 48;
Width = 128; Width = 48;
PlayDeath(DeathType); PlayDeath(DeathType);
} }

View file

@ -12,16 +12,19 @@ namespace DangerousD.GameCore.GameObjects.LivingEntities
public class Player : LivingEntity public class Player : LivingEntity
{ {
bool isAlive = true; bool isAlive = true;
bool isRight;
string stayAnimation;
public Player(Vector2 position) : base(position) public Player(Vector2 position) : base(position)
{ {
Width = 32; Width = 24;
Height = 64; Height = 32;
AppManager.Instance.InputManager.MovEventJump += AnimationJump; AppManager.Instance.InputManager.MovEventJump += Jump;
} }
public bool IsAlive { get { return isAlive; } } public bool IsAlive { get { return isAlive; } }
protected override GraphicsComponent GraphicsComponent { get; } = new(new List<string> { "ZombieMoveRight", "ZombieMoveLeft", "ZombieRightAttack", "ZombieLeftAttack", "DeathFromZombie" }, "ZombieMoveLeft");//TODO: Change to player protected override GraphicsComponent GraphicsComponent { get; } = new(new List<string> { "playerMoveLeft", "playerMoveRight", "DeathFromZombie", "playerRightStay", "playerStayLeft",
"playerJumpRight" , "playerJumpLeft"}, "playerStayLeft");
public void Kill() public void Kill()
{ {
@ -43,9 +46,15 @@ namespace DangerousD.GameCore.GameObjects.LivingEntities
} }
isAlive = false; isAlive = false;
} }
public void AnimationJump() public override void Update(GameTime gameTime)
{
base.Update(gameTime);
}
public void Jump()
{ {
velocity.Y = -300; velocity.Y = -300;
//сюда анимацию и доделать
} }
} }
} }

View file

@ -10,10 +10,10 @@ namespace DangerousD.GameCore.Levels
{ {
public void InitLevel() public void InitLevel()
{ {
//Spider down-up
//new Player(new Vector2(80,0)); new Player(new Vector2(350,0));
//var Zombie = new Zombie(new Vector2(250, 128)); var Zombie = new Zombie(new Vector2(100, 128));
//var Frank = new Frank(new Vector2(384, 128)); //var Frank = new Frank(new Vector2(384, 128));
//var Spider = new Spider(new Vector2(112, 0)); //var Spider = new Spider(new Vector2(112, 0));
//var FlameSkull = new FlameSkull(new Vector2(512, 0)); //var FlameSkull = new FlameSkull(new Vector2(512, 0));
@ -31,10 +31,6 @@ namespace DangerousD.GameCore.Levels
new GrassBlock(new Vector2(i*32, 256)); new GrassBlock(new Vector2(i*32, 256));
} }
new GrassBlock(new Vector2(500, 224)); new GrassBlock(new Vector2(500, 224));
Player player = new Player(new Vector2(400, 64));
//player.AnimationJump();
//new GrassBlock(new Vector2(500, 224));
} }
} }
} }