Basic horizontal velocity using fixed point math

This commit is contained in:
Kevin Poretti 2022-01-27 21:34:02 -05:00
parent b2b6f339d8
commit 2b4c138b13
16 changed files with 295 additions and 136 deletions

View File

@ -1,7 +1,7 @@
[/Script/EngineSettings.GameMapsSettings] [/Script/EngineSettings.GameMapsSettings]
EditorStartupMap=/Game/Maps/TrainingStage/TrainingStage.TrainingStage EditorStartupMap=/Game/Maps/Debug/DebugStage.DebugStage
LocalMapOptions= LocalMapOptions=
TransitionMap= TransitionMap=
bUseSplitscreen=True bUseSplitscreen=True
@ -37,3 +37,7 @@ r.Editor.SkipSourceControlCheckForEditablePackages = 1
[/Script/Engine.RendererSettings] [/Script/Engine.RendererSettings]
r.DefaultFeature.AntiAliasing=0 r.DefaultFeature.AntiAliasing=0
[CoreRedirects]
+ClassRedirects=(OldName="/Script/KOFForever.KOFRenderableCharacter",NewName="/Script/KOFForever.KOFBaseCharacter")

View File

@ -1,4 +1,5 @@
[/Script/Engine.InputSettings] [/Script/Engine.InputSettings]
-AxisConfig=(AxisKeyName="Gamepad_LeftX",AxisProperties=(DeadZone=0.25,Exponent=1.f,Sensitivity=1.f)) -AxisConfig=(AxisKeyName="Gamepad_LeftX",AxisProperties=(DeadZone=0.25,Exponent=1.f,Sensitivity=1.f))
-AxisConfig=(AxisKeyName="Gamepad_LeftY",AxisProperties=(DeadZone=0.25,Exponent=1.f,Sensitivity=1.f)) -AxisConfig=(AxisKeyName="Gamepad_LeftY",AxisProperties=(DeadZone=0.25,Exponent=1.f,Sensitivity=1.f))
@ -6,32 +7,91 @@
-AxisConfig=(AxisKeyName="Gamepad_RightY",AxisProperties=(DeadZone=0.25,Exponent=1.f,Sensitivity=1.f)) -AxisConfig=(AxisKeyName="Gamepad_RightY",AxisProperties=(DeadZone=0.25,Exponent=1.f,Sensitivity=1.f))
-AxisConfig=(AxisKeyName="MouseX",AxisProperties=(DeadZone=0.f,Exponent=1.f,Sensitivity=0.07f)) -AxisConfig=(AxisKeyName="MouseX",AxisProperties=(DeadZone=0.f,Exponent=1.f,Sensitivity=0.07f))
-AxisConfig=(AxisKeyName="MouseY",AxisProperties=(DeadZone=0.f,Exponent=1.f,Sensitivity=0.07f)) -AxisConfig=(AxisKeyName="MouseY",AxisProperties=(DeadZone=0.f,Exponent=1.f,Sensitivity=0.07f))
-AxisConfig=(AxisKeyName="Mouse2D",AxisProperties=(DeadZone=0.f,Exponent=1.f,Sensitivity=0.07f))
+AxisConfig=(AxisKeyName="Mouse2D",AxisProperties=(DeadZone=0.000000,Sensitivity=0.070000,Exponent=1.000000,bInvert=False))
+AxisConfig=(AxisKeyName="Gamepad_LeftX",AxisProperties=(DeadZone=0.250000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False)) +AxisConfig=(AxisKeyName="Gamepad_LeftX",AxisProperties=(DeadZone=0.250000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False))
+AxisConfig=(AxisKeyName="Gamepad_LeftY",AxisProperties=(DeadZone=0.250000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False)) +AxisConfig=(AxisKeyName="Gamepad_LeftY",AxisProperties=(DeadZone=0.250000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False))
+AxisConfig=(AxisKeyName="Gamepad_RightX",AxisProperties=(DeadZone=0.250000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False)) +AxisConfig=(AxisKeyName="Gamepad_RightX",AxisProperties=(DeadZone=0.250000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False))
+AxisConfig=(AxisKeyName="Gamepad_RightY",AxisProperties=(DeadZone=0.250000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False)) +AxisConfig=(AxisKeyName="Gamepad_RightY",AxisProperties=(DeadZone=0.250000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False))
+AxisConfig=(AxisKeyName="MouseX",AxisProperties=(DeadZone=0.000000,Sensitivity=0.070000,Exponent=1.000000,bInvert=False)) +AxisConfig=(AxisKeyName="MouseX",AxisProperties=(DeadZone=0.000000,Sensitivity=0.070000,Exponent=1.000000,bInvert=False))
+AxisConfig=(AxisKeyName="MouseY",AxisProperties=(DeadZone=0.000000,Sensitivity=0.070000,Exponent=1.000000,bInvert=False)) +AxisConfig=(AxisKeyName="MouseY",AxisProperties=(DeadZone=0.000000,Sensitivity=0.070000,Exponent=1.000000,bInvert=False))
+AxisConfig=(AxisKeyName="MouseWheelAxis",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False))
+AxisConfig=(AxisKeyName="Gamepad_LeftTriggerAxis",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False))
+AxisConfig=(AxisKeyName="Gamepad_RightTriggerAxis",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False))
+AxisConfig=(AxisKeyName="Gamepad_Special_Left_X",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False))
+AxisConfig=(AxisKeyName="Gamepad_Special_Left_Y",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False))
+AxisConfig=(AxisKeyName="Daydream_Left_Trackpad_X",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False))
+AxisConfig=(AxisKeyName="Daydream_Left_Trackpad_Y",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False))
+AxisConfig=(AxisKeyName="Daydream_Right_Trackpad_X",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False))
+AxisConfig=(AxisKeyName="Daydream_Right_Trackpad_Y",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False))
+AxisConfig=(AxisKeyName="Vive_Left_Trigger_Axis",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False))
+AxisConfig=(AxisKeyName="Vive_Left_Trackpad_X",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False))
+AxisConfig=(AxisKeyName="Vive_Left_Trackpad_Y",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False))
+AxisConfig=(AxisKeyName="Vive_Right_Trigger_Axis",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False))
+AxisConfig=(AxisKeyName="Vive_Right_Trackpad_X",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False))
+AxisConfig=(AxisKeyName="Vive_Right_Trackpad_Y",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False))
+AxisConfig=(AxisKeyName="MixedReality_Left_Trigger_Axis",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False))
+AxisConfig=(AxisKeyName="MixedReality_Left_Thumbstick_X",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False))
+AxisConfig=(AxisKeyName="MixedReality_Left_Thumbstick_Y",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False))
+AxisConfig=(AxisKeyName="MixedReality_Left_Trackpad_X",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False))
+AxisConfig=(AxisKeyName="MixedReality_Left_Trackpad_Y",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False))
+AxisConfig=(AxisKeyName="MixedReality_Right_Trigger_Axis",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False))
+AxisConfig=(AxisKeyName="MixedReality_Right_Thumbstick_X",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False))
+AxisConfig=(AxisKeyName="MixedReality_Right_Thumbstick_Y",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False))
+AxisConfig=(AxisKeyName="MixedReality_Right_Trackpad_X",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False))
+AxisConfig=(AxisKeyName="MixedReality_Right_Trackpad_Y",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False))
+AxisConfig=(AxisKeyName="OculusTouch_Left_Grip_Axis",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False))
+AxisConfig=(AxisKeyName="OculusTouch_Left_Trigger_Axis",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False))
+AxisConfig=(AxisKeyName="OculusTouch_Left_Thumbstick_X",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False))
+AxisConfig=(AxisKeyName="OculusTouch_Left_Thumbstick_Y",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False))
+AxisConfig=(AxisKeyName="OculusTouch_Right_Grip_Axis",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False))
+AxisConfig=(AxisKeyName="OculusTouch_Right_Trigger_Axis",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False))
+AxisConfig=(AxisKeyName="OculusTouch_Right_Thumbstick_X",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False))
+AxisConfig=(AxisKeyName="OculusTouch_Right_Thumbstick_Y",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False))
+AxisConfig=(AxisKeyName="ValveIndex_Left_Grip_Axis",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False))
+AxisConfig=(AxisKeyName="ValveIndex_Left_Grip_Force",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False))
+AxisConfig=(AxisKeyName="ValveIndex_Left_Trigger_Axis",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False))
+AxisConfig=(AxisKeyName="ValveIndex_Left_Thumbstick_X",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False))
+AxisConfig=(AxisKeyName="ValveIndex_Left_Thumbstick_Y",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False))
+AxisConfig=(AxisKeyName="ValveIndex_Left_Trackpad_X",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False))
+AxisConfig=(AxisKeyName="ValveIndex_Left_Trackpad_Y",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False))
+AxisConfig=(AxisKeyName="ValveIndex_Left_Trackpad_Force",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False))
+AxisConfig=(AxisKeyName="ValveIndex_Left_Trackpad_Touch",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False))
+AxisConfig=(AxisKeyName="ValveIndex_Right_Grip_Axis",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False))
+AxisConfig=(AxisKeyName="ValveIndex_Right_Grip_Force",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False))
+AxisConfig=(AxisKeyName="ValveIndex_Right_Trigger_Axis",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False))
+AxisConfig=(AxisKeyName="ValveIndex_Right_Thumbstick_X",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False))
+AxisConfig=(AxisKeyName="ValveIndex_Right_Thumbstick_Y",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False))
+AxisConfig=(AxisKeyName="ValveIndex_Right_Trackpad_X",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False))
+AxisConfig=(AxisKeyName="ValveIndex_Right_Trackpad_Y",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False))
+AxisConfig=(AxisKeyName="ValveIndex_Right_Trackpad_Force",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False))
bAltEnterTogglesFullscreen=True bAltEnterTogglesFullscreen=True
bF11TogglesFullscreen=True
bUseMouseForTouch=False bUseMouseForTouch=False
bEnableMouseSmoothing=True bEnableMouseSmoothing=True
bEnableFOVScaling=True bEnableFOVScaling=True
FOVScale=0.011110 bCaptureMouseOnLaunch=True
DoubleClickTime=0.200000
+ActionMappings=(ActionName="Jump",Key=W,bShift=False,bCtrl=False,bAlt=False,bCmd=False)
+ActionMappings=(ActionName="Jump",Key=Up,bShift=False,bCtrl=False,bAlt=False,bCmd=False)
+ActionMappings=(ActionName="Jump",Key=SpaceBar,bShift=False,bCtrl=False,bAlt=False,bCmd=False)
+ActionMappings=(ActionName="Jump",Key=Gamepad_FaceButton_Bottom,bShift=False,bCtrl=False,bAlt=False,bCmd=False)
+AxisMappings=(AxisName="MoveRight",Key=A,Scale=-1.000000)
+AxisMappings=(AxisName="MoveRight",Key=D,Scale=1.000000)
+AxisMappings=(AxisName="MoveRight",Key=Gamepad_LeftX,Scale=1.000000)
+AxisMappings=(AxisName="MoveRight",Key=Left,Scale=-1.000000)
+AxisMappings=(AxisName="MoveRight",Key=Right,Scale=1.000000)
bAlwaysShowTouchInterface=False bAlwaysShowTouchInterface=False
bShowConsoleOnFourFingerTap=True bShowConsoleOnFourFingerTap=True
bEnableGestureRecognizer=False
bUseAutocorrect=False
DefaultViewportMouseCaptureMode=CapturePermanently_IncludingInitialMouseDown
DefaultViewportMouseLockMode=LockOnCapture
FOVScale=0.011110
DoubleClickTime=0.200000
+ActionMappings=(ActionName="Up",bShift=False,bCtrl=False,bAlt=False,bCmd=False,Key=W)
+ActionMappings=(ActionName="Down",bShift=False,bCtrl=False,bAlt=False,bCmd=False,Key=S)
+ActionMappings=(ActionName="Up",bShift=False,bCtrl=False,bAlt=False,bCmd=False,Key=Gamepad_DPad_Up)
+ActionMappings=(ActionName="Down",bShift=False,bCtrl=False,bAlt=False,bCmd=False,Key=Gamepad_DPad_Down)
+ActionMappings=(ActionName="Left",bShift=False,bCtrl=False,bAlt=False,bCmd=False,Key=A)
+ActionMappings=(ActionName="Right",bShift=False,bCtrl=False,bAlt=False,bCmd=False,Key=D)
+ActionMappings=(ActionName="Left",bShift=False,bCtrl=False,bAlt=False,bCmd=False,Key=Gamepad_DPad_Left)
+ActionMappings=(ActionName="Right",bShift=False,bCtrl=False,bAlt=False,bCmd=False,Key=Gamepad_DPad_Right)
+AxisMappings=(AxisName="MoveRight",Scale=1.000000,Key=D)
+AxisMappings=(AxisName="MoveRight",Scale=-1.000000,Key=A)
DefaultPlayerInputClass=/Script/Engine.PlayerInput
DefaultInputComponentClass=/Script/Engine.InputComponent
DefaultTouchInterface=/Engine/MobileResources/HUD/LeftVirtualJoystickOnly.LeftVirtualJoystickOnly DefaultTouchInterface=/Engine/MobileResources/HUD/LeftVirtualJoystickOnly.LeftVirtualJoystickOnly
ConsoleKey=None
-ConsoleKeys=Tilde -ConsoleKeys=Tilde
+ConsoleKeys=Tilde +ConsoleKeys=Tilde

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

BIN
KOFForever/Content/Maps/Debug/DebugStage.umap (Stored with Git LFS) Normal file

Binary file not shown.

Binary file not shown.

View File

@ -9,5 +9,6 @@ public class KOFForever : ModuleRules
PCHUsage = PCHUsageMode.UseExplicitOrSharedPCHs; PCHUsage = PCHUsageMode.UseExplicitOrSharedPCHs;
PublicDependencyModuleNames.AddRange(new string[] { "Core", "CoreUObject", "Engine", "InputCore", "Paper2D", "UnrealEd" }); PublicDependencyModuleNames.AddRange(new string[] { "Core", "CoreUObject", "Engine", "InputCore", "Paper2D", "UnrealEd" });
PrivateDependencyModuleNames.AddRange( new string [] {"FixedPointMath"});
} }
} }

View File

@ -2,4 +2,4 @@
#pragma once #pragma once
#include "CoreMinimal.h" #include "CoreMinimal.h"

View File

@ -0,0 +1,18 @@
#include "KOFTypes.generated.h"
#pragma once
UENUM(BlueprintType)
enum class EVirtualGamePadButton : uint8
{
VGP_Up UMETA(DisplayName="Up"),
VGP_Down UMETA(DisplayName="Down"),
VGP_Left UMETA(DisplayName="Left"),
VGP_Right UMETA(DisplayName="Right"),
VGP_A UMETA(DisplayName="A"),
VGP_B UMETA(DisplayName="B"),
VGP_C UMETA(DisplayName="C"),
VGP_D UMETA(DisplayName="D"),
VGP_Assist1 UMETA(DisplayName="Assist 1"),
VGP_Assist2 UMETA(DisplayName="Assist 2"),
VGP_MAX,
};

View File

@ -1,5 +1,118 @@
// A fan game by poret. This game is not affiliated with SNK. This is a fan game which is not being sold or distributed for profit. // A fan game by poret. This game is not affiliated with SNK. This is a fan game which is not being sold or distributed for profit.
#include "Character/KOFBaseCharacter.h" #include "Character/KOFBaseCharacter.h"
#include "PaperFlipbookComponent.h"
#include "Components/InputComponent.h"
#include "KOFForever/KOFTypes.h"
// Sets default values
AKOFBaseCharacter::AKOFBaseCharacter()
{
// Set this actor to call Tick() every frame. You can turn this off to improve performance if you don't need it.
PrimaryActorTick.bCanEverTick = true;
Sprite = CreateOptionalDefaultSubobject<UPaperFlipbookComponent>(TEXT("Sprite"));
if (Sprite)
{
Sprite->AlwaysLoadOnClient = true;
Sprite->AlwaysLoadOnServer = true;
Sprite->bOwnerNoSee = false;
Sprite->bAffectDynamicIndirectLighting = true;
Sprite->SetupAttachment(RootComponent);
Sprite->SetRelativeLocation(FVector(0.0f, 0.0f, 96.0f));
}
// Try to create the sprite component
Shadow = CreateOptionalDefaultSubobject<UPaperFlipbookComponent>(TEXT("Shadow"));
if (Shadow)
{
Shadow->AlwaysLoadOnClient = true;
Shadow->AlwaysLoadOnServer = true;
Shadow->bOwnerNoSee = false;
Shadow->bAffectDynamicIndirectLighting = true;
Shadow->SetupAttachment(Sprite);
//Shadow->SetRelativeLocation(FVector(0.0f, 0.0f, -96.0f));
Shadow->SetRelativeScale3D(FVector(1.0f, 1.0f, -0.3f));
Shadow->SetSpriteColor(FLinearColor::Black);
}
MaxWalkSpeed = 400;
}
void AKOFBaseCharacter::SetPosition(FFixedVector Param)
{
Position = Param;
}
void AKOFBaseCharacter::SetupPlayerInputComponent(UInputComponent* PlayerInputComponent)
{
Super::SetupPlayerInputComponent(PlayerInputComponent);
PlayerInputComponent->BindAxis("MoveRight", this, &AKOFBaseCharacter::MoveRight);
RegisterInput("Up", EVirtualGamePadButton::VGP_Up);
RegisterInput("Down", EVirtualGamePadButton::VGP_Down);
RegisterInput("Left", EVirtualGamePadButton::VGP_Left);
RegisterInput("Right", EVirtualGamePadButton::VGP_Right);
}
void AKOFBaseCharacter::ProcessInputs(EVirtualGamePadButton Button)
{
/*
switch(Button)
{
case EVirtualGamePadButton::VGP_Left:
Position = FFixedVector(0, -250, 0);
break;
case EVirtualGamePadButton::VGP_Right:
Position = FFixedVector(0, 250, 0);
break;
}
*/
}
void AKOFBaseCharacter::RegisterInput(FName ActionName, EVirtualGamePadButton Button)
{
check(InputComponent != nullptr);
FInputActionHandlerSignature ActionHandler;
ActionHandler.BindUObject(this, &AKOFBaseCharacter::ProcessInputs, Button);
FInputActionBinding ActionBinding(ActionName, IE_Pressed);
ActionBinding.ActionDelegate = ActionHandler;
InputComponent->AddActionBinding(ActionBinding);
}
void AKOFBaseCharacter::MoveRight(float Axis)
{
Direction = Axis;
}
void AKOFBaseCharacter::UpdateMovement(FFixed DeltaTime)
{
FFixedVector Velocity = FFixedVector(0, Direction * MaxWalkSpeed, 0);
Position += Velocity * DeltaTime;
}
// Called when the game starts or when spawned
void AKOFBaseCharacter::BeginPlay()
{
Super::BeginPlay();
SetActorLocation(FVector(Position));
SetActorRotation(FRotator(0.0f, 90.0f, 0.0f));
}
// Called every frame
void AKOFBaseCharacter::Tick(float DeltaTime)
{
Super::Tick(DeltaTime);
UpdateMovement(FFixed(DeltaTime));
// might need some helpers to convert a FFixedVector to a FVector
SetActorRelativeLocation(FVector(Position));
}

View File

@ -1,51 +0,0 @@
// A fan game by poret. This game is not affiliated with SNK. This is a fan game which is not being sold or distributed for profit.
#include "Character/KOFRenderableCharacter.h"
#include "PaperFlipbookComponent.h"
// Sets default values
AKOFRenderableCharacter::AKOFRenderableCharacter()
{
// Set this actor to call Tick() every frame. You can turn this off to improve performance if you don't need it.
PrimaryActorTick.bCanEverTick = true;
Sprite = CreateOptionalDefaultSubobject<UPaperFlipbookComponent>(TEXT("Sprite"));
if (Sprite)
{
Sprite->AlwaysLoadOnClient = true;
Sprite->AlwaysLoadOnServer = true;
Sprite->bOwnerNoSee = false;
Sprite->bAffectDynamicIndirectLighting = true;
Sprite->SetupAttachment(RootComponent);
}
// Try to create the sprite component
Shadow = CreateOptionalDefaultSubobject<UPaperFlipbookComponent>(TEXT("Shadow"));
if (Shadow)
{
Shadow->AlwaysLoadOnClient = true;
Shadow->AlwaysLoadOnServer = true;
Shadow->bOwnerNoSee = false;
Shadow->bAffectDynamicIndirectLighting = true;
Shadow->SetupAttachment(Sprite);
Shadow->SetRelativeScale3D(FVector(1.0f, 1.0f, -0.3f));
Shadow->SetSpriteColor(FLinearColor::Black);
}
}
// Called when the game starts or when spawned
void AKOFRenderableCharacter::BeginPlay()
{
Super::BeginPlay();
}
// Called every frame
void AKOFRenderableCharacter::Tick(float DeltaTime)
{
Super::Tick(DeltaTime);
}

View File

@ -1,17 +1,65 @@
// A fan game by poret. This game is not affiliated with SNK. This is a fan game which is not being sold or distributed for profit. // A fan game by poret. This game is not affiliated with SNK. This is a fan game which is not being sold or distributed for profit.
#pragma once #pragma once
#include "CoreMinimal.h" #include "CoreMinimal.h"
#include "UObject/NoExportTypes.h" #include "../../../../Plugins/FixedPointMath/Source/FixedPointMath/Public/FixedVector.h"
#include "KOFBaseCharacter.generated.h" #include "GameFramework/Actor.h"
#include "KOFBaseCharacter.generated.h"
/**
* enum class EVirtualGamePadButton : uint8;
*/ UCLASS()
UCLASS(Blueprintable, meta=(ShortTooltip="Base class responsible for handling all character logic.")) class KOFFOREVER_API AKOFBaseCharacter : public APawn
class KOFFOREVER_API UKOFBaseCharacter : public UObject {
{ GENERATED_BODY()
GENERATED_BODY()
public:
}; // Sets default values for this actor's properties
AKOFBaseCharacter();
void SetPosition(FFixedVector Param);
protected:
/** The main flipbook representing the character */
UPROPERTY(Category = Character, VisibleAnywhere, BlueprintReadOnly, meta = (AllowPrivateAccess = "true"))
class UPaperFlipbookComponent* Sprite;
/**
* Secondary sprite that is mirrored across the ground axis and set to black to give the effect of a
* character's shadow
*/
UPROPERTY(Category = Character, VisibleAnywhere, BlueprintReadOnly, meta = (AllowPrivateAccess = "true"))
class UPaperFlipbookComponent* Shadow;
// movement
// need a way to expose this to the editor as a float slider/entry
UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, Category="Settings|Movement")
FFixed MaxWalkSpeed;
int Direction;
FFixedVector Position;
/**
*
* @param PlayerInputComponent
*/
virtual void SetupPlayerInputComponent(UInputComponent* PlayerInputComponent) override;
// for now just takes a button but eventually will take an entire gamepad state
void ProcessInputs(EVirtualGamePadButton Button);
void RegisterInput(FName ActionName, EVirtualGamePadButton Button);
void MoveRight(float Axis);
void UpdateMovement(FFixed DeltaTime);
// Called when the game starts or when spawned
virtual void BeginPlay() override;
public:
// Called every frame
virtual void Tick(float DeltaTime) override;
};

View File

@ -1,37 +0,0 @@
// A fan game by poret. This game is not affiliated with SNK. This is a fan game which is not being sold or distributed for profit.
#pragma once
#include "CoreMinimal.h"
#include "GameFramework/Actor.h"
#include "KOFRenderableCharacter.generated.h"
UCLASS()
class KOFFOREVER_API AKOFRenderableCharacter : public AActor
{
GENERATED_BODY()
public:
// Sets default values for this actor's properties
AKOFRenderableCharacter();
protected:
/** The main flipbook representing the character */
UPROPERTY(Category = Character, VisibleAnywhere, BlueprintReadOnly, meta = (AllowPrivateAccess = "true"))
class UPaperFlipbookComponent* Sprite;
/**
* Secondary sprite that is mirrored across the ground axis and set to black to give the effect of a
* character's shadow
*/
UPROPERTY(Category = Character, VisibleAnywhere, BlueprintReadOnly, meta = (AllowPrivateAccess = "true"))
class UPaperFlipbookComponent* Shadow;
// Called when the game starts or when spawned
virtual void BeginPlay() override;
public:
// Called every frame
virtual void Tick(float DeltaTime) override;
};