Ejemplo n.º 1
0
    /// <summary>
    /// Check if the player is moving (direction (joypad) or velocity (acceleration/decceleration))
    /// </summary>
    private void _Movement_isPlayerMoving()
    {
        if (IS_PLATFORMER)
        {
            Direction = Nucleus_Movement.GetMovingDirection("L_left", "L_right", false);
        }
        else
        {
            Direction = Nucleus_Movement.GetMovingDirection("L_left", "L_right", false, "L_up", "L_down");
        }

        // Check if the player is moving : he has a direction (joypad) or a velocity (acceleration/decceleration)
        isMoving = (Velocity.x != 0.0f || Velocity.y != 0.0f || Direction.x != 0.0f || Direction.y != 0.0f) ? true : false;
    }
Ejemplo n.º 2
0
 /// <summary>
 /// Movements on axis
 /// </summary>
 /// <param name="delta">delta time</param>
 private void _Movement_UpdateVelocity(float delta)
 {
     // Calculate velocity and move the player
     if (IS_PLATFORMER)
     {
         Velocity = Nucleus_Movement.CalculateVelocity(Velocity, MaxSpeed, Acceleration, Decceleration, Direction, delta);
         Velocity = Nucleus_Utils.StateMachine_Template.RootNode.MoveAndSlide(Velocity, Nucleus_Utils.VECTOR_FLOOR);
     }
     else
     {
         Velocity = Nucleus_Movement.CalculateVelocity(Velocity, MaxSpeed, Acceleration, Decceleration, Direction, delta, MaxSpeed.y);
         Velocity = Nucleus_Utils.StateMachine_Template.RootNode.MoveAndSlide(Velocity);
     }
 }
Ejemplo n.º 3
0
 /// <summary>
 /// Make the player jump
 /// </summary>
 private void _Movement_Jump()
 {
     _moveNode.Velocity += Nucleus_Movement.CalculateJumpVelocity(_moveNode.Velocity, _moveNode.MaxSpeed, JumpImpulse);
     _jumpCount++;
 }