diff --git a/Source/vampires/Pickup.cpp b/Source/vampires/Pickup.cpp index 3820b41..e25b655 100644 --- a/Source/vampires/Pickup.cpp +++ b/Source/vampires/Pickup.cpp @@ -5,6 +5,7 @@ #include "PlayerCharacter.h" #include "Kismet/GameplayStatics.h" +#include "Kismet/KismetMathLibrary.h" // Sets default values APickup::APickup() @@ -14,8 +15,13 @@ APickup::APickup() // Create Sphere Component SphereComponent = CreateDefaultSubobject(TEXT("Sphere Component")); - SphereComponent->SetupAttachment(RootComponent); + SetRootComponent(SphereComponent); SphereComponent->SetSphereRadius(25.0f); + + SpriteComponent = CreateDefaultSubobject(TEXT("Sprite Component")); + SpriteComponent->SetRelativeRotation(FRotator(0.0f, 90.0f,-90.0f)); + SpriteComponent->SetRelativeScale3D(FVector(.5f, .5f, .5f)); + SpriteComponent->SetupAttachment(RootComponent); } // Called when the game starts or when spawned diff --git a/Source/vampires/Pickup.h b/Source/vampires/Pickup.h index 74a5055..8187212 100644 --- a/Source/vampires/Pickup.h +++ b/Source/vampires/Pickup.h @@ -5,6 +5,7 @@ #include "CoreMinimal.h" #include "Components/SphereComponent.h" #include "GameFramework/Actor.h" +#include "PaperSpriteComponent.h" #include "Pickup.generated.h" UCLASS() @@ -21,7 +22,10 @@ public: double PickupMovementSpeed = 1000; UPROPERTY(EditDefaultsOnly, BlueprintReadWrite) - USphereComponent* SphereComponent; + USphereComponent* SphereComponent = nullptr; + + UPROPERTY(EditAnywhere) + UPaperSpriteComponent* SpriteComponent = nullptr; public: // Sets default values for this actor's properties diff --git a/Source/vampires/vampires.Build.cs b/Source/vampires/vampires.Build.cs index 62aeb11..309ca03 100644 --- a/Source/vampires/vampires.Build.cs +++ b/Source/vampires/vampires.Build.cs @@ -8,7 +8,7 @@ public class vampires : ModuleRules { PCHUsage = PCHUsageMode.UseExplicitOrSharedPCHs; - PublicDependencyModuleNames.AddRange(new string[] { "Core", "CoreUObject", "Engine", "InputCore", "EnhancedInput" }); + PublicDependencyModuleNames.AddRange(new string[] { "Core", "CoreUObject", "Engine", "InputCore", "EnhancedInput", "Paper2D" }); PrivateDependencyModuleNames.AddRange(new string[] { });