Question on how to add a double jump and eventually a wall dodge

Appreciate all the help, It works now. Looking forward to seeing the changes in 4.2 as well.
Code for anyone looking for it (some used from the FPS tutorial linked in OP):

MyCharacter.h


class AMyCharacter : public ACharacter
{
	GENERATED_UCLASS_BODY()

	virtual void BeginPlay() OVERRIDE;

	UFUNCTION()
		void OnStartJump();
	UFUNCTION()
		void OnStopJump();

	UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Character Movement")
		int32 MaxJumpCount;
	UPROPERTY()
		int32 CurrentJumpCount;

	bool CanJump() const OVERRIDE;

	virtual void OnLanded(const FHitResult& Hit) OVERRIDE;
}

MyCharacter.cpp


void AMyCharacter::BeginPlay()
{
	Super::BeginPlay();

	MaxJumpCount = 3;
	CurrentJumpCount = 0;

}

bool AMyCharacter::CanJump() const
{
	return Super::CanJump() || (CharacterMovement->MovementMode == MOVE_Falling && CurrentJumpCount > 0 && CurrentJumpCount < MaxJumpCount);
}

void AMyCharacter::OnStartJump()
{
	bPressedJump = true;
	CurrentJumpCount++;
}

void AMyCharacter::OnLanded(const FHitResult& Hit)
{
	CurrentJumpCount = 0;
}

void AMyCharacter::OnStopJump()
{
	bPressedJump = false;
}


1 Like