Merge branch 'main' of https://github.com/progtime-net/DangerousD
This commit is contained in:
commit
1b9197038b
18 changed files with 92 additions and 36 deletions
Binary file not shown.
Before Width: | Height: | Size: 24 KiB After Width: | Height: | Size: 22 KiB |
|
@ -1 +1 @@
|
||||||
{"id":"HunchmanAttackLeft","textureName":"MonstersAnimations","startSpriteRectangle":{"X":101,"Y":124,"Width":40,"Height":24},"frameSecond":[{"Item1":0,"Item2":10}],"textureFrameInterval":1,"framesCount":3,"isCycle":true,"offset":"0, 0"}
|
{"id":"HunchmanAttackLeft","textureName":"MonstersAnimations","startSpriteRectangle":{"X":112,"Y":124,"Width":27,"Height":24},"frameSecond":[{"Item1":0,"Item2":8}],"textureFrameInterval":1,"framesCount":3,"isCycle":true,"offset":"4, 0"}
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
{"id":"HunchmanAttackRight","textureName":"MonstersAnimations","startSpriteRectangle":{"X":101,"Y":99,"Width":40,"Height":24},"frameSecond":[{"Item1":0,"Item2":10}],"textureFrameInterval":1,"framesCount":3,"isCycle":true,"offset":"0, 0"}
|
{"id":"HunchmanAttackRight","textureName":"MonstersAnimations","startSpriteRectangle":{"X":102,"Y":99,"Width":31,"Height":24},"frameSecond":[{"Item1":0,"Item2":8}],"textureFrameInterval":1,"framesCount":3,"isCycle":true,"offset":"8, 0"}
|
||||||
|
|
|
@ -1,3 +1 @@
|
||||||
|
{"id":"HunchmanMoveRight","textureName":"MonstersAnimations","startSpriteRectangle":{"X":1,"Y":100,"Width":24,"Height":23},"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"}
|
|
||||||
|
|
||||||
|
|
|
@ -62,14 +62,17 @@
|
||||||
</object>
|
</object>
|
||||||
</objectgroup>
|
</objectgroup>
|
||||||
<objectgroup id="5" name="Zombies" class="LivingEntities.Monsters.Spider">
|
<objectgroup id="5" name="Zombies" class="LivingEntities.Monsters.Spider">
|
||||||
<object id="4" x="1" y="100">
|
<object id="4" x="-80" y="100">
|
||||||
<point/>
|
<point/>
|
||||||
</object>
|
</object>
|
||||||
</objectgroup>
|
</objectgroup>
|
||||||
|
<<<<<<< HEAD
|
||||||
|
=======
|
||||||
<objectgroup id="2" name="Слой объектов 1" class="LivingEntities.Monsters.Slime">
|
<objectgroup id="2" name="Слой объектов 1" class="LivingEntities.Monsters.Slime">
|
||||||
<object id="5" x="1" y="100">
|
<object id="5" x="1" y="100">
|
||||||
<point/>
|
<point/>
|
||||||
</object>
|
</object>
|
||||||
</objectgroup>
|
</objectgroup>
|
||||||
|
>>>>>>> ea55e2b4f2b2b9af627579f3c4b82bdf0171d80b
|
||||||
|
|
||||||
</map>
|
</map>
|
||||||
|
|
|
@ -19,7 +19,11 @@ public abstract class AbstractGui : IDrawableObject
|
||||||
private GraphicsDevice graphicsDevice;
|
private GraphicsDevice graphicsDevice;
|
||||||
public virtual void Initialize()
|
public virtual void Initialize()
|
||||||
{
|
{
|
||||||
|
<<<<<<< HEAD
|
||||||
Manager.Initialize(AppManager.Instance.GraphicsDevice);
|
Manager.Initialize(AppManager.Instance.GraphicsDevice);
|
||||||
|
=======
|
||||||
|
Manager.Initialize(AppManager.Instance.GraphicsDevice);
|
||||||
|
>>>>>>> ea55e2b4f2b2b9af627579f3c4b82bdf0171d80b
|
||||||
CreateUI();
|
CreateUI();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -17,7 +17,7 @@ namespace DangerousD.GameCore.GameObjects.LivingEntities
|
||||||
protected string name;
|
protected string name;
|
||||||
protected bool isAlive = true;
|
protected bool isAlive = true;
|
||||||
protected int leftBoarder = 0;
|
protected int leftBoarder = 0;
|
||||||
protected int rightBoarder = 700;
|
protected int rightBoarder = 800;
|
||||||
|
|
||||||
public CoreEnemy(Vector2 position) : base(position)
|
public CoreEnemy(Vector2 position) : base(position)
|
||||||
{
|
{
|
||||||
|
|
|
@ -17,7 +17,6 @@ namespace DangerousD.GameCore.GameObjects.LivingEntities.Monsters
|
||||||
public Frank(Vector2 position) : base(position)
|
public Frank(Vector2 position) : base(position)
|
||||||
{
|
{
|
||||||
isGoRight = false;
|
isGoRight = false;
|
||||||
|
|
||||||
Width = 112;
|
Width = 112;
|
||||||
Height = 160;
|
Height = 160;
|
||||||
leftBoarder = 50;
|
leftBoarder = 50;
|
||||||
|
|
|
@ -14,7 +14,6 @@ namespace DangerousD.GameCore.GameObjects.LivingEntities.Monsters
|
||||||
{
|
{
|
||||||
private Rectangle collision;
|
private Rectangle collision;
|
||||||
private Vector2 position;
|
private Vector2 position;
|
||||||
private int healthBall;
|
|
||||||
private bool isFlyRight = true;
|
private bool isFlyRight = true;
|
||||||
private bool isAttacking = false;
|
private bool isAttacking = false;
|
||||||
|
|
||||||
|
|
|
@ -16,7 +16,6 @@ namespace DangerousD.GameCore.GameObjects.LivingEntities.Monsters
|
||||||
private int attackTime = 60;
|
private int attackTime = 60;
|
||||||
private int moveTime = 360;
|
private int moveTime = 360;
|
||||||
private int currentTime = 0;
|
private int currentTime = 0;
|
||||||
private bool isGoRight = true;
|
|
||||||
int leftBorder;
|
int leftBorder;
|
||||||
int rightBorder;
|
int rightBorder;
|
||||||
List<SilasHands> hands = new List<SilasHands>();
|
List<SilasHands> hands = new List<SilasHands>();
|
||||||
|
|
|
@ -12,7 +12,6 @@ namespace DangerousD.GameCore.GameObjects.LivingEntities.Monsters
|
||||||
{
|
{
|
||||||
public class Slime : CoreEnemy
|
public class Slime : CoreEnemy
|
||||||
{
|
{
|
||||||
private bool isGoRight = true;
|
|
||||||
private bool isDown = false;
|
private bool isDown = false;
|
||||||
int leftBorder;
|
int leftBorder;
|
||||||
int rightBorder;
|
int rightBorder;
|
||||||
|
|
|
@ -1,4 +1,6 @@
|
||||||
using DangerousD.GameCore.Graphics;
|
using DangerousD.GameCore.GameObjects.MapObjects;
|
||||||
|
using DangerousD.GameCore.Graphics;
|
||||||
|
using DangerousD.GameCore.Managers;
|
||||||
using Microsoft.Xna.Framework;
|
using Microsoft.Xna.Framework;
|
||||||
using Microsoft.Xna.Framework.Content;
|
using Microsoft.Xna.Framework.Content;
|
||||||
using Microsoft.Xna.Framework.Graphics;
|
using Microsoft.Xna.Framework.Graphics;
|
||||||
|
@ -20,19 +22,24 @@ namespace DangerousD.GameCore.GameObjects.LivingEntities.Monsters
|
||||||
protected int webLength;
|
protected int webLength;
|
||||||
protected bool isDown;
|
protected bool isDown;
|
||||||
protected bool isDownUp;
|
protected bool isDownUp;
|
||||||
|
protected PhysicsManager physicsManager;
|
||||||
|
protected Player player;
|
||||||
|
|
||||||
public Spider(Vector2 position) : base(position)
|
public Spider(Vector2 position) : base(position)
|
||||||
{
|
{
|
||||||
|
player = AppManager.Instance.GameManager.players[0];
|
||||||
isDownUp = true;
|
isDownUp = true;
|
||||||
isDown = true;
|
isDown = true;
|
||||||
|
physicsManager = AppManager.Instance.GameManager.physicsManager;
|
||||||
web = new SpiderWeb(Pos);
|
web = new SpiderWeb(Pos);
|
||||||
name = "Spider";
|
name = "Spider";
|
||||||
Width = 112;
|
Width = 112;
|
||||||
Height = 24;
|
Height = 24;
|
||||||
delay = 0;
|
delay = 0;
|
||||||
webLength = 0;
|
webLength = 0;
|
||||||
monster_speed = 2;
|
monster_speed = 3;
|
||||||
acceleration = Vector2.Zero;
|
acceleration = new Vector2(0, -50);
|
||||||
|
isGoRight = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override GraphicsComponent GraphicsComponent { get; } = new(new List<string> { "SpiderMoveRight", "SpiderMoveLeft", "SpiderOnWeb" }, "SpiderMoveRight");
|
protected override GraphicsComponent GraphicsComponent { get; } = new(new List<string> { "SpiderMoveRight", "SpiderMoveLeft", "SpiderOnWeb" }, "SpiderMoveRight");
|
||||||
|
@ -47,6 +54,7 @@ namespace DangerousD.GameCore.GameObjects.LivingEntities.Monsters
|
||||||
{
|
{
|
||||||
Attack(gameTime);
|
Attack(gameTime);
|
||||||
}
|
}
|
||||||
|
Target();
|
||||||
|
|
||||||
base.Update(gameTime);
|
base.Update(gameTime);
|
||||||
}
|
}
|
||||||
|
@ -62,18 +70,20 @@ namespace DangerousD.GameCore.GameObjects.LivingEntities.Monsters
|
||||||
/// <param name="gameTime"></param>
|
/// <param name="gameTime"></param>
|
||||||
public void Attack(GameTime gameTime)
|
public void Attack(GameTime gameTime)
|
||||||
{ //48 72
|
{ //48 72
|
||||||
if (isDownUp)
|
velocity.X = 0;
|
||||||
|
delay += (float)gameTime.ElapsedGameTime.TotalSeconds;
|
||||||
|
if (isAttack)
|
||||||
|
{
|
||||||
|
if (delay > 0.5 && webLength <= 4 && isDown)
|
||||||
{
|
{
|
||||||
Width = 48;
|
Width = 48;
|
||||||
Height = 72;
|
Height = 72;
|
||||||
delay += (float)gameTime.ElapsedGameTime.TotalSeconds;
|
|
||||||
if (delay > 0.5 && webLength <= 4 && isDown)
|
|
||||||
{
|
|
||||||
StartCicycleAnimation("SpiderOnWeb");
|
StartCicycleAnimation("SpiderOnWeb");
|
||||||
|
acceleration = Vector2.Zero;
|
||||||
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 + 2, Pos.Y - 25 * webLength));
|
web.SetPosition(new Vector2(_pos.X + Width / 2 - web.Width / 2, Pos.Y - 25 * webLength));
|
||||||
delay = 0;
|
delay = 0;
|
||||||
if (webLength == 4)
|
if (webLength == 4)
|
||||||
{
|
{
|
||||||
|
@ -82,24 +92,36 @@ namespace DangerousD.GameCore.GameObjects.LivingEntities.Monsters
|
||||||
}
|
}
|
||||||
else if (delay > 0.5 && webLength != 0 && !isDown)
|
else if (delay > 0.5 && webLength != 0 && !isDown)
|
||||||
{
|
{
|
||||||
|
Width = 48;
|
||||||
|
Height = 72;
|
||||||
StartCicycleAnimation("SpiderOnWeb");
|
StartCicycleAnimation("SpiderOnWeb");
|
||||||
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 + 2, Pos.Y - 25 * webLength));
|
web.SetPosition(new Vector2(_pos.X + Width / 2 - web.Width / 2, Pos.Y - 25 * webLength));
|
||||||
delay = 0;
|
delay = 0;
|
||||||
if (webLength == 0)
|
if (webLength == 0)
|
||||||
{
|
{
|
||||||
isDown = true;
|
isDown = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
var entitiesInter = physicsManager.CheckRectangle(new Rectangle((int)Pos.X, (int)Pos.Y, 200, 600));
|
||||||
|
if (entitiesInter.Count > 0)
|
||||||
{
|
{
|
||||||
Width = 112;
|
foreach (var entity in entitiesInter)
|
||||||
Height = 24;
|
{
|
||||||
|
if (entity.GetType() == typeof(Player))
|
||||||
|
{
|
||||||
|
player.Death(name);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
if (webLength == 0)
|
||||||
|
{
|
||||||
|
isAttack = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public override void Draw(SpriteBatch spriteBatch)
|
public override void Draw(SpriteBatch spriteBatch)
|
||||||
{
|
{
|
||||||
|
@ -121,6 +143,15 @@ namespace DangerousD.GameCore.GameObjects.LivingEntities.Monsters
|
||||||
|
|
||||||
public override void Move(GameTime gameTime)
|
public override void Move(GameTime gameTime)
|
||||||
{
|
{
|
||||||
|
Width = 112;
|
||||||
|
Height = 24;
|
||||||
|
foreach (var entity in physicsManager.CheckRectangle(new Rectangle((int)Pos.X - 7, (int)Pos.Y, 126, 10)))
|
||||||
|
{
|
||||||
|
if (entity.GetType() == typeof(StopTile))
|
||||||
|
{
|
||||||
|
isGoRight = !isGoRight;
|
||||||
|
}
|
||||||
|
}
|
||||||
if (isGoRight)
|
if (isGoRight)
|
||||||
{
|
{
|
||||||
if (GraphicsComponent.GetCurrentAnimation != "SpiderMoveRight")
|
if (GraphicsComponent.GetCurrentAnimation != "SpiderMoveRight")
|
||||||
|
@ -137,19 +168,14 @@ 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 void Target()
|
public void Target()
|
||||||
{
|
{
|
||||||
throw new NotImplementedException();
|
if (player.Pos.X >= Pos.X && player.Pos.X <= Pos.X+Width)
|
||||||
|
{
|
||||||
|
isAttack = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -128,7 +128,12 @@ namespace DangerousD.GameCore.GameObjects.LivingEntities.Monsters
|
||||||
}
|
}
|
||||||
base.OnCollision(gameObject);
|
base.OnCollision(gameObject);
|
||||||
}
|
}
|
||||||
|
<<<<<<< HEAD
|
||||||
|
|
||||||
|
public override void Target()
|
||||||
|
=======
|
||||||
public void Target()
|
public void Target()
|
||||||
|
>>>>>>> ea55e2b4f2b2b9af627579f3c4b82bdf0171d80b
|
||||||
{
|
{
|
||||||
if (AppManager.Instance.GameManager.physicsManager.CheckRectangle(new Rectangle((int)Pos.X - 50, (int)Pos.Y, Width + 100, Height), typeof(Player)).Count > 0)
|
if (AppManager.Instance.GameManager.physicsManager.CheckRectangle(new Rectangle((int)Pos.X - 50, (int)Pos.Y, Width + 100, Height), typeof(Player)).Count > 0)
|
||||||
{
|
{
|
||||||
|
@ -159,6 +164,9 @@ namespace DangerousD.GameCore.GameObjects.LivingEntities.Monsters
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
<<<<<<< HEAD
|
||||||
|
public override void Attack(GameTime gameTime) { }
|
||||||
|
=======
|
||||||
public void Attack(GameTime gameTime)
|
public void Attack(GameTime gameTime)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
@ -172,5 +180,6 @@ namespace DangerousD.GameCore.GameObjects.LivingEntities.Monsters
|
||||||
Death();
|
Death();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
>>>>>>> ea55e2b4f2b2b9af627579f3c4b82bdf0171d80b
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -107,6 +107,17 @@ namespace DangerousD.GameCore.GameObjects.LivingEntities
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
else if(monsterName == "Spider")
|
||||||
|
{
|
||||||
|
DeathRectangle deathRectangle = new DeathRectangle(Pos, "DeathFrom" + monsterName);
|
||||||
|
deathRectangle.Gr.actionOfAnimationEnd += (a) =>
|
||||||
|
{
|
||||||
|
if (a == "DeathFrom" + monsterName)
|
||||||
|
{
|
||||||
|
AppManager.Instance.ChangeGameState(GameState.Death);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
isAlive = false;
|
isAlive = false;
|
||||||
}
|
}
|
||||||
public void Jump()
|
public void Jump()
|
||||||
|
|
|
@ -7,6 +7,7 @@ public abstract class LivingEntity : Entity
|
||||||
public bool isOnGround = true;
|
public bool isOnGround = true;
|
||||||
public Vector2 velocity;
|
public Vector2 velocity;
|
||||||
public Vector2 acceleration;
|
public Vector2 acceleration;
|
||||||
|
|
||||||
public LivingEntity(Vector2 position) : base(position)
|
public LivingEntity(Vector2 position) : base(position)
|
||||||
{
|
{
|
||||||
acceleration = new Vector2(0, 30);
|
acceleration = new Vector2(0, 30);
|
||||||
|
|
|
@ -205,8 +205,12 @@ namespace DangerousD.GameCore
|
||||||
case GameState.Lobby:
|
case GameState.Lobby:
|
||||||
break;
|
break;
|
||||||
case GameState.Game:
|
case GameState.Game:
|
||||||
|
<<<<<<< HEAD
|
||||||
|
GameManager.mapManager.LoadLevel("map");
|
||||||
|
=======
|
||||||
GameManager.mapManager.LoadLevel("lvl");
|
GameManager.mapManager.LoadLevel("lvl");
|
||||||
GameManager.FindBorders();
|
GameManager.FindBorders();
|
||||||
|
>>>>>>> main
|
||||||
break;
|
break;
|
||||||
case GameState.Death:
|
case GameState.Death:
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -92,6 +92,10 @@ namespace DangerousD.GameCore.Managers
|
||||||
float offsetY = group.Attributes["offsety"] is not null ? float.Parse(group.Attributes["offsety"].Value) : 0;
|
float offsetY = group.Attributes["offsety"] is not null ? float.Parse(group.Attributes["offsety"].Value) : 0;
|
||||||
foreach (XmlNode entity in group.ChildNodes)
|
foreach (XmlNode entity in group.ChildNodes)
|
||||||
{
|
{
|
||||||
|
<<<<<<< HEAD
|
||||||
|
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);
|
||||||
|
=======
|
||||||
string entityType = entity.Attributes["type"] is not null ? "." + entity.Attributes["type"].Value : "";
|
string entityType = entity.Attributes["type"] is not null ? "." + entity.Attributes["type"].Value : "";
|
||||||
Type type = Type.GetType($"DangerousD.GameCore.GameObjects.{entityGroup}{entityType}");
|
Type type = Type.GetType($"DangerousD.GameCore.GameObjects.{entityGroup}{entityType}");
|
||||||
Vector2 pos =
|
Vector2 pos =
|
||||||
|
@ -106,6 +110,7 @@ namespace DangerousD.GameCore.Managers
|
||||||
{
|
{
|
||||||
inst = (Entity)Activator.CreateInstance(type, pos);
|
inst = (Entity)Activator.CreateInstance(type, pos);
|
||||||
}
|
}
|
||||||
|
>>>>>>> ea55e2b4f2b2b9af627579f3c4b82bdf0171d80b
|
||||||
inst.SetPosition(new Vector2(inst.Pos.X, inst.Pos.Y - inst.Height));
|
inst.SetPosition(new Vector2(inst.Pos.X, inst.Pos.Y - inst.Height));
|
||||||
inst.Height *= _scale;
|
inst.Height *= _scale;
|
||||||
inst.Width *= _scale;
|
inst.Width *= _scale;
|
||||||
|
|
|
@ -40,7 +40,6 @@ namespace DangerousD.GameCore
|
||||||
|
|
||||||
public void StartAmbientSound(string soundName) // запустить звук у которого нет позиции
|
public void StartAmbientSound(string soundName) // запустить звук у которого нет позиции
|
||||||
{
|
{
|
||||||
return;
|
|
||||||
var sound = new Sound(Sounds[soundName]);
|
var sound = new Sound(Sounds[soundName]);
|
||||||
sound.SoundEffect.IsLooped = false;
|
sound.SoundEffect.IsLooped = false;
|
||||||
sound.SoundEffect.Play();
|
sound.SoundEffect.Play();
|
||||||
|
|
Loading…
Add table
Reference in a new issue