From 08e7fcecba30a4053197f366f9df5da6cda403ba Mon Sep 17 00:00:00 2001 From: MH261677 Date: Thu, 30 Nov 2023 12:19:43 +0000 Subject: [PATCH] Added Sprint Basic Function and Binds To Shift Key --- .../Blueprints/BP_FirstPersonCharacter.uasset | 4 ++-- .../FirstPerson/Input/Actions/IA_Sprint.uasset | 3 +++ .../Content/FirstPerson/Input/IMC_Default.uasset | 4 ++-- .../EndlessVendetta/EndlessVendettaCharacter.cpp | 12 ++++++++++++ .../EndlessVendetta/EndlessVendettaCharacter.h | 7 +++++++ 5 files changed, 26 insertions(+), 4 deletions(-) create mode 100644 EndlessVendetta/Content/FirstPerson/Input/Actions/IA_Sprint.uasset diff --git a/EndlessVendetta/Content/FirstPerson/Blueprints/BP_FirstPersonCharacter.uasset b/EndlessVendetta/Content/FirstPerson/Blueprints/BP_FirstPersonCharacter.uasset index 68f6e73f..9916b65d 100644 --- a/EndlessVendetta/Content/FirstPerson/Blueprints/BP_FirstPersonCharacter.uasset +++ b/EndlessVendetta/Content/FirstPerson/Blueprints/BP_FirstPersonCharacter.uasset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:b0a493fd95d8b0b43306329298c058cfa2f164ec071457bc575a8eafee95f1b1 -size 53936 +oid sha256:b286c36bff935d0bb4a21224449c4dbd84f2dd72c29fb14da3e97822f0a9c9d0 +size 54078 diff --git a/EndlessVendetta/Content/FirstPerson/Input/Actions/IA_Sprint.uasset b/EndlessVendetta/Content/FirstPerson/Input/Actions/IA_Sprint.uasset new file mode 100644 index 00000000..68e93308 --- /dev/null +++ b/EndlessVendetta/Content/FirstPerson/Input/Actions/IA_Sprint.uasset @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:467d285447b71f9b4417bde598153ef906f87de4d2244f0b3cbaac1b712d693b +size 1360 diff --git a/EndlessVendetta/Content/FirstPerson/Input/IMC_Default.uasset b/EndlessVendetta/Content/FirstPerson/Input/IMC_Default.uasset index 6f199667..c5bb3d48 100644 --- a/EndlessVendetta/Content/FirstPerson/Input/IMC_Default.uasset +++ b/EndlessVendetta/Content/FirstPerson/Input/IMC_Default.uasset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:750ab013f24a45539806fd40e9cd2a328ff31b40c5d3edcce0676fb3bf6935ee -size 18664 +oid sha256:4b09c7676dc66a56a9f2dd750aa646db53db086cb9604fed17e025259b4821db +size 19248 diff --git a/EndlessVendetta/Source/EndlessVendetta/EndlessVendettaCharacter.cpp b/EndlessVendetta/Source/EndlessVendetta/EndlessVendettaCharacter.cpp index 04a8f415..7187b03a 100644 --- a/EndlessVendetta/Source/EndlessVendetta/EndlessVendettaCharacter.cpp +++ b/EndlessVendetta/Source/EndlessVendetta/EndlessVendettaCharacter.cpp @@ -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) diff --git a/EndlessVendetta/Source/EndlessVendetta/EndlessVendettaCharacter.h b/EndlessVendetta/Source/EndlessVendetta/EndlessVendettaCharacter.h index f893d625..5ba68440 100644 --- a/EndlessVendetta/Source/EndlessVendetta/EndlessVendettaCharacter.h +++ b/EndlessVendetta/Source/EndlessVendetta/EndlessVendettaCharacter.h @@ -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")