PlayerAdding

This commit is contained in:
Kaktus200020 2023-08-17 20:13:38 +03:00
parent d3a0c64596
commit d1e880eedc
2 changed files with 17 additions and 12 deletions

View file

@ -752,7 +752,7 @@
</object>
</objectgroup>
<objectgroup id="10" name="Player" class="LivingEntities.Player">
<object id="47" x="-260" y="461.333">
<object id="47" x="-525" y="461.333">
<point/>
</object>
</objectgroup>

View file

@ -25,8 +25,8 @@ namespace DangerousD.GameCore.GameObjects.LivingEntities
public Player(Vector2 position) : base(position)
{
Width = 32;
Height = 64;
Width = 16;
Height = 32;
AppManager.Instance.InputManager.ShootEvent += Shoot;
@ -81,7 +81,7 @@ namespace DangerousD.GameCore.GameObjects.LivingEntities
}
public void AnimationJump()
{
velocity.Y = -30;
velocity.Y = -11;
isJump = true;
// здесь будет анимация
}
@ -105,30 +105,35 @@ namespace DangerousD.GameCore.GameObjects.LivingEntities
public void Move(GameTime gameTime)
{
float delta = (float)gameTime.ElapsedGameTime.TotalSeconds;
if (Keyboard.GetState().IsKeyDown(Keys.D))
if (AppManager.Instance.InputManager.VectorMovementDirection.X==1)
{
if (GraphicsComponent.GetCurrentAnimation != "ZombieMoveRight")
if (GraphicsComponent.GetCurrentAnimation != "ZombieMoveRight")//идёт направо
{
GraphicsComponent.StartAnimation("ZombieMoveRight");
}
velocity.X = 10;
velocity.X = 5;
}
else if (Keyboard.GetState().IsKeyDown(Keys.A))
else if (AppManager.Instance.InputManager.VectorMovementDirection.X == -1)//идёт налево
{
if (GraphicsComponent.GetCurrentAnimation != "ZombieMoveLeft")
{
GraphicsComponent.StartAnimation("ZombieMoveLeft");
}
velocity.X = -10;
velocity.X = -5;
}
if (Keyboard.GetState().IsKeyDown(Keys.Space) && !isJump)
else if(AppManager.Instance.InputManager.VectorMovementDirection.X == 0)//стоит
{
AnimationJump();
if (GraphicsComponent.GetCurrentAnimation != "ZombieMoveLeft")
{
GraphicsComponent.StartAnimation("ZombieMoveLeft");
}
velocity.X = 0;
}
}
public void MoveDown()
{
velocity.Y = -11;
isJump = true;
}
}