Merge branch 'черешня' into sounds
This commit is contained in:
commit
3b63d63087
22 changed files with 141 additions and 87 deletions
Binary file not shown.
Before Width: | Height: | Size: 396 KiB After Width: | Height: | Size: 1.6 MiB |
|
@ -719,20 +719,6 @@
|
|||
<point/>
|
||||
</object>
|
||||
</objectgroup>
|
||||
<objectgroup id="17" name="Hunchman" class="LivingEntities.Monsters.Hunchman">
|
||||
<object id="98" x="-92" y="144">
|
||||
<point/>
|
||||
</object>
|
||||
<object id="99" x="115.333" y="182">
|
||||
<point/>
|
||||
</object>
|
||||
<object id="100" x="191.333" y="277.333">
|
||||
<point/>
|
||||
</object>
|
||||
<object id="101" x="249.333" y="88.6667">
|
||||
<point/>
|
||||
</object>
|
||||
</objectgroup>
|
||||
<objectgroup id="10" name="Player" class="LivingEntities.Player">
|
||||
<object id="47" x="-500" y="461.333">
|
||||
<point/>
|
||||
|
|
|
@ -62,7 +62,7 @@
|
|||
</object>
|
||||
</objectgroup>
|
||||
<objectgroup id="5" name="Zombies" class="LivingEntities.Monsters.Spider">
|
||||
<object id="4" x="-80" y="100">
|
||||
<object id="4" x="-50" y="200">
|
||||
<point/>
|
||||
</object>
|
||||
</objectgroup>
|
||||
|
|
|
@ -44,6 +44,7 @@ namespace DangerousD.GameCore.GUI
|
|||
Button backButton = new Button(Manager)
|
||||
{
|
||||
rectangle = new Rectangle(screenWidth / 20, screenHeight / 15, (int)(40 * 2.4), (int)(40 * 2.4)),
|
||||
text = "<-",
|
||||
fontColor = Color.Black,
|
||||
fontName = "font2",
|
||||
textureName = "textboxbackground1-1"
|
||||
|
|
|
@ -66,7 +66,7 @@ namespace DangerousD.GameCore.GUI
|
|||
Elements.Add(lblSwitchMode);
|
||||
|
||||
Button bTExit = new Button(Manager)
|
||||
{ fontName = "Font2", scale = 0.72f, text = "<-", rectangle = new Rectangle(wigth / 30, height / 30, (int)(40 * 2.4), (int)(40 * 2.4)), textureName = "textboxbackground1-1" };
|
||||
{ fontName = "Font2", text = "<-", rectangle = new Rectangle(wigth / 30, height / 30, (int)(40 * 2.4), (int)(40 * 2.4)), textureName = "textboxbackground1-1" };
|
||||
Elements.Add(bTExit);
|
||||
bTExit.LeftButtonPressed += () =>
|
||||
{
|
||||
|
|
|
@ -13,7 +13,7 @@ namespace DangerousD.GameCore.GameObjects.LivingEntities
|
|||
public abstract class CoreEnemy : LivingEntity
|
||||
{
|
||||
protected int monster_health;
|
||||
protected int monster_speed;
|
||||
protected float monster_speed;
|
||||
protected string name;
|
||||
protected bool isAlive = true;
|
||||
protected int leftBoarder = 0;
|
||||
|
@ -45,5 +45,7 @@ namespace DangerousD.GameCore.GameObjects.LivingEntities
|
|||
isAlive = false;
|
||||
}
|
||||
}
|
||||
|
||||
public abstract void Target();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -13,20 +13,38 @@ namespace DangerousD.GameCore.GameObjects.LivingEntities.Monsters
|
|||
public class FlameSkull : CoreEnemy
|
||||
{
|
||||
private bool isAttack;
|
||||
|
||||
protected Vector2 startPosition;
|
||||
/*protected Vector2[] positions = { new Vector2(0, 242), new Vector2(0, 332), new Vector2(582, 332), new Vector2(0, 332),
|
||||
new Vector2(0, 444), new Vector2(582, 444), new Vector2(0, 444), new Vector2(0, 242), new Vector2(582, 242),
|
||||
new Vector2(0, 242), new Vector2(0, 149), new Vector2(582, 149), new Vector2(0,149)};*/
|
||||
protected Vector2[] positions = { new Vector2(0,246), new Vector2(0, 344), new Vector2(550,344), new Vector2(520, 246)};
|
||||
protected int i;
|
||||
public FlameSkull(Vector2 position) : base(position)
|
||||
{
|
||||
Width = 62;
|
||||
Height = 40;
|
||||
monster_speed = 3;
|
||||
{ // v3 -> v2 -> s2 -> v2 -> v1 -> s1 -> v1 -> v3 -> s3 -> v3 -> v4 -> s4 -> v4
|
||||
//0 149 verv 4 [7]
|
||||
//582 108 stairs 4 [6]
|
||||
//0 242 verv 3 [5]
|
||||
//582 220 stairs 3 [4]
|
||||
//0 332 verv 2 [3]
|
||||
//582 332 stairs 2 [2]
|
||||
//0 444 verv 1 [1]
|
||||
//582 444 stairs 1 [0]
|
||||
startPosition = new Vector2(500, 242);
|
||||
_pos = startPosition;
|
||||
i = 0;
|
||||
Width = 31;
|
||||
Height = 20;
|
||||
monster_speed = 2;
|
||||
name = "Skull";
|
||||
acceleration = Vector2.Zero;
|
||||
startPosition = new Vector2();
|
||||
}
|
||||
|
||||
protected override GraphicsComponent GraphicsComponent { get; } = new(new List<string> { "FlameSkullMoveRight" , "FlameSkullMoveLeft"}, "FlameSkullMoveRight");
|
||||
|
||||
public override void Update(GameTime gameTime)
|
||||
{
|
||||
AppManager.Instance.DebugHUD.Set("number i: ", i.ToString());
|
||||
if (!isAttack)
|
||||
{
|
||||
Move(gameTime);
|
||||
|
@ -63,19 +81,52 @@ namespace DangerousD.GameCore.GameObjects.LivingEntities.Monsters
|
|||
}
|
||||
velocity.X = -monster_speed;
|
||||
}
|
||||
if (Pos.X >= rightBoarder)
|
||||
|
||||
if (i%2 == 0)
|
||||
{
|
||||
if (Pos.X > positions[i].X)
|
||||
{
|
||||
isGoRight = false;
|
||||
}
|
||||
else if (Pos.X <= leftBoarder)
|
||||
else if (Pos.X < positions[i].X)
|
||||
{
|
||||
isGoRight = true;
|
||||
}
|
||||
else if (Pos.X == positions[i].X)
|
||||
{
|
||||
i++;
|
||||
velocity.X = 0;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (Pos.Y > positions[i].Y)
|
||||
{
|
||||
_pos.Y -= monster_speed;
|
||||
}
|
||||
else if (Pos.Y < positions[i].Y)
|
||||
{
|
||||
_pos.Y += monster_speed;
|
||||
}
|
||||
else if (Pos.Y == positions[i].Y)
|
||||
{
|
||||
i++;
|
||||
}
|
||||
}
|
||||
if (i == positions.Length)
|
||||
{
|
||||
i = 0;
|
||||
}
|
||||
}
|
||||
|
||||
public override void Attack(GameTime gameTime)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
|
||||
}
|
||||
|
||||
public override void Target()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -74,9 +74,9 @@ namespace DangerousD.GameCore.GameObjects.LivingEntities.Monsters
|
|||
|
||||
}
|
||||
|
||||
public void Target()
|
||||
public override void Target()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -120,14 +120,14 @@ namespace DangerousD.GameCore.GameObjects.LivingEntities.Monsters
|
|||
|
||||
}
|
||||
|
||||
public void Target()
|
||||
public override void Target()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
|
||||
}
|
||||
|
||||
public override void Attack(GameTime gameTime)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -111,16 +111,15 @@ namespace DangerousD.GameCore.GameObjects.LivingEntities.Monsters
|
|||
public void TakeDamage()
|
||||
{
|
||||
monster_health--;
|
||||
|
||||
|
||||
if (monster_health <= 0)
|
||||
{
|
||||
Death();
|
||||
}
|
||||
}
|
||||
public void Target()
|
||||
|
||||
public override void Target()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -129,9 +129,9 @@ namespace DangerousD.GameCore.GameObjects.LivingEntities.Monsters
|
|||
Debug.WriteLine("Collision");
|
||||
}
|
||||
|
||||
public void Target()
|
||||
public override void Target()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -42,9 +42,9 @@ namespace DangerousD.GameCore.GameObjects.LivingEntities.Monsters
|
|||
|
||||
}
|
||||
|
||||
public void Target()
|
||||
public override void Target()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -68,9 +68,9 @@ namespace DangerousD.GameCore.GameObjects.LivingEntities.Monsters
|
|||
}
|
||||
}
|
||||
|
||||
public void Target()
|
||||
public override void Target()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
|
||||
}
|
||||
|
||||
public override void Update(GameTime gameTime)
|
||||
|
|
|
@ -112,9 +112,9 @@ namespace DangerousD.GameCore.GameObjects.LivingEntities.Monsters
|
|||
}
|
||||
}
|
||||
|
||||
public void Target()
|
||||
public override void Target()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
|
||||
}
|
||||
|
||||
public override void Update(GameTime gameTime)
|
||||
|
|
|
@ -288,7 +288,7 @@ namespace DangerousD.GameCore.GameObjects.LivingEntities.Monsters
|
|||
base.Update(gameTime);
|
||||
}
|
||||
|
||||
public void Target()
|
||||
public override void Target()
|
||||
{
|
||||
|
||||
}
|
||||
|
|
|
@ -19,10 +19,12 @@ namespace DangerousD.GameCore.GameObjects.LivingEntities.Monsters
|
|||
protected SpiderWeb web;
|
||||
protected float delay;
|
||||
protected int webLength;
|
||||
protected int widthS;
|
||||
protected bool isDown;
|
||||
protected bool isDownUp;
|
||||
protected PhysicsManager physicsManager;
|
||||
protected Player player;
|
||||
protected Vector2 oldPosition;
|
||||
|
||||
public Spider(Vector2 position) : base(position)
|
||||
{
|
||||
|
@ -31,8 +33,10 @@ namespace DangerousD.GameCore.GameObjects.LivingEntities.Monsters
|
|||
isDown = true;
|
||||
physicsManager = AppManager.Instance.GameManager.physicsManager;
|
||||
name = "Spider";
|
||||
Width = 112;
|
||||
Height = 24;
|
||||
Width = 28;
|
||||
Height = 6;
|
||||
widthS = Width;
|
||||
web = new SpiderWeb(new Vector2(Pos.X+Width/2,Pos.Y));
|
||||
delay = 0;
|
||||
web = new SpiderWeb(new Vector2(Pos.X-Width/2,Pos.Y));
|
||||
webLength = 0;
|
||||
|
@ -45,7 +49,7 @@ namespace DangerousD.GameCore.GameObjects.LivingEntities.Monsters
|
|||
|
||||
public override void Update(GameTime gameTime)
|
||||
{
|
||||
if (!isAttack)
|
||||
if (isAttack == false)
|
||||
{
|
||||
Move(gameTime);
|
||||
}
|
||||
|
@ -68,15 +72,16 @@ namespace DangerousD.GameCore.GameObjects.LivingEntities.Monsters
|
|||
/// </summary>
|
||||
/// <param name="gameTime"></param>
|
||||
public override void Attack(GameTime gameTime)
|
||||
{ //48 72
|
||||
velocity.X = 0;
|
||||
delay += (float)gameTime.ElapsedGameTime.TotalSeconds;
|
||||
{
|
||||
if (isAttack)
|
||||
{
|
||||
if (delay > 0.5 && webLength <= 4 && isDown)
|
||||
velocity.X = 0;
|
||||
delay += (float)gameTime.ElapsedGameTime.TotalSeconds;
|
||||
|
||||
if (delay > 0.25 && webLength <= 4 && isDown)
|
||||
{
|
||||
Width = 48;
|
||||
Height = 72;
|
||||
Width = 12;
|
||||
Height = 18;
|
||||
StartCicycleAnimation("SpiderOnWeb");
|
||||
acceleration = Vector2.Zero;
|
||||
webLength++;
|
||||
|
@ -91,8 +96,8 @@ namespace DangerousD.GameCore.GameObjects.LivingEntities.Monsters
|
|||
}
|
||||
else if (delay > 0.5 && webLength != 0 && !isDown)
|
||||
{
|
||||
Width = 48;
|
||||
Height = 72;
|
||||
Width = 12;
|
||||
Height = 18;
|
||||
StartCicycleAnimation("SpiderOnWeb");
|
||||
webLength--;
|
||||
_pos.Y -= 25;
|
||||
|
@ -104,22 +109,19 @@ namespace DangerousD.GameCore.GameObjects.LivingEntities.Monsters
|
|||
isDown = true;
|
||||
}
|
||||
}
|
||||
var entitiesInter = physicsManager.CheckRectangle(new Rectangle((int)Pos.X, (int)Pos.Y, 200, 600));
|
||||
if (entitiesInter.Count > 0)
|
||||
{
|
||||
foreach (var entity in entitiesInter)
|
||||
{
|
||||
if (entity.GetType() == typeof(Player))
|
||||
{
|
||||
player.Death(name);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (webLength == 0)
|
||||
{
|
||||
isAttack = false;
|
||||
}
|
||||
var entities = physicsManager.CheckRectangle(new Rectangle((int)Pos.X, (int)Pos.Y, Width, Height + 200));
|
||||
foreach (var entity in entities)
|
||||
{
|
||||
if (webLength == 4 && entity is Player)
|
||||
{
|
||||
AppManager.Instance.GameManager.players[0].Death(name);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public override void Draw(SpriteBatch spriteBatch)
|
||||
|
@ -142,8 +144,8 @@ namespace DangerousD.GameCore.GameObjects.LivingEntities.Monsters
|
|||
|
||||
public override void Move(GameTime gameTime)
|
||||
{
|
||||
Width = 112;
|
||||
Height = 24;
|
||||
Width = 28;
|
||||
Height = 6;
|
||||
foreach (var entity in physicsManager.CheckRectangle(new Rectangle((int)Pos.X - 7, (int)Pos.Y, 126, 10)))
|
||||
{
|
||||
if (entity.GetType() == typeof(StopTile))
|
||||
|
@ -169,12 +171,24 @@ namespace DangerousD.GameCore.GameObjects.LivingEntities.Monsters
|
|||
}
|
||||
}
|
||||
|
||||
public void Target()
|
||||
public override void Target()
|
||||
{
|
||||
if (player.Pos.X >= Pos.X && player.Pos.X <= Pos.X+Width)
|
||||
{
|
||||
isAttack = true;
|
||||
}
|
||||
}
|
||||
|
||||
public override void OnCollision(GameObject gameObject)
|
||||
{
|
||||
if (gameObject is Player)
|
||||
{
|
||||
if (AppManager.Instance.GameManager.players[0].IsAlive)
|
||||
{
|
||||
Attack();
|
||||
}
|
||||
}
|
||||
base.OnCollision(gameObject);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -15,7 +15,6 @@ namespace DangerousD.GameCore.GameObjects.LivingEntities.Monsters
|
|||
public SpiderWeb(Vector2 position) : base(position)
|
||||
{
|
||||
name = "Web";
|
||||
monster_speed = 1;
|
||||
Width = 16;
|
||||
Height = 0;
|
||||
acceleration = Vector2.Zero;
|
||||
|
@ -43,9 +42,9 @@ namespace DangerousD.GameCore.GameObjects.LivingEntities.Monsters
|
|||
|
||||
}
|
||||
|
||||
public void Target()
|
||||
public override void Target()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -102,6 +102,7 @@ namespace DangerousD.GameCore.GameObjects.LivingEntities.Monsters
|
|||
public override void Attack(GameTime gameTime)
|
||||
{
|
||||
}
|
||||
|
||||
public void Jump()
|
||||
{
|
||||
var getCols = AppManager.Instance.GameManager.physicsManager.CheckRectangle(new Rectangle((int)Pos.X, (int)Pos.Y + Height / 2 - 2, 50, 2));
|
||||
|
@ -148,10 +149,6 @@ namespace DangerousD.GameCore.GameObjects.LivingEntities.Monsters
|
|||
}
|
||||
base.OnCollision(gameObject);/*/
|
||||
}
|
||||
public void Target()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
public void TakeDamage()
|
||||
{
|
||||
monster_health--;
|
||||
|
@ -162,5 +159,9 @@ namespace DangerousD.GameCore.GameObjects.LivingEntities.Monsters
|
|||
Death();
|
||||
}
|
||||
}
|
||||
|
||||
public override void Target()
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -142,7 +142,7 @@ namespace DangerousD.GameCore.GameObjects.LivingEntities.Monsters
|
|||
base.OnCollision(gameObject);
|
||||
}
|
||||
|
||||
public void Target()
|
||||
public override void Target()
|
||||
{
|
||||
if (AppManager.Instance.GameManager.physicsManager.CheckRectangle(new Rectangle((int)Pos.X - 50, (int)Pos.Y, Width + 200, Height), typeof(Player)).Count > 0)
|
||||
{
|
||||
|
|
|
@ -197,7 +197,7 @@ namespace DangerousD.GameCore.GameObjects.LivingEntities
|
|||
StartCicycleAnimation("playerShootRight");
|
||||
Bullet bullet = new Bullet(new Vector2(Pos.X + 16, Pos.Y));
|
||||
bullet.ShootRight();
|
||||
SmokeAfterShoot smokeAfterShoot = new SmokeAfterShoot(new Vector2(Pos.X + 12, Pos.Y - 8));
|
||||
SmokeAfterShoot smokeAfterShoot = new SmokeAfterShoot(new Vector2(Pos.X + 30, Pos.Y + 7));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -214,7 +214,7 @@ namespace DangerousD.GameCore.GameObjects.LivingEntities
|
|||
StartCicycleAnimation("playerShootBoomUpLeft");
|
||||
Bullet bullet = new Bullet(new Vector2(Pos.X, Pos.Y));
|
||||
bullet.ShootLeft();
|
||||
SmokeAfterShoot smokeAfterShoot = new SmokeAfterShoot(new Vector2(Pos.X - 6, Pos.Y - 7));
|
||||
SmokeAfterShoot smokeAfterShoot = new SmokeAfterShoot(new Vector2(Pos.X - 12, Pos.Y + 7));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -345,9 +345,10 @@ namespace DangerousD.GameCore.GameObjects.LivingEntities
|
|||
Height = 5;
|
||||
Width = 5;
|
||||
}
|
||||
int time = 0;
|
||||
protected override GraphicsComponent GraphicsComponent { get; } = new(new List<string> { "playerMoveLeft" }, "playerMoveLeft");
|
||||
Vector2 direction;
|
||||
Vector2 maindirection;
|
||||
public Vector2 maindirection;
|
||||
public void ShootUpRight()
|
||||
{
|
||||
direction = new Vector2(1, -1);
|
||||
|
@ -415,10 +416,6 @@ namespace DangerousD.GameCore.GameObjects.LivingEntities
|
|||
}
|
||||
public override void Update(GameTime gameTime)
|
||||
{
|
||||
if (maindirection != velocity)
|
||||
{
|
||||
AppManager.Instance.GameManager.Remove(this);
|
||||
}
|
||||
base.Update(gameTime);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -40,7 +40,10 @@ public abstract class LivingEntity : Entity
|
|||
//}
|
||||
base.Update(gameTime);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="animationName"></param>
|
||||
public virtual void StartCicycleAnimation(string animationName)
|
||||
{
|
||||
if (GraphicsComponent.GetCurrentAnimation != animationName)
|
||||
|
|
|
@ -241,6 +241,7 @@ namespace DangerousD.GameCore
|
|||
Player.Bullet bullet = new Player.Bullet(networkTask.position);
|
||||
bullet.id = networkTask.objId;
|
||||
bullet.velocity = networkTask.velocity;
|
||||
bullet.maindirection = bullet.velocity;
|
||||
}
|
||||
break;
|
||||
case NetworkTaskOperationEnum.SendPosition:
|
||||
|
|
Loading…
Add table
Reference in a new issue