diff --git a/Content/Maps/Main.umap b/Content/Maps/Main.umap index e046a26..690eaef 100644 --- a/Content/Maps/Main.umap +++ b/Content/Maps/Main.umap @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:0fcd36633b5117d30e6052d8cdf9f69038e463b42860a1c07da446fcbec0fc4c -size 95077 +oid sha256:be4b434f627c8aff0bec1a02b63347d9f731a60b7096b25015d72bf9a9c6c25a +size 95150 diff --git a/Source/ToonTanks/Tank.cpp b/Source/ToonTanks/Tank.cpp index 66bf574..7eb3018 100644 --- a/Source/ToonTanks/Tank.cpp +++ b/Source/ToonTanks/Tank.cpp @@ -5,6 +5,7 @@ #include "Camera/CameraComponent.h" #include "GameFramework/SpringArmComponent.h" +#include "Kismet/GameplayStatics.h" ATank::ATank() { @@ -24,6 +25,7 @@ void ATank::SetupPlayerInputComponent(UInputComponent* PlayerInputComponent) void ATank::Move(float Value) { FVector DeltaLocation = FVector::ZeroVector; - DeltaLocation.X = Value; + float DeltaTime = UGameplayStatics::GetWorldDeltaSeconds(this); + DeltaLocation.X = Value * DeltaTime * Speed; this->AddActorLocalOffset(DeltaLocation); } \ No newline at end of file diff --git a/Source/ToonTanks/Tank.h b/Source/ToonTanks/Tank.h index 8a985c1..37d0409 100644 --- a/Source/ToonTanks/Tank.h +++ b/Source/ToonTanks/Tank.h @@ -27,5 +27,8 @@ private: UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = "Component", meta=(AllowPrivateAccess = "true")) class UCameraComponent* Camera; + UPROPERTY(EditAnywhere, Category = "Movement", BlueprintReadWrite, meta=(AllowPrivateAccess="true")) + float Speed = 400.0f; + void Move(float Value); };