PlayerAdding
This commit is contained in:
parent
d3a0c64596
commit
d1e880eedc
2 changed files with 17 additions and 12 deletions
|
@ -752,7 +752,7 @@
|
||||||
</object>
|
</object>
|
||||||
</objectgroup>
|
</objectgroup>
|
||||||
<objectgroup id="10" name="Player" class="LivingEntities.Player">
|
<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/>
|
<point/>
|
||||||
</object>
|
</object>
|
||||||
</objectgroup>
|
</objectgroup>
|
||||||
|
|
|
@ -25,8 +25,8 @@ namespace DangerousD.GameCore.GameObjects.LivingEntities
|
||||||
|
|
||||||
public Player(Vector2 position) : base(position)
|
public Player(Vector2 position) : base(position)
|
||||||
{
|
{
|
||||||
Width = 32;
|
Width = 16;
|
||||||
Height = 64;
|
Height = 32;
|
||||||
|
|
||||||
AppManager.Instance.InputManager.ShootEvent += Shoot;
|
AppManager.Instance.InputManager.ShootEvent += Shoot;
|
||||||
|
|
||||||
|
@ -81,7 +81,7 @@ namespace DangerousD.GameCore.GameObjects.LivingEntities
|
||||||
}
|
}
|
||||||
public void AnimationJump()
|
public void AnimationJump()
|
||||||
{
|
{
|
||||||
velocity.Y = -30;
|
velocity.Y = -11;
|
||||||
isJump = true;
|
isJump = true;
|
||||||
// здесь будет анимация
|
// здесь будет анимация
|
||||||
}
|
}
|
||||||
|
@ -105,30 +105,35 @@ namespace DangerousD.GameCore.GameObjects.LivingEntities
|
||||||
public void Move(GameTime gameTime)
|
public void Move(GameTime gameTime)
|
||||||
{
|
{
|
||||||
float delta = (float)gameTime.ElapsedGameTime.TotalSeconds;
|
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");
|
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")
|
if (GraphicsComponent.GetCurrentAnimation != "ZombieMoveLeft")
|
||||||
{
|
{
|
||||||
GraphicsComponent.StartAnimation("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()
|
public void MoveDown()
|
||||||
{
|
{
|
||||||
|
velocity.Y = -11;
|
||||||
|
isJump = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue