monsters-main merge
This commit is contained in:
commit
086c0a94e9
19 changed files with 402 additions and 25 deletions
|
@ -1 +1 @@
|
||||||
{"id":"WolfMoveLeft","textureName":"MonstersAnimations","startSpriteRectangle":{"X":1,"Y":292,"Width":32,"Height":32},"frameSecond":[{"Item1":0,"Item2":10}],"textureFrameInterval":1,"framesCount":4,"isCycle":true,"offset":"0, 0"}
|
{"id":"WolfMoveLeft","textureName":"MonstersAnimations","startSpriteRectangle":{"X":1,"Y":291,"Width":32,"Height":32},"frameSecond":[{"Item1":0,"Item2":10}],"textureFrameInterval":1,"framesCount":4,"isCycle":true,"offset":"0, 0"}
|
||||||
|
|
|
@ -13,9 +13,13 @@ namespace DangerousD.GameCore.GameObjects.LivingEntities
|
||||||
public abstract class CoreEnemy : LivingEntity
|
public abstract class CoreEnemy : LivingEntity
|
||||||
{
|
{
|
||||||
protected int monster_health;
|
protected int monster_health;
|
||||||
protected int monster_speed;
|
protected float monster_speed = 2;
|
||||||
protected string name;
|
protected string name;
|
||||||
protected bool isAlive = true;
|
protected bool isAlive = true;
|
||||||
|
protected bool isAttack = false;
|
||||||
|
protected bool isGoRight;
|
||||||
|
protected int leftBoarder = 0;
|
||||||
|
protected int rightBoarder = 700;
|
||||||
|
|
||||||
public CoreEnemy(Vector2 position) : base(position)
|
public CoreEnemy(Vector2 position) : base(position)
|
||||||
{
|
{
|
||||||
|
@ -29,6 +33,7 @@ namespace DangerousD.GameCore.GameObjects.LivingEntities
|
||||||
public abstract void Death();
|
public abstract void Death();
|
||||||
|
|
||||||
public abstract void Attack();
|
public abstract void Attack();
|
||||||
|
public abstract void Attack(GameTime gameTime);
|
||||||
|
|
||||||
public abstract void Move(GameTime gameTime);
|
public abstract void Move(GameTime gameTime);
|
||||||
|
|
||||||
|
@ -41,5 +46,7 @@ namespace DangerousD.GameCore.GameObjects.LivingEntities
|
||||||
isAlive = false;
|
isAlive = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public abstract void Target();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,10 +18,21 @@ namespace DangerousD.GameCore.GameObjects.LivingEntities.Monsters
|
||||||
Height = 40;
|
Height = 40;
|
||||||
monster_speed = 3;
|
monster_speed = 3;
|
||||||
name = "Skull";
|
name = "Skull";
|
||||||
|
acceleration = Vector2.Zero;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override GraphicsComponent GraphicsComponent { get; } = new(new List<string> { "FlameSkullMoveRight" , "FlameSkullMoveLeft"}, "FlameSkullMoveRight");
|
protected override GraphicsComponent GraphicsComponent { get; } = new(new List<string> { "FlameSkullMoveRight" , "FlameSkullMoveLeft"}, "FlameSkullMoveRight");
|
||||||
|
|
||||||
|
public override void Update(GameTime gameTime)
|
||||||
|
{
|
||||||
|
if (!isAttack)
|
||||||
|
{
|
||||||
|
Move(gameTime);
|
||||||
|
}
|
||||||
|
|
||||||
|
base.Update(gameTime);
|
||||||
|
}
|
||||||
|
|
||||||
public override void Attack()
|
public override void Attack()
|
||||||
{
|
{
|
||||||
|
|
||||||
|
@ -34,7 +45,40 @@ namespace DangerousD.GameCore.GameObjects.LivingEntities.Monsters
|
||||||
|
|
||||||
public override void Move(GameTime gameTime)
|
public override void Move(GameTime gameTime)
|
||||||
{
|
{
|
||||||
|
if (isGoRight)
|
||||||
|
{
|
||||||
|
if (GraphicsComponent.GetCurrentAnimation != "FlameSkullMoveRight")
|
||||||
|
{
|
||||||
|
GraphicsComponent.StartAnimation("FlameSkullMoveRight");
|
||||||
|
}
|
||||||
|
velocity.X = monster_speed;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (GraphicsComponent.GetCurrentAnimation != "FlameSkullMoveLeft")
|
||||||
|
{
|
||||||
|
GraphicsComponent.StartAnimation("FlameSkullMoveLeft");
|
||||||
|
}
|
||||||
|
velocity.X = -monster_speed;
|
||||||
|
}
|
||||||
|
if (Pos.X >= rightBoarder)
|
||||||
|
{
|
||||||
|
isGoRight = false;
|
||||||
|
}
|
||||||
|
else if (Pos.X <= leftBoarder)
|
||||||
|
{
|
||||||
|
isGoRight = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void Attack(GameTime gameTime)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void Target()
|
||||||
|
{
|
||||||
|
throw new NotImplementedException();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,6 +12,7 @@ namespace DangerousD.GameCore.GameObjects.LivingEntities.Monsters
|
||||||
{
|
{
|
||||||
internal class Frank : CoreEnemy
|
internal class Frank : CoreEnemy
|
||||||
{
|
{
|
||||||
|
<<<<<<< HEAD
|
||||||
private Vector2 position;
|
private Vector2 position;
|
||||||
private bool isGoRight = false;
|
private bool isGoRight = false;
|
||||||
|
|
||||||
|
@ -23,13 +24,26 @@ namespace DangerousD.GameCore.GameObjects.LivingEntities.Monsters
|
||||||
public Frank(Vector2 position) : base(position)
|
public Frank(Vector2 position) : base(position)
|
||||||
{
|
{
|
||||||
this.position = position;
|
this.position = position;
|
||||||
|
=======
|
||||||
|
public Frank(Vector2 position) : base(position)
|
||||||
|
{
|
||||||
|
isGoRight = false;
|
||||||
|
>>>>>>> livingEntitiesVlad
|
||||||
Width = 112;
|
Width = 112;
|
||||||
Height = 160;
|
Height = 160;
|
||||||
|
leftBoarder = 50;
|
||||||
|
rightBoarder = 300;
|
||||||
GraphicsComponent.StartAnimation("FrankMoveLeft");
|
GraphicsComponent.StartAnimation("FrankMoveLeft");
|
||||||
monster_speed = 1;
|
monster_speed = 2;
|
||||||
name = "Frank";
|
name = "Frank";
|
||||||
}
|
}
|
||||||
protected override GraphicsComponent GraphicsComponent { get; } = new(new List<string> { "FrankMoveRight", "FrankMoveLeft" }, "FrankMoveRight");
|
protected override GraphicsComponent GraphicsComponent { get; } = new(new List<string> { "FrankMoveRight", "FrankMoveLeft" }, "FrankMoveLeft");
|
||||||
|
|
||||||
|
public override void Update(GameTime gameTime)
|
||||||
|
{
|
||||||
|
Move(gameTime);
|
||||||
|
base.Update(gameTime);
|
||||||
|
}
|
||||||
|
|
||||||
public override void Attack()
|
public override void Attack()
|
||||||
{
|
{
|
||||||
|
@ -43,14 +57,8 @@ namespace DangerousD.GameCore.GameObjects.LivingEntities.Monsters
|
||||||
|
|
||||||
public override void Move(GameTime gameTime)
|
public override void Move(GameTime gameTime)
|
||||||
{
|
{
|
||||||
var player = AppManager.Instance.GameManager.players[0];
|
|
||||||
if (player.Pos.X - _pos.X <= 20 || player.Pos.X - _pos.X <= -20)
|
|
||||||
{
|
|
||||||
player.Death(name);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (isGoRight)
|
if (isGoRight)
|
||||||
{
|
{
|
||||||
if (GraphicsComponent.GetCurrentAnimation != "FrankMoveRight")
|
if (GraphicsComponent.GetCurrentAnimation != "FrankMoveRight")
|
||||||
{
|
{
|
||||||
GraphicsComponent.StartAnimation("FrankMoveRight");
|
GraphicsComponent.StartAnimation("FrankMoveRight");
|
||||||
|
@ -65,6 +73,24 @@ namespace DangerousD.GameCore.GameObjects.LivingEntities.Monsters
|
||||||
}
|
}
|
||||||
velocity.X = -monster_speed;
|
velocity.X = -monster_speed;
|
||||||
}
|
}
|
||||||
|
if (Pos.X >= rightBoarder)
|
||||||
|
{
|
||||||
|
isGoRight = false;
|
||||||
|
}
|
||||||
|
else if (Pos.X <= leftBoarder)
|
||||||
|
{
|
||||||
|
isGoRight = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void Attack(GameTime gameTime)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void Target()
|
||||||
|
{
|
||||||
|
throw new NotImplementedException();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -37,6 +37,7 @@ namespace DangerousD.GameCore.GameObjects.LivingEntities.Monsters
|
||||||
|
|
||||||
public override void Update(GameTime gameTime)
|
public override void Update(GameTime gameTime)
|
||||||
{
|
{
|
||||||
|
<<<<<<< HEAD
|
||||||
if(!isAttacking)
|
if(!isAttacking)
|
||||||
{
|
{
|
||||||
Move(gameTime);
|
Move(gameTime);
|
||||||
|
@ -45,6 +46,11 @@ namespace DangerousD.GameCore.GameObjects.LivingEntities.Monsters
|
||||||
base.Update(gameTime);
|
base.Update(gameTime);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
=======
|
||||||
|
|
||||||
|
base.Update(gameTime);
|
||||||
|
}
|
||||||
|
>>>>>>> livingEntitiesVlad
|
||||||
public override void Attack()
|
public override void Attack()
|
||||||
{
|
{
|
||||||
collision = new Rectangle((int)position.X, (int)position.Y, 40, 40);
|
collision = new Rectangle((int)position.X, (int)position.Y, 40, 40);
|
||||||
|
@ -82,5 +88,15 @@ namespace DangerousD.GameCore.GameObjects.LivingEntities.Monsters
|
||||||
velocity.Y -= monster_speed;
|
velocity.Y -= monster_speed;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public override void Attack(GameTime gameTime)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void Target()
|
||||||
|
{
|
||||||
|
throw new NotImplementedException();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,16 +12,28 @@ namespace DangerousD.GameCore.GameObjects.LivingEntities.Monsters
|
||||||
{
|
{
|
||||||
public Ghost(Vector2 position) : base(position)
|
public Ghost(Vector2 position) : base(position)
|
||||||
{
|
{
|
||||||
monster_speed = 1;
|
isGoRight = true;
|
||||||
|
monster_speed = 3;
|
||||||
name = "Ghost";
|
name = "Ghost";
|
||||||
Width = 48;
|
Width = 48;
|
||||||
Height = 62;
|
Height = 62;
|
||||||
GraphicsComponent.StartAnimation("GhostSpawn");
|
GraphicsComponent.StartAnimation("GhostSpawn");
|
||||||
|
acceleration = Vector2.Zero;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override GraphicsComponent GraphicsComponent { get; } = new(new List<string> { "GhostMoveRight", "GhostMoveLeft", "GhostSpawn", "GhostAttack" }, "GhostMoveRight");
|
protected override GraphicsComponent GraphicsComponent { get; } = new(new List<string> { "GhostMoveRight", "GhostMoveLeft", "GhostSpawn", "GhostAttack" }, "GhostMoveRight");
|
||||||
|
|
||||||
|
public override void Update(GameTime gameTime)
|
||||||
|
{
|
||||||
|
if (!isAttack)
|
||||||
|
{
|
||||||
|
Move(gameTime);
|
||||||
|
}
|
||||||
|
|
||||||
|
base.Update(gameTime);
|
||||||
|
}
|
||||||
|
|
||||||
public override void Attack()
|
public override void Attack()
|
||||||
{
|
{
|
||||||
|
|
||||||
|
@ -34,7 +46,44 @@ namespace DangerousD.GameCore.GameObjects.LivingEntities.Monsters
|
||||||
|
|
||||||
public override void Move(GameTime gameTime)
|
public override void Move(GameTime gameTime)
|
||||||
{
|
{
|
||||||
|
if (isGoRight)
|
||||||
|
{
|
||||||
|
if (GraphicsComponent.GetCurrentAnimation != "GhostMoveRight")
|
||||||
|
{
|
||||||
|
GraphicsComponent.StartAnimation("GhostMoveRight");
|
||||||
|
}
|
||||||
|
velocity.X = monster_speed;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (GraphicsComponent.GetCurrentAnimation != "GhostMoveLeft")
|
||||||
|
{
|
||||||
|
GraphicsComponent.StartAnimation("GhostMoveLeft");
|
||||||
|
}
|
||||||
|
velocity.X = -monster_speed;
|
||||||
|
}
|
||||||
|
if (Pos.X >= rightBoarder)
|
||||||
|
{
|
||||||
|
isGoRight = false;
|
||||||
|
}
|
||||||
|
else if (Pos.X <= leftBoarder)
|
||||||
|
{
|
||||||
|
isGoRight = true;
|
||||||
|
}
|
||||||
|
if (true)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void Attack(GameTime gameTime)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void Target()
|
||||||
|
{
|
||||||
|
throw new NotImplementedException();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,6 +23,11 @@ namespace DangerousD.GameCore.GameObjects.LivingEntities.Monsters
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public override void Attack(GameTime gameTime)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
public override void Death()
|
public override void Death()
|
||||||
{
|
{
|
||||||
|
|
||||||
|
@ -32,5 +37,10 @@ namespace DangerousD.GameCore.GameObjects.LivingEntities.Monsters
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public override void Target()
|
||||||
|
{
|
||||||
|
throw new NotImplementedException();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,6 +27,11 @@ namespace DangerousD.GameCore.GameObjects.LivingEntities.Monsters
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public override void Attack(GameTime gameTime)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
public override void Death()
|
public override void Death()
|
||||||
{
|
{
|
||||||
|
|
||||||
|
@ -36,5 +41,10 @@ namespace DangerousD.GameCore.GameObjects.LivingEntities.Monsters
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public override void Target()
|
||||||
|
{
|
||||||
|
throw new NotImplementedException();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,7 +27,12 @@ namespace DangerousD.GameCore.GameObjects.LivingEntities.Monsters
|
||||||
|
|
||||||
public override void Attack()
|
public override void Attack()
|
||||||
{
|
{
|
||||||
throw new NotImplementedException();
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void Attack(GameTime gameTime)
|
||||||
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void Death()
|
public override void Death()
|
||||||
|
@ -55,6 +60,12 @@ namespace DangerousD.GameCore.GameObjects.LivingEntities.Monsters
|
||||||
velocity.X = monster_speed;
|
velocity.X = monster_speed;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public override void Target()
|
||||||
|
{
|
||||||
|
throw new NotImplementedException();
|
||||||
|
}
|
||||||
|
|
||||||
public override void Update(GameTime gameTime)
|
public override void Update(GameTime gameTime)
|
||||||
{
|
{
|
||||||
base.Update(gameTime);
|
base.Update(gameTime);
|
||||||
|
|
|
@ -61,6 +61,7 @@ namespace DangerousD.GameCore.GameObjects.LivingEntities.Monsters
|
||||||
}
|
}
|
||||||
currentTime++;
|
currentTime++;
|
||||||
}
|
}
|
||||||
|
<<<<<<< HEAD
|
||||||
private void SpawnAttackBall()
|
private void SpawnAttackBall()
|
||||||
{
|
{
|
||||||
for (int i = 0; i < balls.Count; i++)
|
for (int i = 0; i < balls.Count; i++)
|
||||||
|
@ -70,9 +71,17 @@ namespace DangerousD.GameCore.GameObjects.LivingEntities.Monsters
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
=======
|
||||||
|
|
||||||
|
public override void Attack(GameTime gameTime)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
>>>>>>> livingEntitiesVlad
|
||||||
public override void Death()
|
public override void Death()
|
||||||
{
|
{
|
||||||
throw new NotImplementedException();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void Move(GameTime gameTime)
|
public override void Move(GameTime gameTime)
|
||||||
|
@ -105,6 +114,12 @@ namespace DangerousD.GameCore.GameObjects.LivingEntities.Monsters
|
||||||
isGoRight = true;
|
isGoRight = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public override void Target()
|
||||||
|
{
|
||||||
|
throw new NotImplementedException();
|
||||||
|
}
|
||||||
|
|
||||||
public override void Update(GameTime gameTime)
|
public override void Update(GameTime gameTime)
|
||||||
{
|
{
|
||||||
base.Update(gameTime);
|
base.Update(gameTime);
|
||||||
|
|
|
@ -51,6 +51,7 @@ namespace DangerousD.GameCore.GameObjects.LivingEntities.Monsters
|
||||||
{
|
{
|
||||||
GraphicsComponent.StartAnimation("SlimeReadyJumpLeftBottom");
|
GraphicsComponent.StartAnimation("SlimeReadyJumpLeftBottom");
|
||||||
|
|
||||||
|
<<<<<<< HEAD
|
||||||
}
|
}
|
||||||
delay--;
|
delay--;
|
||||||
if (delay <= 0)
|
if (delay <= 0)
|
||||||
|
@ -149,6 +150,13 @@ namespace DangerousD.GameCore.GameObjects.LivingEntities.Monsters
|
||||||
spriteBatch.Draw(debugTexture, new Rectangle((int)Pos.X, (int)Pos.Y + Height, 48, 5), Color.White);
|
spriteBatch.Draw(debugTexture, new Rectangle((int)Pos.X, (int)Pos.Y + Height, 48, 5), Color.White);
|
||||||
base.Draw(spriteBatch);
|
base.Draw(spriteBatch);
|
||||||
}
|
}
|
||||||
|
=======
|
||||||
|
public override void Attack(GameTime gameTime)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
>>>>>>> livingEntitiesVlad
|
||||||
public override void Death()
|
public override void Death()
|
||||||
{
|
{
|
||||||
|
|
||||||
|
@ -233,5 +241,10 @@ namespace DangerousD.GameCore.GameObjects.LivingEntities.Monsters
|
||||||
|
|
||||||
base.Update(gameTime);
|
base.Update(gameTime);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public override void Target()
|
||||||
|
{
|
||||||
|
throw new NotImplementedException();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,6 +17,7 @@ namespace DangerousD.GameCore.GameObjects.LivingEntities.Monsters
|
||||||
protected int webLength;
|
protected int webLength;
|
||||||
protected bool isDown;
|
protected bool isDown;
|
||||||
protected bool isDownUp;
|
protected bool isDownUp;
|
||||||
|
|
||||||
public Spider(Vector2 position) : base(position)
|
public Spider(Vector2 position) : base(position)
|
||||||
{
|
{
|
||||||
isDownUp = true;
|
isDownUp = true;
|
||||||
|
@ -27,7 +28,7 @@ namespace DangerousD.GameCore.GameObjects.LivingEntities.Monsters
|
||||||
Height = 24;
|
Height = 24;
|
||||||
delay = 0;
|
delay = 0;
|
||||||
webLength = 0;
|
webLength = 0;
|
||||||
monster_speed = 1;
|
monster_speed = 2;
|
||||||
acceleration = Vector2.Zero;
|
acceleration = Vector2.Zero;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -35,6 +36,29 @@ namespace DangerousD.GameCore.GameObjects.LivingEntities.Monsters
|
||||||
|
|
||||||
public override void Update(GameTime gameTime)
|
public override void Update(GameTime gameTime)
|
||||||
{
|
{
|
||||||
|
if (!isAttack)
|
||||||
|
{
|
||||||
|
Move(gameTime);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Attack(gameTime);
|
||||||
|
}
|
||||||
|
|
||||||
|
base.Update(gameTime);
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// НИЧЕГО НЕ ДЕЛАЕТ! НУЖЕН ДЛЯ ПЕРЕОПРЕДЕЛЕНИЯ
|
||||||
|
/// </summary>
|
||||||
|
public override void Attack()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// Атака паука РАБОЧАЯ
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="gameTime"></param>
|
||||||
|
public override void Attack(GameTime gameTime)
|
||||||
|
{ //48 72
|
||||||
if (isDownUp)
|
if (isDownUp)
|
||||||
{
|
{
|
||||||
Width = 48;
|
Width = 48;
|
||||||
|
@ -46,7 +70,7 @@ namespace DangerousD.GameCore.GameObjects.LivingEntities.Monsters
|
||||||
webLength++;
|
webLength++;
|
||||||
_pos.Y += 25;
|
_pos.Y += 25;
|
||||||
web.Height = webLength * 25;
|
web.Height = webLength * 25;
|
||||||
web.SetPosition(new Vector2(_pos.X + Width / 2 - web.Width / 2, Pos.Y - 25 * webLength));
|
web.SetPosition(new Vector2(_pos.X + Width / 2 - web.Width / 2 + 2, Pos.Y - 25 * webLength));
|
||||||
delay = 0;
|
delay = 0;
|
||||||
if (webLength == 4)
|
if (webLength == 4)
|
||||||
{
|
{
|
||||||
|
@ -59,7 +83,7 @@ namespace DangerousD.GameCore.GameObjects.LivingEntities.Monsters
|
||||||
webLength--;
|
webLength--;
|
||||||
_pos.Y -= 25;
|
_pos.Y -= 25;
|
||||||
web.Height = webLength * 25;
|
web.Height = webLength * 25;
|
||||||
web.SetPosition(new Vector2(_pos.X + Width / 2 - web.Width / 2, Pos.Y - 25 * webLength));
|
web.SetPosition(new Vector2(_pos.X + Width / 2 - web.Width / 2 + 2, Pos.Y - 25 * webLength));
|
||||||
delay = 0;
|
delay = 0;
|
||||||
if (webLength == 0)
|
if (webLength == 0)
|
||||||
{
|
{
|
||||||
|
@ -72,12 +96,6 @@ namespace DangerousD.GameCore.GameObjects.LivingEntities.Monsters
|
||||||
Height = 24;
|
Height = 24;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
base.Update(gameTime);
|
|
||||||
}
|
|
||||||
public override void Attack()
|
|
||||||
{ //48 72
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void Draw(SpriteBatch spriteBatch)
|
public override void Draw(SpriteBatch spriteBatch)
|
||||||
|
@ -100,7 +118,35 @@ namespace DangerousD.GameCore.GameObjects.LivingEntities.Monsters
|
||||||
|
|
||||||
public override void Move(GameTime gameTime)
|
public override void Move(GameTime gameTime)
|
||||||
{
|
{
|
||||||
|
if (isGoRight)
|
||||||
|
{
|
||||||
|
if (GraphicsComponent.GetCurrentAnimation != "SpiderMoveRight")
|
||||||
|
{
|
||||||
|
GraphicsComponent.StartAnimation("SpiderMoveRight");
|
||||||
|
}
|
||||||
|
velocity.X = monster_speed;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (GraphicsComponent.GetCurrentAnimation != "SpiderMoveLeft")
|
||||||
|
{
|
||||||
|
GraphicsComponent.StartAnimation("SpiderMoveLeft");
|
||||||
|
}
|
||||||
|
velocity.X = -monster_speed;
|
||||||
|
}
|
||||||
|
if (Pos.X >= rightBoarder)
|
||||||
|
{
|
||||||
|
isGoRight = false;
|
||||||
|
}
|
||||||
|
else if (Pos.X <= leftBoarder)
|
||||||
|
{
|
||||||
|
isGoRight = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void Target()
|
||||||
|
{
|
||||||
|
throw new NotImplementedException();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,6 +28,11 @@ namespace DangerousD.GameCore.GameObjects.LivingEntities.Monsters
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public override void Attack(GameTime gameTime)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
public override void Death()
|
public override void Death()
|
||||||
{
|
{
|
||||||
|
|
||||||
|
@ -37,5 +42,10 @@ namespace DangerousD.GameCore.GameObjects.LivingEntities.Monsters
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public override void Target()
|
||||||
|
{
|
||||||
|
throw new NotImplementedException();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,13 +15,23 @@ namespace DangerousD.GameCore.GameObjects.LivingEntities.Monsters
|
||||||
public Werewolf(Vector2 position) : base(position)
|
public Werewolf(Vector2 position) : base(position)
|
||||||
{
|
{
|
||||||
name = "Wolf";
|
name = "Wolf";
|
||||||
monster_speed = 1;
|
monster_speed = 4;
|
||||||
Width = 78;
|
Width = 78;
|
||||||
Height = 96;
|
Height = 96;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override GraphicsComponent GraphicsComponent { get; } = new(new List<string> { "WolfMoveRight", "WolfMoveLeft", "WolfJumpRight", "WolfJumpLeft" }, "WolfMoveRight");
|
protected override GraphicsComponent GraphicsComponent { get; } = new(new List<string> { "WolfMoveRight", "WolfMoveLeft", "WolfJumpRight", "WolfJumpLeft" }, "WolfMoveRight");
|
||||||
|
|
||||||
|
public override void Update(GameTime gameTime)
|
||||||
|
{
|
||||||
|
if (!isAttack)
|
||||||
|
{
|
||||||
|
Move(gameTime);
|
||||||
|
}
|
||||||
|
|
||||||
|
base.Update(gameTime);
|
||||||
|
}
|
||||||
|
|
||||||
public override void Attack()
|
public override void Attack()
|
||||||
{
|
{
|
||||||
|
|
||||||
|
@ -34,7 +44,39 @@ namespace DangerousD.GameCore.GameObjects.LivingEntities.Monsters
|
||||||
|
|
||||||
public override void Move(GameTime gameTime)
|
public override void Move(GameTime gameTime)
|
||||||
{
|
{
|
||||||
|
if (isGoRight)
|
||||||
|
{
|
||||||
|
if (GraphicsComponent.GetCurrentAnimation != "WolfMoveRight")
|
||||||
|
{
|
||||||
|
GraphicsComponent.StartAnimation("WolfMoveRight");
|
||||||
|
}
|
||||||
|
velocity.X = monster_speed;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (GraphicsComponent.GetCurrentAnimation != "WolfMoveLeft")
|
||||||
|
{
|
||||||
|
GraphicsComponent.StartAnimation("WolfMoveLeft");
|
||||||
|
}
|
||||||
|
velocity.X = -monster_speed;
|
||||||
|
}
|
||||||
|
if (Pos.X >= rightBoarder)
|
||||||
|
{
|
||||||
|
isGoRight = false;
|
||||||
|
}
|
||||||
|
else if (Pos.X <= leftBoarder)
|
||||||
|
{
|
||||||
|
isGoRight = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void Attack(GameTime gameTime)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void Target()
|
||||||
|
{
|
||||||
|
throw new NotImplementedException();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,8 +17,12 @@ namespace DangerousD.GameCore.GameObjects.LivingEntities.Monsters
|
||||||
float leftBorder;
|
float leftBorder;
|
||||||
float rightBorder;
|
float rightBorder;
|
||||||
bool isAttaking = false;
|
bool isAttaking = false;
|
||||||
|
<<<<<<< HEAD
|
||||||
bool isTarget = false;
|
bool isTarget = false;
|
||||||
PhysicsManager physicsManager;
|
PhysicsManager physicsManager;
|
||||||
|
=======
|
||||||
|
|
||||||
|
>>>>>>> livingEntitiesVlad
|
||||||
public Zombie(Vector2 position) : base(position)
|
public Zombie(Vector2 position) : base(position)
|
||||||
{
|
{
|
||||||
Width = 24;
|
Width = 24;
|
||||||
|
@ -112,6 +116,7 @@ namespace DangerousD.GameCore.GameObjects.LivingEntities.Monsters
|
||||||
base.OnCollision(gameObject);
|
base.OnCollision(gameObject);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
<<<<<<< HEAD
|
||||||
public void Target()
|
public void Target()
|
||||||
{
|
{
|
||||||
if(AppManager.Instance.GameManager.physicsManager.CheckRectangle(new Rectangle((int)Pos.X-50, (int)Pos.Y, Width+100, Height), typeof(Player))!=null)
|
if(AppManager.Instance.GameManager.physicsManager.CheckRectangle(new Rectangle((int)Pos.X-50, (int)Pos.Y, Width+100, Height), typeof(Player))!=null)
|
||||||
|
@ -130,6 +135,16 @@ namespace DangerousD.GameCore.GameObjects.LivingEntities.Monsters
|
||||||
leftBorder = AppManager.Instance.GameManager.players[0].Pos.X;
|
leftBorder = AppManager.Instance.GameManager.players[0].Pos.X;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
=======
|
||||||
|
public override void Attack(GameTime gameTime)
|
||||||
|
{
|
||||||
|
throw new NotImplementedException();
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void Target()
|
||||||
|
{
|
||||||
|
throw new NotImplementedException();
|
||||||
|
>>>>>>> livingEntitiesVlad
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
33
DangerousD/GameCore/Levels/Level1.cs
Normal file
33
DangerousD/GameCore/Levels/Level1.cs
Normal file
|
@ -0,0 +1,33 @@
|
||||||
|
using DangerousD.GameCore.GameObjects.LivingEntities;
|
||||||
|
using DangerousD.GameCore.GameObjects.MapObjects;
|
||||||
|
using Microsoft.Xna.Framework;
|
||||||
|
using DangerousD.GameCore.GameObjects.LivingEntities.Monsters;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
|
||||||
|
namespace DangerousD.GameCore.Levels
|
||||||
|
{
|
||||||
|
public class Level1 : ILevel
|
||||||
|
{
|
||||||
|
public void InitLevel()
|
||||||
|
{
|
||||||
|
new Player(new Vector2(80,0));
|
||||||
|
var Zombie = new Zombie(new Vector2(140, 128));
|
||||||
|
var Frank = new Frank(new Vector2(300, 0));
|
||||||
|
|
||||||
|
var Spider = new Spider(new Vector2(112, 0));
|
||||||
|
var FlameSkull = new FlameSkull(new Vector2(512, 0));
|
||||||
|
var Werewolf = new Werewolf(new Vector2(640, 0));
|
||||||
|
var Ghost = new Ghost(new Vector2(300, 0));
|
||||||
|
var FrankBalls = new FrankBalls(new Vector2(Frank.Pos.X, Frank.Pos.Y));
|
||||||
|
|
||||||
|
var SilasHand = new SilasHands(new Vector2(200,64));
|
||||||
|
var SilasMaster = new SilasMaster(new Vector2(400, 64));
|
||||||
|
new GrassBlock(new Vector2(0, 224));
|
||||||
|
for (int i = 0; i < 50; i++)
|
||||||
|
{
|
||||||
|
new GrassBlock(new Vector2(i*32, 256));
|
||||||
|
}
|
||||||
|
new GrassBlock(new Vector2(500, 224));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -178,6 +178,7 @@ namespace DangerousD.GameCore
|
||||||
{
|
{
|
||||||
foreach (NetworkTask networkTask in networkTasks)
|
foreach (NetworkTask networkTask in networkTasks)
|
||||||
{
|
{
|
||||||
|
<<<<<<< HEAD
|
||||||
switch (networkTask.operation)
|
switch (networkTask.operation)
|
||||||
{
|
{
|
||||||
case NetworkTaskOperationEnum.TakeDamage:
|
case NetworkTaskOperationEnum.TakeDamage:
|
||||||
|
@ -198,6 +199,25 @@ namespace DangerousD.GameCore
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
=======
|
||||||
|
case NetworkTaskOperationEnum.TakeDamage:
|
||||||
|
break;
|
||||||
|
case NetworkTaskOperationEnum.SendSound:
|
||||||
|
// SoundManager.StartSound(networkTask.name, networkTask.position, GameManager.GetPlayer1.Pos);
|
||||||
|
break;
|
||||||
|
case NetworkTaskOperationEnum.CreateEntity:
|
||||||
|
break;
|
||||||
|
case NetworkTaskOperationEnum.SendPosition:
|
||||||
|
break;
|
||||||
|
case NetworkTaskOperationEnum.ChangeState:
|
||||||
|
break;
|
||||||
|
case NetworkTaskOperationEnum.ConnectToHost:
|
||||||
|
break;
|
||||||
|
case NetworkTaskOperationEnum.GetClientPlayerId:
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
>>>>>>> livingEntitiesVlad
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,10 +24,15 @@ namespace DangerousD.GameCore
|
||||||
public PhysicsManager physicsManager;
|
public PhysicsManager physicsManager;
|
||||||
public List<Player> players;
|
public List<Player> players;
|
||||||
public List<GameObject> otherObjects = new();
|
public List<GameObject> otherObjects = new();
|
||||||
|
|
||||||
public Player GetPlayer1 { get; private set; }
|
public Player GetPlayer1 { get; private set; }
|
||||||
public GameManager()
|
public GameManager()
|
||||||
{
|
{
|
||||||
|
<<<<<<< HEAD
|
||||||
others = new List<GameObject>();
|
others = new List<GameObject>();
|
||||||
|
=======
|
||||||
|
|
||||||
|
>>>>>>> livingEntitiesVlad
|
||||||
GetAllGameObjects = new List<GameObject>();
|
GetAllGameObjects = new List<GameObject>();
|
||||||
livingEntities = new List<LivingEntity>();
|
livingEntities = new List<LivingEntity>();
|
||||||
mapObjects = new List<MapObject>();
|
mapObjects = new List<MapObject>();
|
||||||
|
@ -43,10 +48,15 @@ namespace DangerousD.GameCore
|
||||||
|
|
||||||
internal void Register(GameObject gameObject)
|
internal void Register(GameObject gameObject)
|
||||||
{
|
{
|
||||||
|
<<<<<<< HEAD
|
||||||
|
|
||||||
|
|
||||||
GetAllGameObjects.Add(gameObject);
|
GetAllGameObjects.Add(gameObject);
|
||||||
if (gameObject is Player objPl)
|
if (gameObject is Player objPl)
|
||||||
|
=======
|
||||||
|
GetAllGameObjects.Add(gameObject);
|
||||||
|
if (gameObject is Player)
|
||||||
|
>>>>>>> livingEntitiesVlad
|
||||||
{
|
{
|
||||||
livingEntities.Add(gameObject as LivingEntity);
|
livingEntities.Add(gameObject as LivingEntity);
|
||||||
players.Add(objPl);
|
players.Add(objPl);
|
||||||
|
|
|
@ -156,6 +156,7 @@ namespace DangerousD.GameCore.Managers
|
||||||
}
|
}
|
||||||
return gameObject;
|
return gameObject;
|
||||||
}
|
}
|
||||||
|
|
||||||
public GameObject RayCast(LivingEntity entity1, Vector2 targetCast)
|
public GameObject RayCast(LivingEntity entity1, Vector2 targetCast)
|
||||||
{
|
{
|
||||||
Rectangle rectangle;
|
Rectangle rectangle;
|
||||||
|
@ -196,7 +197,6 @@ namespace DangerousD.GameCore.Managers
|
||||||
}
|
}
|
||||||
return gameObject;
|
return gameObject;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<GameObject> CheckRectangle(Rectangle rectangle, Type type)
|
public List<GameObject> CheckRectangle(Rectangle rectangle, Type type)
|
||||||
{
|
{
|
||||||
var gameObjects = AppManager.Instance.GameManager.GetAllGameObjects;
|
var gameObjects = AppManager.Instance.GameManager.GetAllGameObjects;
|
||||||
|
|
Loading…
Add table
Reference in a new issue