From 4a87eafbb69eaeafaeca56417f4f6333d3144796 Mon Sep 17 00:00:00 2001 From: JKuijperM Date: Tue, 27 Dec 2022 16:14:56 +0100 Subject: [PATCH] Added the forwar constant movement --- Content/Blueprints/BP_ZombieCharacter.uasset | 4 ++-- Content/Characters/Zombies/Animations/ABP_Zombie.uasset | 4 ++-- Source/EndlessZombie/ZombieCharacter.cpp | 9 +++++++++ Source/EndlessZombie/ZombieCharacter.h | 4 ++++ 4 files changed, 17 insertions(+), 4 deletions(-) diff --git a/Content/Blueprints/BP_ZombieCharacter.uasset b/Content/Blueprints/BP_ZombieCharacter.uasset index ddb6f18..01e5ae3 100644 --- a/Content/Blueprints/BP_ZombieCharacter.uasset +++ b/Content/Blueprints/BP_ZombieCharacter.uasset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:01a2ccb4fae05146826f110d944ac346e311548b5e59e5e8fe7477b6752d0862 -size 33555 +oid sha256:6707e0a03a08e3a1aa73dcdfd39c8839e283b0ca3e3e0119415a35d8dcb359dc +size 34084 diff --git a/Content/Characters/Zombies/Animations/ABP_Zombie.uasset b/Content/Characters/Zombies/Animations/ABP_Zombie.uasset index b7acbc3..9998b6c 100644 --- a/Content/Characters/Zombies/Animations/ABP_Zombie.uasset +++ b/Content/Characters/Zombies/Animations/ABP_Zombie.uasset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:9c79ba59dcd7112872785537bbae4dbf5908ee970011a5191b4524203ebb1fbc -size 354051 +oid sha256:ee57909b9de0cae948caddc473536e0d62853e27ce154066e164b74edba3f39e +size 332032 diff --git a/Source/EndlessZombie/ZombieCharacter.cpp b/Source/EndlessZombie/ZombieCharacter.cpp index 4af971d..187f3c9 100644 --- a/Source/EndlessZombie/ZombieCharacter.cpp +++ b/Source/EndlessZombie/ZombieCharacter.cpp @@ -68,6 +68,7 @@ void AZombieCharacter::BeginPlay() void AZombieCharacter::Tick(float DeltaTime) { Super::Tick(DeltaTime); + MoveForwardConstant(DeltaTime); } @@ -115,4 +116,12 @@ void AZombieCharacter::Move(const FInputActionValue& Value) void AZombieCharacter::Crouch(const FInputActionValue& Value) { +} + +void AZombieCharacter::MoveForwardConstant(float DeltaTime) +{ + FVector vLocation = GetActorLocation(); + vLocation += GetActorForwardVector() * fBaseSpeed * DeltaTime; + SetActorLocation(vLocation); + } \ No newline at end of file diff --git a/Source/EndlessZombie/ZombieCharacter.h b/Source/EndlessZombie/ZombieCharacter.h index 3031726..f1dc85d 100644 --- a/Source/EndlessZombie/ZombieCharacter.h +++ b/Source/EndlessZombie/ZombieCharacter.h @@ -63,4 +63,8 @@ public: UPROPERTY(EditAnywhere, Category = "Movement") float fBaseSpeed = 100.f; + +private: + + void MoveForwardConstant(float DeltaTime); };