monstersClasses
This commit is contained in:
parent
4d8adebf69
commit
dd17d0148f
17 changed files with 44 additions and 36 deletions
|
@ -13,18 +13,6 @@
|
|||
|
||||
#---------------------------------- Content ---------------------------------#
|
||||
|
||||
#begin ../../../animation1.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:../../../animation1.png;animation1.png
|
||||
|
||||
#begin File.spritefont
|
||||
/importer:FontDescriptionImporter
|
||||
/processor:FontDescriptionProcessor
|
||||
|
|
Binary file not shown.
Before Width: | Height: | Size: 40 KiB After Width: | Height: | Size: 22 KiB |
Binary file not shown.
Before Width: | Height: | Size: 40 KiB |
|
@ -1 +1 @@
|
|||
{"id":"ZombieLeftAttack","textureName":"animation1","startSpriteRectangle":{"X":126,"Y":50,"Width":50,"Height":40},"frameSecond":[{"Item1":0,"Item2":25}],"textureFrameInterval":1,"framesCount":3,"isCycle":false,"offset":"16, 0"}
|
||||
{"id":"ZombieLeftAttack","textureName":"MonstersAnimations","startSpriteRectangle":{"X":126,"Y":50,"Width":50,"Height":40},"frameSecond":[{"Item1":0,"Item2":25}],"textureFrameInterval":1,"framesCount":3,"isCycle":false,"offset":"16, 0"}
|
||||
|
|
|
@ -1 +1 @@
|
|||
{"id":"ZombieMoveLeft","textureName":"animation1","startSpriteRectangle":{"X":1,"Y":50,"Width":24,"Height":40},"frameSecond":[{"Item1":0,"Item2":12}],"textureFrameInterval":1,"framesCount":4,"isCycle":true}
|
||||
{"id":"ZombieMoveLeft","textureName":"MonstersAnimations","startSpriteRectangle":{"X":1,"Y":50,"Width":24,"Height":40},"frameSecond":[{"Item1":0,"Item2":12}],"textureFrameInterval":1,"framesCount":4,"isCycle":true}
|
||||
|
|
|
@ -1 +1 @@
|
|||
{"id":"ZombieRightAttack","textureName":"animation1","startSpriteRectangle":{"X":126,"Y":9,"Width":50,"Height":40},"frameSecond":[{"Item1":0,"Item2":25}],"textureFrameInterval":1,"framesCount":3,"isCycle":false,"offset":"16, 0"}
|
||||
{"id":"ZombieRightAttack","textureName":"MonstersAnimations","startSpriteRectangle":{"X":126,"Y":9,"Width":50,"Height":40},"frameSecond":[{"Item1":0,"Item2":25}],"textureFrameInterval":1,"framesCount":3,"isCycle":false,"offset":"16, 0"}
|
||||
|
|
|
@ -22,7 +22,7 @@ namespace DangerousD.GameCore.GameObjects
|
|||
{
|
||||
Vector2 dir = targetPosition - Pos;
|
||||
dir.Normalize();
|
||||
Pos += dir * speed;
|
||||
_pos += dir * speed;
|
||||
}
|
||||
base.Update(gameTime);
|
||||
}
|
||||
|
|
|
@ -12,7 +12,7 @@ namespace DangerousD.GameCore
|
|||
{
|
||||
public abstract class GameObject : IDrawableObject
|
||||
{
|
||||
private Vector2 _pos;
|
||||
protected Vector2 _pos;
|
||||
public Vector2 Pos => _pos;
|
||||
public int Width { get; protected set; }
|
||||
public int Height { get; protected set; }
|
||||
|
|
|
@ -28,12 +28,15 @@ namespace DangerousD.GameCore.GameObjects.LivingEntities
|
|||
{
|
||||
Death();
|
||||
}
|
||||
|
||||
Move(gameTime, AppManager.Instance.GameManager.Player);
|
||||
|
||||
base.Update(gameTime);
|
||||
}
|
||||
public abstract void Death();
|
||||
|
||||
public abstract void Attack(Player player);
|
||||
|
||||
public abstract void Move(GameTime gameTime);
|
||||
public abstract void Move(GameTime gameTime, Player player);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -19,7 +19,7 @@ namespace DangerousD.GameCore.GameObjects.LivingEntities.Monsters
|
|||
|
||||
protected override GraphicsComponent GraphicsComponent { get; } = new(new List<string> { "FlameSkullMoveLeft", "FlameSkullMoveRight" }, "FlameSkullMoveRight");
|
||||
|
||||
public override void Attack()
|
||||
public override void Attack(Player player)
|
||||
{
|
||||
|
||||
}
|
||||
|
@ -29,7 +29,7 @@ namespace DangerousD.GameCore.GameObjects.LivingEntities.Monsters
|
|||
|
||||
}
|
||||
|
||||
public override void Move(GameTime gameTime)
|
||||
public override void Move(GameTime gameTime, Player player)
|
||||
{
|
||||
|
||||
}
|
||||
|
|
|
@ -15,14 +15,15 @@ namespace DangerousD.GameCore.GameObjects.LivingEntities.Monsters
|
|||
private bool isGoRight = false;
|
||||
public Frank(Vector2 position) : base(position)
|
||||
{
|
||||
Width = 56;
|
||||
Height = 80;
|
||||
Width = 112;
|
||||
Height = 160;
|
||||
GraphicsComponent.StartAnimation("FrankMoveLeft");
|
||||
monster_speed = 50;
|
||||
monster_speed = 1;
|
||||
name = "Фрэнк";
|
||||
}
|
||||
protected override GraphicsComponent GraphicsComponent { get; } = new(new List<string> { "FrankMoveRight", "FrankMoveLeft" }, "FrankMoveRight");
|
||||
|
||||
public override void Attack()
|
||||
public override void Attack(Player player)
|
||||
{
|
||||
|
||||
}
|
||||
|
@ -32,13 +33,19 @@ namespace DangerousD.GameCore.GameObjects.LivingEntities.Monsters
|
|||
|
||||
}
|
||||
|
||||
public override void Move(GameTime gameTime)
|
||||
public override void Move(GameTime gameTime, Player player)
|
||||
{
|
||||
/* if (player.Pos.X - _pos.X <= 20 || player.Pos.X - _pos.X <= -20)
|
||||
{
|
||||
player.Death(name);
|
||||
} */
|
||||
|
||||
if (isGoRight)
|
||||
{
|
||||
if (GraphicsComponent.GetCurrentAnimation != "FrankMoveRight")
|
||||
{
|
||||
GraphicsComponent.StartAnimation("FrankMoveRight");
|
||||
velocity = new Vector2(monster_speed, 0);
|
||||
}
|
||||
}
|
||||
else if (!isGoRight)
|
||||
|
@ -46,8 +53,18 @@ namespace DangerousD.GameCore.GameObjects.LivingEntities.Monsters
|
|||
if (GraphicsComponent.GetCurrentAnimation != "FrankMoveLeft")
|
||||
{
|
||||
GraphicsComponent.StartAnimation("FrankMoveLeft");
|
||||
velocity = new Vector2(-monster_speed, 0);
|
||||
}
|
||||
}
|
||||
|
||||
if (_pos.X <= 1)
|
||||
{
|
||||
isGoRight = true;
|
||||
}
|
||||
else if (_pos.X >= 500)
|
||||
{
|
||||
isGoRight = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -18,7 +18,7 @@ namespace DangerousD.GameCore.GameObjects.LivingEntities.Monsters
|
|||
protected override GraphicsComponent GraphicsComponent { get; } = new(new List<string> { "GhostMoveRight", "GhostMoveLeft", "GhostSpawn", "GhostAttack" }, "");
|
||||
|
||||
|
||||
public override void Attack()
|
||||
public override void Attack(Player player)
|
||||
{
|
||||
|
||||
}
|
||||
|
@ -28,7 +28,7 @@ namespace DangerousD.GameCore.GameObjects.LivingEntities.Monsters
|
|||
|
||||
}
|
||||
|
||||
public override void Move(GameTime gameTime)
|
||||
public override void Move(GameTime gameTime, Player player)
|
||||
{
|
||||
|
||||
}
|
||||
|
|
|
@ -18,7 +18,7 @@ namespace DangerousD.GameCore.GameObjects.LivingEntities.Monsters
|
|||
|
||||
protected override GraphicsComponent GraphicsComponent { get; } = new(new List<string> { "HunchmanMoveLeft", "HunchmanMoveRight", "HunchmanAttackLeft", "HunchmanAttackRight" }, "HunchmanMoveRight");
|
||||
|
||||
public override void Attack()
|
||||
public override void Attack(Player player)
|
||||
{
|
||||
|
||||
}
|
||||
|
@ -28,7 +28,7 @@ namespace DangerousD.GameCore.GameObjects.LivingEntities.Monsters
|
|||
|
||||
}
|
||||
|
||||
public override void Move(GameTime gameTime)
|
||||
public override void Move(GameTime gameTime, Player player)
|
||||
{
|
||||
|
||||
}
|
||||
|
|
|
@ -20,7 +20,7 @@ namespace DangerousD.GameCore.GameObjects.LivingEntities.Monsters
|
|||
"SlimeMoveRightBottom", "SlimeReadyJumpRightBottom", "SlimeReadyJumpRightTop", "SlimeReadyJumpLeftBottom", "SlimeReadyJumpLeftTop", "SlimeJumpRightBottom",
|
||||
"SlimeJumpRightTop", "SlimeJumpLeftBottom", "SlimeJumpLeftTop" }, "");
|
||||
|
||||
public override void Attack()
|
||||
public override void Attack(Player player)
|
||||
{
|
||||
|
||||
}
|
||||
|
@ -30,7 +30,7 @@ namespace DangerousD.GameCore.GameObjects.LivingEntities.Monsters
|
|||
|
||||
}
|
||||
|
||||
public override void Move(GameTime gameTime)
|
||||
public override void Move(GameTime gameTime, Player player)
|
||||
{
|
||||
|
||||
}
|
||||
|
|
|
@ -18,7 +18,7 @@ namespace DangerousD.GameCore.GameObjects.LivingEntities.Monsters
|
|||
|
||||
protected override GraphicsComponent GraphicsComponent { get; } = new(new List<string> { "SpiderMoveRight", "SpiderMoveLeft", "SpiderDown", "SpiderUp" }, "");
|
||||
|
||||
public override void Attack()
|
||||
public override void Attack(Player player)
|
||||
{
|
||||
|
||||
}
|
||||
|
@ -28,7 +28,7 @@ namespace DangerousD.GameCore.GameObjects.LivingEntities.Monsters
|
|||
|
||||
}
|
||||
|
||||
public override void Move(GameTime gameTime)
|
||||
public override void Move(GameTime gameTime, Player player)
|
||||
{
|
||||
|
||||
}
|
||||
|
|
|
@ -18,7 +18,7 @@ namespace DangerousD.GameCore.GameObjects.LivingEntities.Monsters
|
|||
|
||||
protected override GraphicsComponent GraphicsComponent { get; } = new(new List<string> { "WolfMoveRight", "WolfMoveLeft", "WolfJumpRight", "WolfJumpLeft" }, "");
|
||||
|
||||
public override void Attack()
|
||||
public override void Attack(Player player)
|
||||
{
|
||||
|
||||
}
|
||||
|
@ -28,7 +28,7 @@ namespace DangerousD.GameCore.GameObjects.LivingEntities.Monsters
|
|||
|
||||
}
|
||||
|
||||
public override void Move(GameTime gameTime)
|
||||
public override void Move(GameTime gameTime, Player player)
|
||||
{
|
||||
|
||||
}
|
||||
|
|
|
@ -55,7 +55,7 @@ namespace DangerousD.GameCore.GameObjects.LivingEntities.Monsters
|
|||
|
||||
}
|
||||
|
||||
public override void Move(GameTime gameTime)
|
||||
public override void Move(GameTime gameTime, Player player)
|
||||
{
|
||||
if (isGoRight)
|
||||
{
|
||||
|
|
Loading…
Add table
Reference in a new issue