private void updateSliding(GameTime a_gameTime)
{
if (m_slideTimer < a_gameTime.TotalGameTime.TotalMilliseconds && m_slideTimer != 0)
{
m_currentState = State.Jumping;
m_slideTimer = 0;
return;
}
m_imgOffsetX = 0;
if (((!m_facingRight && KeyboardHandler.isKeyPressed(GameState.getRightKey())) || (m_facingRight && KeyboardHandler.isKeyPressed(GameState.getLeftKey())))
&& m_collidedWithWall)
{
m_slideTimer = 0;
}
else
{
if (m_slideTimer == 0)
m_slideTimer = (int)a_gameTime.TotalGameTime.TotalMilliseconds + 150;
}
if (KeyboardHandler.keyClicked(GameState.getJumpKey()) && m_speed.Y != 0)
{
m_speed.Y = -JUMPSTRENGTH;
if (m_facingRight == true)
m_speed.X += JUMPSTRENGTH;
else
m_speed.X -= JUMPSTRENGTH;
m_currentState = State.Jumping;
m_slideTimer = 0;
}
else if (m_speed.Y > SLIDESPEED)
m_speed.Y = SLIDESPEED;
}