Merge branch 'main' of https://github.com/progtime-net/DangerousD
This commit is contained in:
commit
0bcd6f29cb
29 changed files with 192 additions and 76 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,7 +62,7 @@
|
||||||
</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>
|
||||||
|
|
|
@ -20,7 +20,6 @@ public abstract class AbstractGui : IDrawableObject
|
||||||
public virtual void Initialize()
|
public virtual void Initialize()
|
||||||
{
|
{
|
||||||
Manager.Initialize(AppManager.Instance.GraphicsDevice);
|
Manager.Initialize(AppManager.Instance.GraphicsDevice);
|
||||||
this.graphicsDevice = graphicsDevice;
|
|
||||||
CreateUI();
|
CreateUI();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -31,7 +30,7 @@ public abstract class AbstractGui : IDrawableObject
|
||||||
|
|
||||||
public virtual void Update(GameTime gameTime)
|
public virtual void Update(GameTime gameTime)
|
||||||
{
|
{
|
||||||
Manager.Update();
|
Manager.Update(gameTime);
|
||||||
}
|
}
|
||||||
|
|
||||||
public virtual void Draw(SpriteBatch spriteBatch)
|
public virtual void Draw(SpriteBatch spriteBatch)
|
||||||
|
|
|
@ -31,8 +31,9 @@ internal class MenuGUI : AbstractGui
|
||||||
|
|
||||||
for (int i = 0; i < colors.Length; i++)
|
for (int i = 0; i < colors.Length; i++)
|
||||||
{
|
{
|
||||||
Elements.Add(new Label(Manager) { rectangle = new Rectangle((wigth - 50) / 2 - 60, 200, 50, 50), text = "Dangerous", mainColor = Color.Transparent, scale = 1.35f - 0.05f * i * i / 10, fontName = "Font2", fontColor = colors[i] });
|
Elements.Add(new Label(Manager) { rectangle = new Rectangle((wigth - 50) / 2 - 60, 220, 50, 50), text = "Dangerous", mainColor = Color.Transparent, scale = 1.35f - 0.05f * i * i / 10, fontName = "Font2", fontColor = colors[i] });
|
||||||
MainLetterLabels.Add(Elements.Last() as Label);
|
MainLetterLabels.Add(Elements.Last() as Label);
|
||||||
|
MainLetterPositions.Add(new Vector2(Elements.Last().rectangle.X, Elements.Last().rectangle.Y));
|
||||||
}
|
}
|
||||||
|
|
||||||
int dx = 50;
|
int dx = 50;
|
||||||
|
@ -40,6 +41,7 @@ internal class MenuGUI : AbstractGui
|
||||||
{
|
{
|
||||||
Elements.Add(new Label(Manager) { rectangle = new Rectangle((wigth - 50) / 2 + 480 + dx - i * i, 260 - i * i / 5, 50, 50), text = "D", mainColor = Color.Transparent, scale = 2.15f - 0.05f * i * i / 5, fontName = "Font2", fontColor = colors[i] });
|
Elements.Add(new Label(Manager) { rectangle = new Rectangle((wigth - 50) / 2 + 480 + dx - i * i, 260 - i * i / 5, 50, 50), text = "D", mainColor = Color.Transparent, scale = 2.15f - 0.05f * i * i / 5, fontName = "Font2", fontColor = colors[i] });
|
||||||
BigLetterLabels.Add(Elements.Last() as Label);
|
BigLetterLabels.Add(Elements.Last() as Label);
|
||||||
|
BigLetterPositions.Add(new Vector2(Elements.Last().rectangle.X, Elements.Last().rectangle.Y));
|
||||||
}
|
}
|
||||||
|
|
||||||
var butSingle = new ButtonText(Manager) { rectangle = new Rectangle((wigth - (int)(300 * 2.4)) / 2, 350, (int)(300 * 2.4), (int)(50 * 2.4)), text = "Singleplayer", scale = 1.2f, fontName = "ButtonFont" };
|
var butSingle = new ButtonText(Manager) { rectangle = new Rectangle((wigth - (int)(300 * 2.4)) / 2, 350, (int)(300 * 2.4), (int)(50 * 2.4)), text = "Singleplayer", scale = 1.2f, fontName = "ButtonFont" };
|
||||||
|
@ -77,10 +79,21 @@ internal class MenuGUI : AbstractGui
|
||||||
{
|
{
|
||||||
for (int i = 0; i < MainLetterLabels.Count; i++)
|
for (int i = 0; i < MainLetterLabels.Count; i++)
|
||||||
{
|
{
|
||||||
MainLetterLabels[i].fontColor = Color.FromNonPremultiplied(colors[i].ToVector4() * (float)((Math.Sin(gameTime.TotalGameTime.TotalSeconds*2) + 1) / 2f + 0.5f)
|
MainLetterLabels[i].fontColor = Color.FromNonPremultiplied(colors[i].ToVector4() *
|
||||||
|
(float)(((Math.Sin(gameTime.TotalGameTime.TotalSeconds * 4) + 1) / 2f) * 0.3 + 0.8f)
|
||||||
);
|
);
|
||||||
BigLetterLabels[i].fontColor = Color.FromNonPremultiplied(colors[i].ToVector4() * (float)((Math.Sin(gameTime.TotalGameTime.TotalSeconds * 2) + 1) / 2f + 0.5f)
|
BigLetterLabels[i].fontColor = Color.FromNonPremultiplied(colors[i].ToVector4()
|
||||||
|
* (float)(((Math.Sin(gameTime.TotalGameTime.TotalSeconds * 4 - Math.PI) + 1) / 2f) * 0.3 + 0.8f)
|
||||||
);
|
);
|
||||||
|
MainLetterLabels[i].fontColor.A = 255;
|
||||||
|
BigLetterLabels[i].fontColor.A = 255;
|
||||||
|
MainLetterLabels[i].rectangle.Y = (int)(MainLetterPositions[i].Y +
|
||||||
|
(20 * (Math.Sin(gameTime.TotalGameTime.TotalSeconds * 4) + 1) / 2f * 0.25) * (i - MainLetterLabels.Count / 2)
|
||||||
|
);
|
||||||
|
BigLetterLabels[i].rectangle.Y = (int)(BigLetterPositions[i].Y +
|
||||||
|
(20 * (Math.Sin(gameTime.TotalGameTime.TotalSeconds * 4 - Math.PI) + 1) / 2f * 0.25) * (i - MainLetterLabels.Count / 2)
|
||||||
|
);
|
||||||
|
|
||||||
}
|
}
|
||||||
base.Update(gameTime);
|
base.Update(gameTime);
|
||||||
}
|
}
|
||||||
|
|
36
DangerousD/GameCore/GameObjects/Entities/Trigger.cs
Normal file
36
DangerousD/GameCore/GameObjects/Entities/Trigger.cs
Normal file
|
@ -0,0 +1,36 @@
|
||||||
|
using DangerousD.GameCore.Graphics;
|
||||||
|
using Microsoft.Xna.Framework;
|
||||||
|
using Microsoft.Xna.Framework.Graphics;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace DangerousD.GameCore.GameObjects.Entities
|
||||||
|
{
|
||||||
|
internal class Trigger : Entity
|
||||||
|
{
|
||||||
|
public Action<GameObject> OnCollisionAction;
|
||||||
|
string trigger_Name;
|
||||||
|
public Trigger(Rectangle rectangle, string trigger_Name) : base(new Vector2(rectangle.X, rectangle.Y))
|
||||||
|
{
|
||||||
|
_pos = new Vector2(rectangle.X, rectangle.Y);
|
||||||
|
Width = rectangle.Width;
|
||||||
|
Height = rectangle.Height;
|
||||||
|
this.trigger_Name = trigger_Name;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override GraphicsComponent GraphicsComponent => new GraphicsComponent(new List<string>() { "SilasBallMove" }, "SilasBallMove");
|
||||||
|
public override void OnCollision(GameObject gameObject)
|
||||||
|
{
|
||||||
|
OnCollisionAction?.Invoke(gameObject);
|
||||||
|
}
|
||||||
|
public override void Update(GameTime gameTime)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
public override void Draw(SpriteBatch spriteBatch)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -17,7 +17,8 @@ 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;
|
||||||
|
protected bool isGoRight;
|
||||||
|
|
||||||
public CoreEnemy(Vector2 position) : base(position)
|
public CoreEnemy(Vector2 position) : base(position)
|
||||||
{
|
{
|
||||||
|
@ -31,6 +32,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);
|
||||||
|
|
||||||
|
|
|
@ -12,7 +12,6 @@ namespace DangerousD.GameCore.GameObjects.LivingEntities.Monsters
|
||||||
{
|
{
|
||||||
public class FlameSkull : CoreEnemy
|
public class FlameSkull : CoreEnemy
|
||||||
{
|
{
|
||||||
private bool isGoRight;
|
|
||||||
private bool isAttack;
|
private bool isAttack;
|
||||||
|
|
||||||
public FlameSkull(Vector2 position) : base(position)
|
public FlameSkull(Vector2 position) : base(position)
|
||||||
|
@ -74,6 +73,9 @@ namespace DangerousD.GameCore.GameObjects.LivingEntities.Monsters
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public override void Attack(GameTime gameTime)
|
||||||
|
{
|
||||||
|
throw new NotImplementedException();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,12 +12,9 @@ namespace DangerousD.GameCore.GameObjects.LivingEntities.Monsters
|
||||||
{
|
{
|
||||||
internal class Frank : CoreEnemy
|
internal class Frank : CoreEnemy
|
||||||
{
|
{
|
||||||
private bool isGoRight;
|
|
||||||
|
|
||||||
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;
|
||||||
|
@ -72,7 +69,7 @@ namespace DangerousD.GameCore.GameObjects.LivingEntities.Monsters
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Attack(GameTime gameTime)
|
public override void Attack(GameTime gameTime)
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -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;
|
||||||
|
|
||||||
|
@ -81,13 +80,12 @@ namespace DangerousD.GameCore.GameObjects.LivingEntities.Monsters
|
||||||
velocity.Y -= monster_speed;
|
velocity.Y -= monster_speed;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
public void Target()
|
||||||
public void Attack(GameTime gameTime)
|
|
||||||
{
|
{
|
||||||
|
throw new NotImplementedException();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Target()
|
public override void Attack(GameTime gameTime)
|
||||||
{
|
{
|
||||||
throw new NotImplementedException();
|
throw new NotImplementedException();
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,7 +10,6 @@ namespace DangerousD.GameCore.GameObjects.LivingEntities.Monsters
|
||||||
{
|
{
|
||||||
public class Ghost : CoreEnemy
|
public class Ghost : CoreEnemy
|
||||||
{
|
{
|
||||||
private bool isGoRight;
|
|
||||||
private bool isAttack;
|
private bool isAttack;
|
||||||
|
|
||||||
public Ghost(Vector2 position) : base(position)
|
public Ghost(Vector2 position) : base(position)
|
||||||
|
@ -79,7 +78,7 @@ namespace DangerousD.GameCore.GameObjects.LivingEntities.Monsters
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Attack(GameTime gameTime)
|
public override void Attack(GameTime gameTime)
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -81,7 +81,7 @@ namespace DangerousD.GameCore.GameObjects.LivingEntities.Monsters
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Attack(GameTime gameTime)
|
public override void Attack(GameTime gameTime)
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,7 +27,7 @@ namespace DangerousD.GameCore.GameObjects.LivingEntities.Monsters
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Attack(GameTime gameTime)
|
public override void Attack(GameTime gameTime)
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,7 +10,8 @@ using System.Threading.Tasks;
|
||||||
|
|
||||||
namespace DangerousD.GameCore.GameObjects.LivingEntities.Monsters
|
namespace DangerousD.GameCore.GameObjects.LivingEntities.Monsters
|
||||||
{
|
{
|
||||||
public class SilasHands : CoreEnemy
|
public class
|
||||||
|
SilasHands : CoreEnemy
|
||||||
{
|
{
|
||||||
public SilasHands(Vector2 position) : base(position)
|
public SilasHands(Vector2 position) : base(position)
|
||||||
{
|
{
|
||||||
|
@ -30,9 +31,9 @@ namespace DangerousD.GameCore.GameObjects.LivingEntities.Monsters
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Attack(GameTime gameTime)
|
public override void Attack(GameTime gameTime)
|
||||||
{
|
{
|
||||||
|
throw new NotImplementedException();
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void Death()
|
public override void Death()
|
||||||
|
|
|
@ -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>();
|
||||||
|
@ -71,7 +70,7 @@ namespace DangerousD.GameCore.GameObjects.LivingEntities.Monsters
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Attack(GameTime gameTime)
|
public override void Attack(GameTime gameTime)
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -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;
|
||||||
|
@ -238,7 +237,7 @@ namespace DangerousD.GameCore.GameObjects.LivingEntities.Monsters
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Attack(GameTime gameTime)
|
public override void Attack(GameTime gameTime)
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -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;
|
||||||
|
@ -12,7 +14,6 @@ namespace DangerousD.GameCore.GameObjects.LivingEntities.Monsters
|
||||||
{
|
{
|
||||||
public class Spider : CoreEnemy
|
public class Spider : CoreEnemy
|
||||||
{
|
{
|
||||||
private bool isGoRight;
|
|
||||||
private bool isAttack;
|
private bool isAttack;
|
||||||
|
|
||||||
protected SpiderWeb web;
|
protected SpiderWeb web;
|
||||||
|
@ -20,19 +21,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 +53,7 @@ namespace DangerousD.GameCore.GameObjects.LivingEntities.Monsters
|
||||||
{
|
{
|
||||||
Attack(gameTime);
|
Attack(gameTime);
|
||||||
}
|
}
|
||||||
|
Target();
|
||||||
|
|
||||||
base.Update(gameTime);
|
base.Update(gameTime);
|
||||||
}
|
}
|
||||||
|
@ -60,20 +67,22 @@ namespace DangerousD.GameCore.GameObjects.LivingEntities.Monsters
|
||||||
/// Атака паука РАБОЧАЯ
|
/// Атака паука РАБОЧАЯ
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="gameTime"></param>
|
/// <param name="gameTime"></param>
|
||||||
public void Attack(GameTime gameTime)
|
public override void Attack(GameTime gameTime)
|
||||||
{ //48 72
|
{ //48 72
|
||||||
if (isDownUp)
|
velocity.X = 0;
|
||||||
|
delay += (float)gameTime.ElapsedGameTime.TotalSeconds;
|
||||||
|
if (isAttack)
|
||||||
{
|
{
|
||||||
Width = 48;
|
|
||||||
Height = 72;
|
|
||||||
delay += (float)gameTime.ElapsedGameTime.TotalSeconds;
|
|
||||||
if (delay > 0.5 && webLength <= 4 && isDown)
|
if (delay > 0.5 && webLength <= 4 && isDown)
|
||||||
{
|
{
|
||||||
|
Width = 48;
|
||||||
|
Height = 72;
|
||||||
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,23 +91,35 @@ 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 +142,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 +167,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;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,7 +28,7 @@ namespace DangerousD.GameCore.GameObjects.LivingEntities.Monsters
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Attack(GameTime gameTime)
|
public override void Attack(GameTime gameTime)
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,7 +12,6 @@ namespace DangerousD.GameCore.GameObjects.LivingEntities.Monsters
|
||||||
{
|
{
|
||||||
public class Werewolf : CoreEnemy
|
public class Werewolf : CoreEnemy
|
||||||
{
|
{
|
||||||
private bool isGoRight;
|
|
||||||
private bool isAttack;
|
private bool isAttack;
|
||||||
|
|
||||||
public Werewolf(Vector2 position) : base(position)
|
public Werewolf(Vector2 position) : base(position)
|
||||||
|
@ -73,7 +72,7 @@ namespace DangerousD.GameCore.GameObjects.LivingEntities.Monsters
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Attack(GameTime gameTime)
|
public override void Attack(GameTime gameTime)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -13,7 +13,6 @@ namespace DangerousD.GameCore.GameObjects.LivingEntities.Monsters
|
||||||
{
|
{
|
||||||
public class Zombie : CoreEnemy
|
public class Zombie : CoreEnemy
|
||||||
{
|
{
|
||||||
private bool isGoRight;
|
|
||||||
private bool isAttack;
|
private bool isAttack;
|
||||||
|
|
||||||
float leftBorder;
|
float leftBorder;
|
||||||
|
@ -128,18 +127,19 @@ namespace DangerousD.GameCore.GameObjects.LivingEntities.Monsters
|
||||||
}
|
}
|
||||||
base.OnCollision(gameObject);
|
base.OnCollision(gameObject);
|
||||||
}
|
}
|
||||||
|
|
||||||
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)).Count > 0)
|
if (AppManager.Instance.GameManager.physicsManager.CheckRectangle(new Rectangle((int)Pos.X - 50, (int)Pos.Y, Width + 100, Height), typeof(Player)).Count > 0)
|
||||||
{
|
{
|
||||||
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;
|
isTarget = true;
|
||||||
leftBorder = Pos.X - 10;
|
leftBorder = Pos.X - 10;
|
||||||
rightBorder = Pos.X + AppManager.Instance.GameManager.players[0].Pos.X;
|
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;
|
isTarget = true;
|
||||||
rightBorder = Pos.X + 10;
|
rightBorder = Pos.X + 10;
|
||||||
|
@ -158,8 +158,7 @@ namespace DangerousD.GameCore.GameObjects.LivingEntities.Monsters
|
||||||
rightBorder = 760;
|
rightBorder = 760;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
public override void Attack(GameTime gameTime)
|
||||||
public void Attack(GameTime gameTime)
|
|
||||||
{}
|
{}
|
||||||
|
|
||||||
public void TakeDamage()
|
public void TakeDamage()
|
||||||
|
|
|
@ -94,7 +94,7 @@ namespace DangerousD.GameCore.GameObjects.LivingEntities
|
||||||
}
|
}
|
||||||
public void Death(string monsterName)
|
public void Death(string monsterName)
|
||||||
{
|
{
|
||||||
return;
|
return; //godmode
|
||||||
isAttacked = true;
|
isAttacked = true;
|
||||||
if(monsterName == "Zombie")
|
if(monsterName == "Zombie")
|
||||||
{
|
{
|
||||||
|
@ -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,7 +205,7 @@ namespace DangerousD.GameCore
|
||||||
case GameState.Lobby:
|
case GameState.Lobby:
|
||||||
break;
|
break;
|
||||||
case GameState.Game:
|
case GameState.Game:
|
||||||
GameManager.mapManager.LoadLevel("lvl");
|
GameManager.mapManager.LoadLevel("map");
|
||||||
GameManager.FindBorders();
|
GameManager.FindBorders();
|
||||||
break;
|
break;
|
||||||
case GameState.Death:
|
case GameState.Death:
|
||||||
|
|
|
@ -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();
|
||||||
|
|
|
@ -51,8 +51,10 @@ namespace MonogameLibrary.UI.Base
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public void Update()
|
public GameTime gameTime;
|
||||||
|
public void Update(GameTime gameTime)
|
||||||
{
|
{
|
||||||
|
this.gameTime = gameTime;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
keyboardState = Keyboard.GetState();
|
keyboardState = Keyboard.GetState();
|
||||||
|
|
|
@ -16,22 +16,57 @@ namespace MonogameLibrary.UI.Elements
|
||||||
public ButtonText(UIManager manager, int layerIndex = 0) : base(manager, layerIndex)
|
public ButtonText(UIManager manager, int layerIndex = 0) : base(manager, layerIndex)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
float gameTime = 0;
|
||||||
|
public override bool InteractUpdate(MouseState mouseState, MouseState prevmouseState)
|
||||||
|
{
|
||||||
|
gameTime += (float)Manager.gameTime.ElapsedGameTime.TotalSeconds;
|
||||||
|
return base.InteractUpdate(mouseState, prevmouseState);
|
||||||
|
}
|
||||||
|
|
||||||
public override void Draw(SpriteBatch _spriteBatch)
|
public override void Draw(SpriteBatch _spriteBatch)
|
||||||
{
|
{
|
||||||
if (hoverState == HoverState.None)
|
if (hoverState == HoverState.None)
|
||||||
{
|
{
|
||||||
fontColor = Color.White;
|
var d = (float)(((Math.Sin(gameTime * 2 - Math.PI) + 1) / 2f) * 0.1 + 0.7f);
|
||||||
|
fontColor = Color.FromNonPremultiplied(new Vector4(0.8f,0.15f, 0.15f, 1) * d
|
||||||
|
);
|
||||||
}
|
}
|
||||||
else if (hoverState == HoverState.Hovering)
|
else if (hoverState == HoverState.Hovering)
|
||||||
{
|
{
|
||||||
fontColor = new Color(211, 211, 211);
|
var d2 = (float)(((Math.Sin(gameTime * 2 - Math.PI) + 1) / 2f) * 0.1 + 0.7f);
|
||||||
|
fontColor = Color.FromNonPremultiplied(new Vector4(0.8f, 0.15f, 0.15f, 1) * d2
|
||||||
|
);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
fontColor = new Color(112, 128, 144);
|
//fontColor = new Color(112, 128, 144);
|
||||||
|
fontColor = new Color(212, 228, 244);
|
||||||
}
|
}
|
||||||
|
|
||||||
DrawText(_spriteBatch);
|
if (hoverState == HoverState.Hovering)
|
||||||
|
{
|
||||||
|
int kk = 50;
|
||||||
|
scale += 0.005f;
|
||||||
|
var d = (float)(((Math.Sin(gameTime * 1 - Math.PI) + 1) / 2f) * 0.1 + 1f);
|
||||||
|
Color oldColor = fontColor;
|
||||||
|
fontColor = Color.FromNonPremultiplied(new Vector4(252 / 255f, 231 / 255f, 124 / 255f, 1) * d
|
||||||
|
);
|
||||||
|
DrawText(_spriteBatch);
|
||||||
|
fontColor = oldColor;
|
||||||
|
fontColor.A = 255;
|
||||||
|
scale -= 0.005f;
|
||||||
|
scale -= 0.0002f;
|
||||||
|
}
|
||||||
|
if (hoverState == HoverState.Pressing)
|
||||||
|
{
|
||||||
|
scale -= 0.025f;
|
||||||
|
DrawText(_spriteBatch);
|
||||||
|
scale += 0.025f;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
DrawText(_spriteBatch);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,8 +19,10 @@ namespace MonogameLibrary.UI.Elements
|
||||||
}
|
}
|
||||||
protected HoverState hoverState = HoverState.None;
|
protected HoverState hoverState = HoverState.None;
|
||||||
|
|
||||||
|
float gameTime = 0;
|
||||||
public virtual bool InteractUpdate(MouseState mouseState, MouseState prevmouseState)
|
public virtual bool InteractUpdate(MouseState mouseState, MouseState prevmouseState)
|
||||||
{
|
{
|
||||||
|
gameTime += (float)Manager.gameTime.ElapsedGameTime.TotalSeconds;
|
||||||
if (rectangle.Intersects(new Rectangle(mouseState.Position, Point.Zero)))
|
if (rectangle.Intersects(new Rectangle(mouseState.Position, Point.Zero)))
|
||||||
{
|
{
|
||||||
if (mouseState.LeftButton == ButtonState.Pressed)
|
if (mouseState.LeftButton == ButtonState.Pressed)
|
||||||
|
|
Loading…
Add table
Reference in a new issue