little changes
This commit is contained in:
parent
d7312c4c62
commit
a21ef22451
18 changed files with 250 additions and 36 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,12 +13,13 @@ namespace DangerousD.GameCore.GameObjects.LivingEntities
|
|||
public abstract class CoreEnemy : LivingEntity
|
||||
{
|
||||
protected int monster_health;
|
||||
protected int monster_speed;
|
||||
protected float monster_speed = 2;
|
||||
protected string name;
|
||||
protected bool isAlive = true;
|
||||
protected bool isAttack;
|
||||
protected int leftBoarder;
|
||||
protected int rightBoarder;
|
||||
protected bool isAttack = false;
|
||||
protected bool isGoRight;
|
||||
protected int leftBoarder = 0;
|
||||
protected int rightBoarder = 700;
|
||||
|
||||
public CoreEnemy(Vector2 position) : base(position)
|
||||
{
|
||||
|
@ -32,6 +33,7 @@ namespace DangerousD.GameCore.GameObjects.LivingEntities
|
|||
public abstract void Death();
|
||||
|
||||
public abstract void Attack();
|
||||
public abstract void Attack(GameTime gameTime);
|
||||
|
||||
public abstract void Move(GameTime gameTime);
|
||||
|
||||
|
@ -44,5 +46,7 @@ namespace DangerousD.GameCore.GameObjects.LivingEntities
|
|||
isAlive = false;
|
||||
}
|
||||
}
|
||||
|
||||
public abstract void Target();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -18,10 +18,21 @@ namespace DangerousD.GameCore.GameObjects.LivingEntities.Monsters
|
|||
Height = 40;
|
||||
monster_speed = 3;
|
||||
name = "Skull";
|
||||
acceleration = Vector2.Zero;
|
||||
}
|
||||
|
||||
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()
|
||||
{
|
||||
|
||||
|
@ -33,6 +44,34 @@ namespace DangerousD.GameCore.GameObjects.LivingEntities.Monsters
|
|||
}
|
||||
|
||||
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)
|
||||
{
|
||||
|
||||
}
|
||||
|
|
|
@ -12,21 +12,24 @@ namespace DangerousD.GameCore.GameObjects.LivingEntities.Monsters
|
|||
{
|
||||
internal class Frank : CoreEnemy
|
||||
{
|
||||
private bool isGoRight = false;
|
||||
private int leftBoarder;
|
||||
private int rightBoarder;
|
||||
|
||||
public Frank(Vector2 position) : base(position)
|
||||
{
|
||||
isGoRight = false;
|
||||
Width = 112;
|
||||
Height = 160;
|
||||
leftBoarder = 50;
|
||||
rightBoarder = 500;
|
||||
rightBoarder = 300;
|
||||
GraphicsComponent.StartAnimation("FrankMoveLeft");
|
||||
monster_speed = 1;
|
||||
monster_speed = 2;
|
||||
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()
|
||||
{
|
||||
|
@ -40,12 +43,6 @@ namespace DangerousD.GameCore.GameObjects.LivingEntities.Monsters
|
|||
|
||||
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 (GraphicsComponent.GetCurrentAnimation != "FrankMoveRight")
|
||||
|
@ -62,6 +59,19 @@ namespace DangerousD.GameCore.GameObjects.LivingEntities.Monsters
|
|||
}
|
||||
velocity.X = -monster_speed;
|
||||
}
|
||||
if (Pos.X >= rightBoarder)
|
||||
{
|
||||
isGoRight = false;
|
||||
}
|
||||
else if (Pos.X <= leftBoarder)
|
||||
{
|
||||
isGoRight = true;
|
||||
}
|
||||
}
|
||||
|
||||
public override void Attack(GameTime gameTime)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -42,5 +42,10 @@ namespace DangerousD.GameCore.GameObjects.LivingEntities.Monsters
|
|||
{
|
||||
|
||||
}
|
||||
|
||||
public override void Attack(GameTime gameTime)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -12,16 +12,28 @@ namespace DangerousD.GameCore.GameObjects.LivingEntities.Monsters
|
|||
{
|
||||
public Ghost(Vector2 position) : base(position)
|
||||
{
|
||||
monster_speed = 1;
|
||||
isGoRight = true;
|
||||
monster_speed = 3;
|
||||
name = "Ghost";
|
||||
Width = 48;
|
||||
Height = 62;
|
||||
GraphicsComponent.StartAnimation("GhostSpawn");
|
||||
acceleration = Vector2.Zero;
|
||||
|
||||
}
|
||||
|
||||
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()
|
||||
{
|
||||
|
||||
|
@ -33,6 +45,38 @@ namespace DangerousD.GameCore.GameObjects.LivingEntities.Monsters
|
|||
}
|
||||
|
||||
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)
|
||||
{
|
||||
|
||||
}
|
||||
|
|
|
@ -23,6 +23,11 @@ namespace DangerousD.GameCore.GameObjects.LivingEntities.Monsters
|
|||
|
||||
}
|
||||
|
||||
public override void Attack(GameTime gameTime)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public override void Death()
|
||||
{
|
||||
|
||||
|
|
|
@ -27,6 +27,11 @@ namespace DangerousD.GameCore.GameObjects.LivingEntities.Monsters
|
|||
|
||||
}
|
||||
|
||||
public override void Attack(GameTime gameTime)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public override void Death()
|
||||
{
|
||||
|
||||
|
|
|
@ -27,7 +27,12 @@ namespace DangerousD.GameCore.GameObjects.LivingEntities.Monsters
|
|||
|
||||
public override void Attack()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
|
||||
}
|
||||
|
||||
public override void Attack(GameTime gameTime)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public override void Death()
|
||||
|
|
|
@ -39,9 +39,14 @@ namespace DangerousD.GameCore.GameObjects.LivingEntities.Monsters
|
|||
currentTime++;
|
||||
}
|
||||
|
||||
public override void Attack(GameTime gameTime)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public override void Death()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
|
||||
}
|
||||
|
||||
public override void Move(GameTime gameTime)
|
||||
|
|
|
@ -25,6 +25,11 @@ namespace DangerousD.GameCore.GameObjects.LivingEntities.Monsters
|
|||
|
||||
}
|
||||
|
||||
public override void Attack(GameTime gameTime)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public override void Death()
|
||||
{
|
||||
|
||||
|
|
|
@ -28,7 +28,7 @@ namespace DangerousD.GameCore.GameObjects.LivingEntities.Monsters
|
|||
Height = 24;
|
||||
delay = 0;
|
||||
webLength = 0;
|
||||
monster_speed = 1;
|
||||
monster_speed = 2;
|
||||
acceleration = Vector2.Zero;
|
||||
}
|
||||
|
||||
|
@ -36,6 +36,29 @@ namespace DangerousD.GameCore.GameObjects.LivingEntities.Monsters
|
|||
|
||||
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)
|
||||
{
|
||||
Width = 48;
|
||||
|
@ -73,12 +96,6 @@ namespace DangerousD.GameCore.GameObjects.LivingEntities.Monsters
|
|||
Height = 24;
|
||||
}
|
||||
}
|
||||
|
||||
base.Update(gameTime);
|
||||
}
|
||||
public override void Attack()
|
||||
{ //48 72
|
||||
|
||||
}
|
||||
|
||||
public override void Draw(SpriteBatch spriteBatch)
|
||||
|
@ -101,7 +118,32 @@ namespace DangerousD.GameCore.GameObjects.LivingEntities.Monsters
|
|||
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -28,6 +28,11 @@ namespace DangerousD.GameCore.GameObjects.LivingEntities.Monsters
|
|||
|
||||
}
|
||||
|
||||
public override void Attack(GameTime gameTime)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public override void Death()
|
||||
{
|
||||
|
||||
|
|
|
@ -15,13 +15,23 @@ namespace DangerousD.GameCore.GameObjects.LivingEntities.Monsters
|
|||
public Werewolf(Vector2 position) : base(position)
|
||||
{
|
||||
name = "Wolf";
|
||||
monster_speed = 1;
|
||||
monster_speed = 4;
|
||||
Width = 78;
|
||||
Height = 96;
|
||||
}
|
||||
|
||||
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()
|
||||
{
|
||||
|
||||
|
@ -34,7 +44,34 @@ namespace DangerousD.GameCore.GameObjects.LivingEntities.Monsters
|
|||
|
||||
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)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -107,5 +107,10 @@ namespace DangerousD.GameCore.GameObjects.LivingEntities.Monsters
|
|||
}
|
||||
base.OnCollision(gameObject);
|
||||
}
|
||||
|
||||
public override void Attack(GameTime gameTime)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -12,15 +12,13 @@ namespace DangerousD.GameCore.Levels
|
|||
{
|
||||
new Player(new Vector2(80,0));
|
||||
var Zombie = new Zombie(new Vector2(140, 128));
|
||||
var Frank = new Frank(new Vector2(384, 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(730, 0));
|
||||
var Frank = new Frank(new Vector2(100, 64));
|
||||
var Ghost = new Ghost(new Vector2(300, 0));
|
||||
var FrankBalls = new FrankBalls(new Vector2(Frank.Pos.X, Frank.Pos.Y));
|
||||
var Zombie = new Zombie(new Vector2(300, 64));
|
||||
|
||||
var SilasHand = new SilasHands(new Vector2(200,64));
|
||||
var SilasMaster = new SilasMaster(new Vector2(400, 64));
|
||||
|
|
|
@ -21,7 +21,6 @@ namespace DangerousD.GameCore
|
|||
public List<Player> players;
|
||||
public List<GameObject> otherObjects = new();
|
||||
|
||||
public List<GameObject> GetAllGameObjects { get; private set; }
|
||||
public Player GetPlayer1 { get; private set; }
|
||||
public GameManager()
|
||||
{
|
||||
|
|
|
@ -170,6 +170,7 @@ namespace DangerousD.GameCore.Managers
|
|||
|
||||
return null;
|
||||
}
|
||||
|
||||
public GameObject RayCast(LivingEntity entity1, Vector2 targetCast)
|
||||
{
|
||||
Rectangle rectangle;
|
||||
|
|
Loading…
Add table
Reference in a new issue