diff --git a/DangerousD/Content/MonstersAnimations.png b/DangerousD/Content/MonstersAnimations.png
index 5bc9cca..97e3e11 100644
Binary files a/DangerousD/Content/MonstersAnimations.png and b/DangerousD/Content/MonstersAnimations.png differ
diff --git a/DangerousD/Content/map.tmx b/DangerousD/Content/map.tmx
new file mode 100644
index 0000000..3836987
--- /dev/null
+++ b/DangerousD/Content/map.tmx
@@ -0,0 +1,70 @@
+
+
diff --git a/DangerousD/GameCore/GUI/AbstractGui.cs b/DangerousD/GameCore/GUI/AbstractGui.cs
index 7f7b212..7248313 100644
--- a/DangerousD/GameCore/GUI/AbstractGui.cs
+++ b/DangerousD/GameCore/GUI/AbstractGui.cs
@@ -20,7 +20,6 @@ public abstract class AbstractGui : IDrawableObject
public virtual void Initialize()
{
Manager.Initialize(AppManager.Instance.GraphicsDevice);
- this.graphicsDevice = graphicsDevice;
CreateUI();
}
diff --git a/DangerousD/GameCore/GameObjects/LivingEntities/Monsters/Frank.cs b/DangerousD/GameCore/GameObjects/LivingEntities/Monsters/Frank.cs
index 8ecddcd..eab15a4 100644
--- a/DangerousD/GameCore/GameObjects/LivingEntities/Monsters/Frank.cs
+++ b/DangerousD/GameCore/GameObjects/LivingEntities/Monsters/Frank.cs
@@ -15,7 +15,6 @@ namespace DangerousD.GameCore.GameObjects.LivingEntities.Monsters
public Frank(Vector2 position) : base(position)
{
isGoRight = false;
-
Width = 112;
Height = 160;
leftBoarder = 50;
diff --git a/DangerousD/GameCore/GameObjects/LivingEntities/Monsters/FrankBalls.cs b/DangerousD/GameCore/GameObjects/LivingEntities/Monsters/FrankBalls.cs
index bc28f6b..20756b7 100644
--- a/DangerousD/GameCore/GameObjects/LivingEntities/Monsters/FrankBalls.cs
+++ b/DangerousD/GameCore/GameObjects/LivingEntities/Monsters/FrankBalls.cs
@@ -14,7 +14,6 @@ namespace DangerousD.GameCore.GameObjects.LivingEntities.Monsters
{
private Rectangle collision;
private Vector2 position;
- private int healthBall;
private bool isFlyRight = true;
private bool isAttacking = false;
diff --git a/DangerousD/GameCore/GameObjects/LivingEntities/Monsters/SilasMaster.cs b/DangerousD/GameCore/GameObjects/LivingEntities/Monsters/SilasMaster.cs
index 5dc8df2..852eab3 100644
--- a/DangerousD/GameCore/GameObjects/LivingEntities/Monsters/SilasMaster.cs
+++ b/DangerousD/GameCore/GameObjects/LivingEntities/Monsters/SilasMaster.cs
@@ -16,7 +16,6 @@ namespace DangerousD.GameCore.GameObjects.LivingEntities.Monsters
private int attackTime = 60;
private int moveTime = 360;
private int currentTime = 0;
- private bool isGoRight = true;
int leftBorder;
int rightBorder;
List hands = new List();
diff --git a/DangerousD/GameCore/GameObjects/LivingEntities/Monsters/Slime.cs b/DangerousD/GameCore/GameObjects/LivingEntities/Monsters/Slime.cs
index 0e5e954..9b59f62 100644
--- a/DangerousD/GameCore/GameObjects/LivingEntities/Monsters/Slime.cs
+++ b/DangerousD/GameCore/GameObjects/LivingEntities/Monsters/Slime.cs
@@ -12,7 +12,6 @@ namespace DangerousD.GameCore.GameObjects.LivingEntities.Monsters
{
public class Slime : CoreEnemy
{
- private bool isGoRight = true;
private bool isDown = false;
int leftBorder;
int rightBorder;
diff --git a/DangerousD/GameCore/GameObjects/LivingEntities/Monsters/Spider.cs b/DangerousD/GameCore/GameObjects/LivingEntities/Monsters/Spider.cs
index 0d797aa..dd60669 100644
--- a/DangerousD/GameCore/GameObjects/LivingEntities/Monsters/Spider.cs
+++ b/DangerousD/GameCore/GameObjects/LivingEntities/Monsters/Spider.cs
@@ -1,4 +1,5 @@
using DangerousD.GameCore.Graphics;
+using DangerousD.GameCore.Managers;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.Graphics;
@@ -17,19 +18,23 @@ namespace DangerousD.GameCore.GameObjects.LivingEntities.Monsters
protected int webLength;
protected bool isDown;
protected bool isDownUp;
+ protected PhysicsManager physicsManager;
+ protected Player player;
public Spider(Vector2 position) : base(position)
{
+ player = AppManager.Instance.GameManager.players[0];
isDownUp = true;
isDown = true;
+ physicsManager = AppManager.Instance.GameManager.physicsManager;
web = new SpiderWeb(Pos);
name = "Spider";
Width = 112;
Height = 24;
delay = 0;
webLength = 0;
- monster_speed = 2;
- acceleration = Vector2.Zero;
+ monster_speed = 3;
+ acceleration = new Vector2(0, -50);
}
protected override GraphicsComponent GraphicsComponent { get; } = new(new List { "SpiderMoveRight", "SpiderMoveLeft", "SpiderOnWeb" }, "SpiderMoveRight");
@@ -44,6 +49,7 @@ namespace DangerousD.GameCore.GameObjects.LivingEntities.Monsters
{
Attack(gameTime);
}
+ Target();
base.Update(gameTime);
}
@@ -59,45 +65,43 @@ namespace DangerousD.GameCore.GameObjects.LivingEntities.Monsters
///
public override void Attack(GameTime gameTime)
{ //48 72
- if (isDownUp)
+ velocity.X = 0;
+ Width = 48;
+ Height = 72;
+ delay += (float)gameTime.ElapsedGameTime.TotalSeconds;
+ if (delay > 0.5 && webLength <= 4 && isDown)
{
- Width = 48;
- Height = 72;
- delay += (float)gameTime.ElapsedGameTime.TotalSeconds;
- if (delay > 0.5 && webLength <= 4 && isDown)
+ StartCicycleAnimation("SpiderOnWeb");
+ acceleration = Vector2.Zero;
+ webLength++;
+ _pos.Y += 25;
+ web.Height = webLength * 25;
+ web.SetPosition(new Vector2(_pos.X + Width / 2 - web.Width / 2 + 2, Pos.Y - 25 * webLength));
+ delay = 0;
+ if (webLength == 4)
{
- StartCicycleAnimation("SpiderOnWeb");
- webLength++;
- _pos.Y += 25;
- web.Height = webLength * 25;
- web.SetPosition(new Vector2(_pos.X + Width / 2 - web.Width / 2 + 2, Pos.Y - 25 * webLength));
- delay = 0;
- if (webLength == 4)
- {
- isDown = false;
- }
- }
- else if (delay > 0.5 && webLength != 0 && !isDown)
- {
- StartCicycleAnimation("SpiderOnWeb");
- webLength--;
- _pos.Y -= 25;
- web.Height = webLength * 25;
- web.SetPosition(new Vector2(_pos.X + Width / 2 - web.Width / 2 + 2, Pos.Y - 25 * webLength));
- delay = 0;
- if (webLength == 0)
- {
- isDown = true;
- }
- }
- else
- {
- Width = 112;
- Height = 24;
+ isDown = false;
}
}
+ else if (delay > 0.5 && webLength != 0 && !isDown)
+ {
+ StartCicycleAnimation("SpiderOnWeb");
+ webLength--;
+ _pos.Y -= 25;
+ web.Height = webLength * 25;
+ web.SetPosition(new Vector2(_pos.X + Width / 2 - web.Width / 2 + 2, Pos.Y - 25 * webLength));
+ delay = 0;
+ if (webLength == 0)
+ {
+ isDown = true;
+ }
+ }
+ if (webLength == 0)
+ {
+ isAttack = false;
+ }
}
-
+ //сделать условие с Артемом
public override void Draw(SpriteBatch spriteBatch)
{
if (GraphicsComponent.GetCurrentAnimation == "SpiderOnWeb")
@@ -118,6 +122,14 @@ namespace DangerousD.GameCore.GameObjects.LivingEntities.Monsters
public override void Move(GameTime gameTime)
{
+ Width = 112;
+ Height = 24;
+
+ int wallCheck = physicsManager.CheckRectangle(new Rectangle((int)Pos.X - 10, (int)Pos.Y, 150, 10)).Count;
+ if (wallCheck > 0)
+ {
+ isGoRight = !isGoRight;
+ }
if (isGoRight)
{
if (GraphicsComponent.GetCurrentAnimation != "SpiderMoveRight")
@@ -146,7 +158,20 @@ namespace DangerousD.GameCore.GameObjects.LivingEntities.Monsters
public override void Target()
{
- throw new NotImplementedException();
+ if (physicsManager.CheckRectangle(new Rectangle((int)Pos.X, (int)Pos.Y, 300, 600), typeof(Player)) != null)
+ {
+ if (player.Pos.X - Pos.X <= 30)
+ {
+ isAttack = true;
+ }
+ }
+ if (physicsManager.CheckRectangle(new Rectangle((int)Pos.X-300, (int)Pos.Y, 300, 600), typeof(Player)) != null)
+ {
+ if (player.Pos.X - Pos.X <= 30)
+ {
+ isAttack = true;
+ }
+ }
}
}
}
diff --git a/DangerousD/GameCore/GameObjects/LivingEntities/Monsters/Zombie.cs b/DangerousD/GameCore/GameObjects/LivingEntities/Monsters/Zombie.cs
index f2dc98a..084bae9 100644
--- a/DangerousD/GameCore/GameObjects/LivingEntities/Monsters/Zombie.cs
+++ b/DangerousD/GameCore/GameObjects/LivingEntities/Monsters/Zombie.cs
@@ -111,29 +111,30 @@ namespace DangerousD.GameCore.GameObjects.LivingEntities.Monsters
}
base.OnCollision(gameObject);
}
+
public override 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)
{
- if (isGoRight && this._pos.X <= AppManager.Instance.GameManager.players[0].Pos.X)
+ if(isGoRight && this._pos.X <= AppManager.Instance.GameManager.players[0].Pos.X)
{
isTarget = true;
leftBorder = Pos.X - 10;
rightBorder = Pos.X + AppManager.Instance.GameManager.players[0].Pos.X;
}
- else if (!isGoRight && this._pos.X >= AppManager.Instance.GameManager.players[0].Pos.X)
+ else if(!isGoRight && this._pos.X >= AppManager.Instance.GameManager.players[0].Pos.X)
{
isTarget = true;
rightBorder = Pos.X + 10;
- 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();
}
-
}
}
diff --git a/DangerousD/GameCore/GameObjects/LivingEntities/Player/Player.cs b/DangerousD/GameCore/GameObjects/LivingEntities/Player/Player.cs
index 6e1af79..d7d84a8 100644
--- a/DangerousD/GameCore/GameObjects/LivingEntities/Player/Player.cs
+++ b/DangerousD/GameCore/GameObjects/LivingEntities/Player/Player.cs
@@ -49,7 +49,7 @@ namespace DangerousD.GameCore.GameObjects.LivingEntities
public override void Update(GameTime gameTime)
{
GraphicsComponent.CameraPosition = (_pos-new Vector2(200, 350)).ToPoint();
- velocity.X = 0.5f;
+ velocity.X = 1;
base.Update(gameTime);
}
}
diff --git a/DangerousD/GameCore/GameObjects/LivingEntity.cs b/DangerousD/GameCore/GameObjects/LivingEntity.cs
index 5620568..e72b40b 100644
--- a/DangerousD/GameCore/GameObjects/LivingEntity.cs
+++ b/DangerousD/GameCore/GameObjects/LivingEntity.cs
@@ -5,8 +5,6 @@ namespace DangerousD.GameCore.GameObjects;
public abstract class LivingEntity : Entity
{
private Vector2 targetPosition;
- public Vector2 velocity;
- public Vector2 acceleration;
public LivingEntity(Vector2 position) : base(position)
{
acceleration = new Vector2(0, 30);
diff --git a/DangerousD/GameCore/Managers/AppManager.cs b/DangerousD/GameCore/Managers/AppManager.cs
index 3379b3c..cbf4c84 100644
--- a/DangerousD/GameCore/Managers/AppManager.cs
+++ b/DangerousD/GameCore/Managers/AppManager.cs
@@ -165,7 +165,7 @@ namespace DangerousD.GameCore
case GameState.Lobby:
break;
case GameState.Game:
- GameManager.mapManager.LoadLevel("lvl");
+ GameManager.mapManager.LoadLevel("map");
break;
case GameState.GameOver:
break;
diff --git a/DangerousD/GameCore/Managers/MapManager.cs b/DangerousD/GameCore/Managers/MapManager.cs
index 5d7d6fc..cf994b4 100644
--- a/DangerousD/GameCore/Managers/MapManager.cs
+++ b/DangerousD/GameCore/Managers/MapManager.cs
@@ -64,7 +64,7 @@ namespace DangerousD.GameCore.Managers
{
if (tiles[i] != 0)
{
- Vector2 pos = new(((chunkX+ i % chunkW) * tileSize.X + offsetX) * _scale,
+ Vector2 pos = new(((chunkX+ i % chunkW) * tileSize.X + offsetX) * _scale + 370,
((chunkY + i / chunkW) * tileSize.Y + offsetY) * _scale);
//pos *= _scale;
Rectangle sourceRect = new(new Point((tiles[i] -1) % _columns, (tiles[i] -1) / _columns) * tileSize.ToPoint(), tileSize.ToPoint());
@@ -106,7 +106,7 @@ namespace DangerousD.GameCore.Managers
foreach (XmlNode entity in group.ChildNodes)
{
Type type = Type.GetType($"DangerousD.GameCore.GameObjects.{entityType}");
- Entity inst = (Entity)Activator.CreateInstance(type, new Vector2(float.Parse(entity.Attributes["x"].Value, CultureInfo.InvariantCulture) + offsetX, float.Parse(entity.Attributes["y"].Value, CultureInfo.InvariantCulture) + offsetY) * _scale);
+ Entity inst = (Entity)Activator.CreateInstance(type, new Vector2(float.Parse(entity.Attributes["x"].Value, CultureInfo.InvariantCulture) + offsetX+280, float.Parse(entity.Attributes["y"].Value, CultureInfo.InvariantCulture) + offsetY - 200) * _scale);
inst.SetPosition(new Vector2(inst.Pos.X, inst.Pos.Y - inst.Height));
inst.Height *= _scale;
inst.Width *= _scale;