Merge branch 'main' of https://github.com/progtime-net/DangerousD
This commit is contained in:
commit
abbcdba429
6 changed files with 64 additions and 7 deletions
BIN
DangerousD/GameCore/.DS_Store
vendored
Normal file
BIN
DangerousD/GameCore/.DS_Store
vendored
Normal file
Binary file not shown.
|
@ -12,9 +12,17 @@ namespace DangerousD.GameCore.GameObjects.LivingEntities.Monsters
|
|||
{
|
||||
internal class Frank : CoreEnemy
|
||||
{
|
||||
private Vector2 position;
|
||||
private bool isGoRight = false;
|
||||
|
||||
public Vector2 Position
|
||||
{
|
||||
get { return position; }
|
||||
}
|
||||
|
||||
public Frank(Vector2 position) : base(position)
|
||||
{
|
||||
this.position = position;
|
||||
Width = 112;
|
||||
Height = 160;
|
||||
GraphicsComponent.StartAnimation("FrankMoveLeft");
|
||||
|
|
|
@ -12,19 +12,52 @@ namespace DangerousD.GameCore.GameObjects.LivingEntities.Monsters
|
|||
{
|
||||
public class FrankBalls : CoreEnemy
|
||||
{
|
||||
private Rectangle collision;
|
||||
private Vector2 position;
|
||||
private int healthBall;
|
||||
private bool isFlyRight = true;
|
||||
private bool isAttacking = false;
|
||||
|
||||
public Rectangle Collision
|
||||
{
|
||||
get { return collision; }
|
||||
}
|
||||
|
||||
public FrankBalls(Vector2 position) : base(position)
|
||||
{
|
||||
this.position = position;
|
||||
name = "FrankBalls";
|
||||
Width = 40;
|
||||
Height = 40;
|
||||
monster_speed = 1;
|
||||
monster_speed = 3;
|
||||
acceleration = Vector2.Zero;
|
||||
}
|
||||
|
||||
protected override GraphicsComponent GraphicsComponent { get; } = new(new List<string> { "BallMoveRight" }, "BallMoveRight");
|
||||
|
||||
public override void Update(GameTime gameTime)
|
||||
{
|
||||
if(!isAttacking)
|
||||
{
|
||||
Move(gameTime);
|
||||
}
|
||||
|
||||
base.Update(gameTime);
|
||||
}
|
||||
|
||||
public override void Attack()
|
||||
{
|
||||
collision = new Rectangle((int)position.X, (int)position.Y, 40, 40);
|
||||
isAttacking = true;
|
||||
|
||||
if(isFlyRight)
|
||||
{
|
||||
AppManager.Instance.GameManager.players[0].Death(name);
|
||||
}
|
||||
else if(!isFlyRight)
|
||||
{
|
||||
AppManager.Instance.GameManager.players[0].Death(name);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
@ -35,7 +68,19 @@ namespace DangerousD.GameCore.GameObjects.LivingEntities.Monsters
|
|||
|
||||
public override void Move(GameTime gameTime)
|
||||
{
|
||||
velocity.X = 0;
|
||||
velocity.Y = 0;
|
||||
|
||||
if(isFlyRight)
|
||||
{
|
||||
velocity.X += monster_speed;
|
||||
velocity.Y += monster_speed;
|
||||
}
|
||||
else if(!isFlyRight)
|
||||
{
|
||||
velocity.X -= monster_speed;
|
||||
velocity.Y -= monster_speed;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -48,7 +48,7 @@ namespace DangerousD.GameCore.GameObjects.LivingEntities.Monsters
|
|||
isAttaking = true;
|
||||
if (isGoRight)
|
||||
{
|
||||
if (GraphicsComponent.GetCurrentAnimation != "ZombieMoveRight")
|
||||
if (GraphicsComponent.GetCurrentAnimation != "ZombieRightAttack")
|
||||
{
|
||||
GraphicsComponent.StartAnimation("ZombieAttackRight");
|
||||
}
|
||||
|
|
|
@ -17,7 +17,6 @@ namespace DangerousD.GameCore.GameObjects.LivingEntities
|
|||
Width = 32;
|
||||
Height = 64;
|
||||
AppManager.Instance.InputManager.MovEventJump += AnimationJump;
|
||||
|
||||
}
|
||||
public bool IsAlive { get { return isAlive; } }
|
||||
|
||||
|
|
|
@ -19,13 +19,18 @@ namespace DangerousD.GameCore
|
|||
|
||||
public void LoadSounds() // метод для загрузки звуков из папки
|
||||
{
|
||||
string[] soundFiles = Directory.GetFiles("../../../Content").Where(x=>x.EndsWith("mp3")).Select(x=>x.Split("\\").Last().Replace(".mp3", "")).ToArray();// папка со звуками там где exe
|
||||
var k = Directory.GetFiles("../../..//Content").Where(x => x.EndsWith("mp3"));
|
||||
if (k.Count()>0)
|
||||
{
|
||||
|
||||
string[] soundFiles = k.Select(x => x.Split("\\").Last().Split("/").Last().Replace(".mp3", "")).ToArray();// папка со звуками там где exe
|
||||
foreach (var soundFile in soundFiles)
|
||||
{
|
||||
Sounds.Add(soundFile, AppManager.Instance.Content.Load<SoundEffect>(soundFile).CreateInstance());
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public void StartAmbientSound(string soundName) // запустить звук у которого нет позиции
|
||||
{
|
||||
|
|
Loading…
Add table
Reference in a new issue