Compare commits

..

9 Commits

Author SHA1 Message Date
LukTeg
6a6fd73292 Merged in main 2023-12-01 19:34:48 -05:00
LukTeg
af138d9110 minor refactoring 2023-12-01 19:22:59 -05:00
LukTeg
1a0227ff28 Enemy flings only horizontal and passenger has running ai
The enemy now can fling all types of actors so long as they can be cast to a character (player and passenger). Also, it flings to the side by a random degrees to prevent the enemy from "dribbling the player like a basketball"(moves forward, flings forward, moves forward, etc). The passenger blueprint has been made(will most likely need to be merged with whatever other one is on the main branch.) The passenger has a 25% of running in a circle, 25% of picking a random direction to face and then run in, and 50% of standing in utter panic.
2023-11-21 21:45:38 -05:00
LukTeg
2a13ba9adb The passenger blueprint now exists and runs in a circle 2023-11-20 20:02:40 -05:00
LukTeg
bf717f3942 Added proper AI and throwing player back on contact 2023-11-14 22:24:58 -05:00
LukTeg
5ce49be574 Changed ai-detection from seeing to a fixed distance to player 2023-11-08 13:25:50 -05:00
LukTeg
c682a8821e Created Basic Enemy with AI and detection radius 2023-11-08 09:01:58 -05:00
LukTeg
41ca11d26a Trying to fix enemy movement bug 2023-11-06 19:05:45 -05:00
LukTeg
3b250c5dd0 Made Movement Componenet and got collision act to move 2023-10-16 19:59:56 -04:00
16 changed files with 131 additions and 5 deletions

BIN
Content/Blueprints/Enemy2.uasset (Stored with Git LFS) Normal file

Binary file not shown.

BIN
Content/Blueprints/Passenger.uasset (Stored with Git LFS) Normal file

Binary file not shown.

BIN
Content/Materials/wood.uasset (Stored with Git LFS) Normal file

Binary file not shown.

BIN
Content/MoveBlueprint.uasset (Stored with Git LFS) Normal file

Binary file not shown.

BIN
Content/NewActorComponent.uasset (Stored with Git LFS) Normal file

Binary file not shown.

BIN
Content/Passenger.uasset (Stored with Git LFS) Normal file

Binary file not shown.

BIN
Content/testingActor.uasset (Stored with Git LFS) Normal file

Binary file not shown.

View File

@ -0,0 +1,47 @@
// Fill out your copyright notice in the Description page of Project Settings.
#include "MoveComponent.h"
// Sets default values for this component's properties
UMoveComponent::UMoveComponent()
{
// Set this component to be initialized when the game starts, and to be ticked every frame. You can turn these features
// off to improve performance if you don't need them.
PrimaryComponentTick.bCanEverTick = true;
}
// Called when the game starts
void UMoveComponent::BeginPlay()
{
Super::BeginPlay();
// Set start location
StartRelativeLocation = this->GetRelativeLocation();
//Compute normalized movement
MoveOffsetNorm = MoveOffset;
MoveOffsetNorm.Normalize();
MaxDistance = MoveOffset.Length();
//Check if ticking required
SetComponentTickEnabled(MoveEnable);
}
// Called every frame
void UMoveComponent::TickComponent(float DeltaTime, ELevelTick TickType, FActorComponentTickFunction* ThisTickFunction)
{
Super::TickComponent(DeltaTime, TickType, ThisTickFunction);
//Set the current distance
if (MoveEnable)
{
CurDistance += DeltaTime * Speed * MoveDirection;
if (CurDistance >= MaxDistance || CurDistance <= 0.0f) {
MoveDirection *= -1;
}
}
// Compute and set current location
SetRelativeLocation(StartRelativeLocation + MoveOffsetNorm * CurDistance);
}

View File

@ -0,0 +1,46 @@
// Fill out your copyright notice in the Description page of Project Settings.
#pragma once
#include "CoreMinimal.h"
#include "Components/SceneComponent.h"
#include "MoveComponent.generated.h"
UCLASS(ClassGroup = (Actors), meta = (BlueprintSpawnableComponent))
class JUMPINGSHIP_API UMoveComponent : public USceneComponent
{
GENERATED_BODY()
public:
// Sets default values for this component's properties
UMoveComponent();
protected:
// Called when the game starts
virtual void BeginPlay() override;
public:
// Called every frame
virtual void TickComponent(float DeltaTime, ELevelTick TickType, FActorComponentTickFunction* ThisTickFunction) override;
//Offset to move
UPROPERTY(EditAnywhere)
FVector MoveOffset;
private:
friend class FMoveComponentVisualizer;
// Enables the movement of the component
UPROPERTY(EditAnywhere)
bool MoveEnable = true;
//Speed
UPROPERTY(EditAnywhere)
float Speed = 1.0f;
//Computed locations
FVector StartRelativeLocation;
FVector MoveOffsetNorm;
float MaxDistance = 0.0f;
float CurDistance = 0.0f;
float MoveDirection = 1;
};