Added Sprint Basic Function and Binds To Shift Key

This commit is contained in:
MH261677 2023-11-30 12:19:43 +00:00
parent b9a8bf4f85
commit 08e7fcecba
5 changed files with 26 additions and 4 deletions

View File

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:467d285447b71f9b4417bde598153ef906f87de4d2244f0b3cbaac1b712d693b
size 1360

Binary file not shown.

View File

@ -134,6 +134,7 @@ void AEndlessVendettaCharacter::SetupPlayerInputComponent(class UInputComponent*
//Moving
EnhancedInputComponent->BindAction(MoveAction, ETriggerEvent::Triggered, this, &AEndlessVendettaCharacter::Move);
EnhancedInputComponent->BindAction(SprintAction, ETriggerEvent::Triggered, this, &AEndlessVendettaCharacter::Sprint);
//Looking
EnhancedInputComponent->BindAction(LookAction, ETriggerEvent::Triggered, this, &AEndlessVendettaCharacter::Look);
@ -430,6 +431,17 @@ void AEndlessVendettaCharacter::StopFire()
}
}
void AEndlessVendettaCharacter::Sprint()
{
MoveGroundSpeed *= 2;
// bIsPlayerSprinting = true;
// if (bIsPlayerSprinting)
// {
// MoveGroundSpeed *= 2;
// bIsPlayerSprinting = false;
// }
}
void AEndlessVendettaCharacter::GunRightClick()
{
if (IsValid(PrimaryWeapon) && !bIsScoped)

View File

@ -73,6 +73,9 @@ class AEndlessVendettaCharacter : public ACharacter
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = Input, meta = (AllowPrivateAccess = "true"))
UInputAction* InteractAction;
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = Input, meta = (AllowPrivateAccess = "true"))
UInputAction* SprintAction;
public:
AEndlessVendettaCharacter();
@ -114,6 +117,8 @@ public:
bool bIsPlayerMoving = false;
bool bIsPlayerSprinting = false;
double MoveGroundSpeed;
/** Look Input Action */
@ -156,6 +161,8 @@ public:
UFUNCTION(BlueprintCallable, Category = "Weapons")
void StopFire();
void Sprint();
UArrowComponent* ScopedLocationArrow;
UPROPERTY(EditAnywhere, Category = "Dont Touch")