Basic horizontal velocity using fixed point math
This commit is contained in:
parent
b2b6f339d8
commit
2b4c138b13
@ -1,7 +1,7 @@
|
||||
|
||||
|
||||
[/Script/EngineSettings.GameMapsSettings]
|
||||
EditorStartupMap=/Game/Maps/TrainingStage/TrainingStage.TrainingStage
|
||||
EditorStartupMap=/Game/Maps/Debug/DebugStage.DebugStage
|
||||
LocalMapOptions=
|
||||
TransitionMap=
|
||||
bUseSplitscreen=True
|
||||
@ -37,3 +37,7 @@ r.Editor.SkipSourceControlCheckForEditablePackages = 1
|
||||
[/Script/Engine.RendererSettings]
|
||||
r.DefaultFeature.AntiAliasing=0
|
||||
|
||||
|
||||
[CoreRedirects]
|
||||
+ClassRedirects=(OldName="/Script/KOFForever.KOFRenderableCharacter",NewName="/Script/KOFForever.KOFBaseCharacter")
|
||||
|
||||
|
@ -1,4 +1,5 @@
|
||||
|
||||
|
||||
[/Script/Engine.InputSettings]
|
||||
-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))
|
||||
@ -6,32 +7,91 @@
|
||||
-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="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_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_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="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
|
||||
bF11TogglesFullscreen=True
|
||||
bUseMouseForTouch=False
|
||||
bEnableMouseSmoothing=True
|
||||
bEnableFOVScaling=True
|
||||
FOVScale=0.011110
|
||||
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)
|
||||
bCaptureMouseOnLaunch=True
|
||||
bAlwaysShowTouchInterface=False
|
||||
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
|
||||
ConsoleKey=None
|
||||
-ConsoleKeys=Tilde
|
||||
+ConsoleKeys=Tilde
|
||||
|
||||
|
||||
|
BIN
KOFForever/Content/Characters/Terry/BP_Terry.uasset
(Stored with Git LFS)
BIN
KOFForever/Content/Characters/Terry/BP_Terry.uasset
(Stored with Git LFS)
Binary file not shown.
BIN
KOFForever/Content/Characters/Terry/BP_TerryRender.uasset
(Stored with Git LFS)
BIN
KOFForever/Content/Characters/Terry/BP_TerryRender.uasset
(Stored with Git LFS)
Binary file not shown.
BIN
KOFForever/Content/Characters/Terry/BP_Terry_DEPRECATED.uasset
(Stored with Git LFS)
Normal file
BIN
KOFForever/Content/Characters/Terry/BP_Terry_DEPRECATED.uasset
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
KOFForever/Content/Core/BP_MainGameMode.uasset
(Stored with Git LFS)
BIN
KOFForever/Content/Core/BP_MainGameMode.uasset
(Stored with Git LFS)
Binary file not shown.
BIN
KOFForever/Content/Debug/BP_DebugGameMode.uasset
(Stored with Git LFS)
BIN
KOFForever/Content/Debug/BP_DebugGameMode.uasset
(Stored with Git LFS)
Binary file not shown.
BIN
KOFForever/Content/Maps/Debug/DebugStage.umap
(Stored with Git LFS)
Normal file
BIN
KOFForever/Content/Maps/Debug/DebugStage.umap
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
KOFForever/Content/Maps/TrainingStage/TrainingStage.umap
(Stored with Git LFS)
BIN
KOFForever/Content/Maps/TrainingStage/TrainingStage.umap
(Stored with Git LFS)
Binary file not shown.
@ -9,5 +9,6 @@ public class KOFForever : ModuleRules
|
||||
PCHUsage = PCHUsageMode.UseExplicitOrSharedPCHs;
|
||||
|
||||
PublicDependencyModuleNames.AddRange(new string[] { "Core", "CoreUObject", "Engine", "InputCore", "Paper2D", "UnrealEd" });
|
||||
PrivateDependencyModuleNames.AddRange( new string [] {"FixedPointMath"});
|
||||
}
|
||||
}
|
||||
|
@ -2,4 +2,4 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "CoreMinimal.h"
|
||||
#include "CoreMinimal.h"
|
18
KOFForever/Source/KOFForever/KOFTypes.h
Normal file
18
KOFForever/Source/KOFForever/KOFTypes.h
Normal 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,
|
||||
};
|
@ -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.
|
||||
|
||||
|
||||
#include "Character/KOFBaseCharacter.h"
|
||||
|
||||
// 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 "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));
|
||||
}
|
||||
|
||||
|
@ -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);
|
||||
|
||||
}
|
||||
|
@ -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.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "CoreMinimal.h"
|
||||
#include "UObject/NoExportTypes.h"
|
||||
#include "KOFBaseCharacter.generated.h"
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
UCLASS(Blueprintable, meta=(ShortTooltip="Base class responsible for handling all character logic."))
|
||||
class KOFFOREVER_API UKOFBaseCharacter : public UObject
|
||||
{
|
||||
GENERATED_BODY()
|
||||
|
||||
};
|
||||
// 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 "../../../../Plugins/FixedPointMath/Source/FixedPointMath/Public/FixedVector.h"
|
||||
#include "GameFramework/Actor.h"
|
||||
#include "KOFBaseCharacter.generated.h"
|
||||
|
||||
enum class EVirtualGamePadButton : uint8;
|
||||
UCLASS()
|
||||
class KOFFOREVER_API AKOFBaseCharacter : public APawn
|
||||
{
|
||||
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;
|
||||
|
||||
};
|
||||
|
@ -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;
|
||||
|
||||
};
|
Loading…
Reference in New Issue
Block a user