Merge branch 'SilasMaster'

This commit is contained in:
Timofey06 2023-08-18 03:02:27 +03:00
commit dd6728967f
6 changed files with 198 additions and 29 deletions

162
DangerousD/Content/boss.tmx Normal file
View file

@ -0,0 +1,162 @@
<?xml version="1.0" encoding="UTF-8"?>
<map version="1.10" tiledversion="1.10.2" orientation="orthogonal" renderorder="right-down" width="200" height="200" tilewidth="16" tileheight="16" infinite="1" nextlayerid="4" nextobjectid="3">
<tileset firstgid="1" source="../../../../../Desktop/DangerousD map/map.tsx"/>
<layer id="1" name="Слой тайлов 1" class="StopTile" width="200" height="200">
<data encoding="csv">
<chunk x="-16" y="-32" width="16" height="16">
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,799,799,799,799,799,799,799,799,
0,0,0,0,0,0,0,0,799,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,799,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,799,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,799,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,799,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,799,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,799,0,0,0,0,0,0,0
</chunk>
<chunk x="0" y="-32" width="16" height="16">
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
799,799,799,799,799,799,799,799,799,799,799,799,799,799,799,799,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
</chunk>
<chunk x="16" y="-32" width="16" height="16">
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
799,799,799,799,799,799,799,799,799,799,799,799,799,799,799,799,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
</chunk>
<chunk x="32" y="-32" width="16" height="16">
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0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,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
799,799,799,799,799,799,799,799,799,799,799,799,799,799,799,799
</chunk>
<chunk x="32" y="-16" width="16" height="16">
0,0,0,0,0,0,0,0,0,0,799,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,799,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,799,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,799,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,799,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,799,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,799,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,799,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,799,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,799,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,799,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,799,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,799,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,799,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,799,0,0,0,0,0,
799,799,799,799,799,799,799,799,799,799,799,0,0,0,0,0
</chunk>
</data>
</layer>
<objectgroup id="2" name="Слой объектов 1" class="LivingEntities">
<object id="1" name="DEBUGUS" type="Player" x="293.333" y="-126.667">
<point/>
</object>
</objectgroup>
<objectgroup id="3" name="Слой объектов 2" class="LivingEntities.Monsters">
<object id="2" type="SilasMaster" x="82.6667" y="-186.667">
<point/>
</object>
</objectgroup>
</map>

View file

@ -12,20 +12,22 @@ namespace DangerousD.GameCore.GameObjects.Entities
{
public class SilasBall : LivingEntity
{
private bool IsVisibility=true;
private Vector2 v;
public SilasBall(Vector2 position) : base(position)
{
Height = 60;
Width = 60;
Height = 24;
Width = 24;
acceleration = Vector2.Zero;
}
public SilasBall(Vector2 position, Vector2 velosity) : base(position)
{
Height = 60;
Width = 60;
Height = 24;
Width = 24;
acceleration = Vector2.Zero;
velocity = velosity;
v = velosity;
}
@ -33,17 +35,17 @@ namespace DangerousD.GameCore.GameObjects.Entities
public override void Update(GameTime gameTime)
{
base.Update(gameTime);
if (AppManager.Instance.GameManager.physicsManager.CheckRectangle(Rectangle).Count>0)
if (AppManager.Instance.GameManager.physicsManager.CheckRectangle( new Rectangle(Rectangle.X-2,Rectangle.Y-2,Rectangle.Width+8,Rectangle.Height+8)).Count>0)
{
IsVisibility = false;
AppManager.Instance.GameManager.Remove(this);
}
velocity = v;
}
public override void Draw(SpriteBatch spriteBatch)
{
if (IsVisibility)
{
base.Draw(spriteBatch);
}
base.Draw(spriteBatch);
}
}

View file

@ -15,8 +15,8 @@ namespace DangerousD.GameCore.GameObjects.LivingEntities.Monsters
public SilasHands(Vector2 position) : base(position)
{
name = "SilasHand";
Width = 48;
Height = 48;
Width = 16;
Height = 16;
monster_health = 2;
monster_speed = 2;
acceleration = Vector2.Zero;

View file

@ -24,21 +24,17 @@ namespace DangerousD.GameCore.GameObjects.LivingEntities.Monsters
public SilasMaster(Vector2 position) : base(position)
{
name = "SilasMaster";
Width = 144;
Height = 160;
Width = 48;
Height = 53;
monster_health = 15;
monster_speed = 4;
monster_speed = 2;
acceleration = Vector2.Zero;
leftBorder = (int)position.X - 60;
rightBorder = (int)position.X + 120;
acceleration = Vector2.Zero;
hands.Add(new SilasHands(new Vector2(Pos.X+60,Pos.Y+120)));
hands.Add(new SilasHands(new Vector2(Pos.X + 90, Pos.Y + 120)));
for (int i = 0; i < 4; i++)
{
SilasBall silasball = new SilasBall(new Vector2(Pos.X + i * 40, Pos.Y + 120), new Vector2((i - 2) * 4, 6));
balls.Add(silasball);
}
hands.Add(new SilasHands(new Vector2(Pos.X+0,Pos.Y+53)));
hands.Add(new SilasHands(new Vector2(Pos.X + 24, Pos.Y + 53)));
}
protected override GraphicsComponent GraphicsComponent { get; } = new GraphicsComponent(new List<string>() { "SilasMove", "SilasAttack" }, "SilasMove");
public override void Attack()
@ -64,12 +60,15 @@ namespace DangerousD.GameCore.GameObjects.LivingEntities.Monsters
private void SpawnAttackBall()
{
for (int i = 0; i < balls.Count; i++)
balls.Clear();
for (int i = 0; i < 4; i++)
{
balls[i].SetPosition(new Vector2(Pos.X + i * 40, Pos.Y + 120));
SilasBall silasball = new SilasBall(new Vector2(Pos.X + i * 12, Pos.Y + 53), new Vector2((i - 2) * 2, 2));
balls.Add(silasball);
}
}
public void Attack(GameTime gameTime)

View file

@ -28,6 +28,7 @@ namespace DangerousD.GameCore.GameObjects.LivingEntities
private bool isAttacked = false;
private bool isShooting = false;
public GameObject objectAttack;
public bool isInvincible;
private int bullets;
public bool FallingThroughPlatform = false;
@ -60,6 +61,11 @@ namespace DangerousD.GameCore.GameObjects.LivingEntities
};
}
public Player(Vector2 position, bool isInvincible) : this(position)
{
this.isInvincible = isInvincible;
}
public bool IsAlive { get { return isAlive; } }
protected override GraphicsComponent GraphicsComponent { get; } = new(new List<string> { "playerMoveLeft", "playerMoveRight", "DeathFromZombie", "playerRightStay", "playerStayLeft",
@ -160,7 +166,7 @@ namespace DangerousD.GameCore.GameObjects.LivingEntities
AppManager.Instance.DebugHUD.Log("not falling");
}
GraphicsComponent.SetCameraPosition(Pos);
if (!isAttacked)
if (!isAttacked || isInvincible)
{
Move(gameTime);
}

View file

@ -202,7 +202,7 @@ namespace DangerousD.GameCore
case GameState.Lobby:
break;
case GameState.Game:
GameManager.mapManager.LoadLevel("lvl");
GameManager.mapManager.LoadLevel("boss");
break;
case GameState.Death:
break;