Skip to content

Commit

Permalink
2. Unreal Engine 5 C++ | Coding and Debugging with Rider
Browse files Browse the repository at this point in the history
  • Loading branch information
kaijurgeit committed Mar 18, 2024
1 parent 39f8eee commit 4c61ae8
Show file tree
Hide file tree
Showing 11 changed files with 142 additions and 3 deletions.
4 changes: 2 additions & 2 deletions Content/Fab/Characters/Player/BP_PlayerCharacter.uasset
Git LFS file not shown
5 changes: 4 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@ Fab is a co-op third-person RPG which aims at teaching gameplay programming, bei

## Links to each Video and Commit

#### 2. Unreal Engine 5 C++ | Coding and Debugging with Rider
[Video](https://youtu.be/IT9ihIc9KyI) | [main](https://github.com/kaijurgeit/UnrealEngine5CppTutorials/commit/main)

#### 1. Unreal Engine 5 C++ | Starting with a Blank Project
[Video](https://youtu.be/ikD-xaCcFUU) | [633068d](https://github.com/kaijurgeit/UnrealEngine5CppTutorials/commit/main)
[Video](https://youtu.be/ikD-xaCcFUU) | [39f8eee](https://github.com/kaijurgeit/UnrealEngine5CppTutorials/commit/39f8eee01a85fbe87f8b6aa5a23a4adfe7ce6086)

17 changes: 17 additions & 0 deletions Source/Fab/Characters/EnemyCharacter.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
// Fab by Kai Jurgeit


#include "EnemyCharacter.h"


AEnemyCharacter::AEnemyCharacter()
{
PrimaryActorTick.bCanEverTick = true;
}

void AEnemyCharacter::BeginPlay()
{
Super::BeginPlay();

}

19 changes: 19 additions & 0 deletions Source/Fab/Characters/EnemyCharacter.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
// Fab by Kai Jurgeit

#pragma once

#include "CoreMinimal.h"
#include "FabCharacterBase.h"
#include "EnemyCharacter.generated.h"

UCLASS()
class FAB_API AEnemyCharacter : public AFabCharacterBase
{
GENERATED_BODY()

public:
AEnemyCharacter();

protected:
virtual void BeginPlay() override;
};
17 changes: 17 additions & 0 deletions Source/Fab/Characters/FabCharacterBase.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
// Fab by Kai Jurgeit


#include "FabCharacterBase.h"


AFabCharacterBase::AFabCharacterBase()
{
PrimaryActorTick.bCanEverTick = true;
}

void AFabCharacterBase::BeginPlay()
{
Super::BeginPlay();

}

19 changes: 19 additions & 0 deletions Source/Fab/Characters/FabCharacterBase.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
// Fab by Kai Jurgeit

#pragma once

#include "CoreMinimal.h"
#include "GameFramework/Character.h"
#include "FabCharacterBase.generated.h"

UCLASS()
class FAB_API AFabCharacterBase : public ACharacter
{
GENERATED_BODY()

public:
AFabCharacterBase();

protected:
virtual void BeginPlay() override;
};
32 changes: 32 additions & 0 deletions Source/Fab/Characters/PlayerCharacter.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
// Fab by Kai Jurgeit


#include "PlayerCharacter.h"

#include "FabMacros.h"


APlayerCharacter::APlayerCharacter()
{
PrimaryActorTick.bCanEverTick = true;
}

void APlayerCharacter::Tick(float DeltaSeconds)
{
Super::Tick(DeltaSeconds);
SPHERE_TICK(GetActorLocation());
LINE_TICK(GetActorLocation(), FVector(2200.f, 700.f, 150.f));
}

void APlayerCharacter::BeginPlay()
{
Super::BeginPlay();

UE_LOG(LogTemp, Warning, TEXT("%s"), *FString(__FUNCTION__));
UE_LOG(LogTemp, Warning, TEXT("PrimaryActorTick.bCanEverTick = %s"), PrimaryActorTick.bCanEverTick ? TEXT("true") : TEXT("false"));
PRINT("Hello, %s", *FString(__FUNCTION__));
FVector TargetLocation(2200.f, 700.f, 150.f);
SPHERE(TargetLocation);
LINE(GetActorLocation(), TargetLocation);
}

20 changes: 20 additions & 0 deletions Source/Fab/Characters/PlayerCharacter.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
// Fab by Kai Jurgeit

#pragma once

#include "CoreMinimal.h"
#include "FabCharacterBase.h"
#include "PlayerCharacter.generated.h"

UCLASS()
class FAB_API APlayerCharacter : public AFabCharacterBase
{
GENERATED_BODY()

public:
APlayerCharacter();
virtual void Tick(float DeltaSeconds) override;

protected:
virtual void BeginPlay() override;
};
2 changes: 2 additions & 0 deletions Source/Fab/Fab.Build.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ public Fab(ReadOnlyTargetRules Target) : base(Target)
PublicDependencyModuleNames.AddRange(new string[] { "Core", "CoreUObject", "Engine", "InputCore" });

PrivateDependencyModuleNames.AddRange(new string[] { });

PublicIncludePaths.Add("Fab");

// Uncomment if you are using Slate UI
// PrivateDependencyModuleNames.AddRange(new string[] { "Slate", "SlateCore" });
Expand Down
8 changes: 8 additions & 0 deletions Source/Fab/FabMacros.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#pragma once
#include "DrawDebugHelpers.h"

#define PRINT(DebugMessage, ...) { GEngine->AddOnScreenDebugMessage(-1, 2.f, FColor::Purple, FString::Printf(TEXT(DebugMessage), __VA_ARGS__)); }
#define SPHERE(Center) if (GetWorld()) DrawDebugSphere(GetWorld(), Center, 20.f, 16, FColor::Blue, true);
#define SPHERE_TICK(Center) if (GetWorld()) DrawDebugSphere(GetWorld(), Center, 20.f, 16, FColor::Green, false);
#define LINE(LineStart, LineEnd) if (GetWorld()) DrawDebugLine(GetWorld(), LineStart, LineEnd, FColor::Blue, true);
#define LINE_TICK(LineStart, LineEnd) if (GetWorld()) DrawDebugLine(GetWorld(), LineStart, LineEnd, FColor::Green, false);
2 changes: 2 additions & 0 deletions cleanup.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
echo 'Cleaning'
powershell.exe -NoExit -ExecutionPolicy -Bypass -Command "ls -Recurse -Include Build, Intermediate, Binaries, *.sln, .vs | rmdir -Force -Recurse;"

0 comments on commit 4c61ae8

Please sign in to comment.