Implement enemy shooting and scale down for more arcade game feel

This commit is contained in:
2025-04-15 22:21:28 +05:30
parent ca23fd129e
commit e2e709bffd
14 changed files with 886 additions and 41 deletions

View File

@@ -0,0 +1,43 @@
#pragma once
#include "CoreMinimal.h"
#include "GameFramework/Actor.h"
#include "EnemyProjectile.generated.h"
UCLASS()
class MYPROJECT3_API AEnemyProjectile : public AActor
{
GENERATED_BODY()
public:
AEnemyProjectile();
protected:
virtual void BeginPlay() override;
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Components")
class UStaticMeshComponent* ProjectileMesh;
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Components")
class UProjectileMovementComponent* ProjectileMovement;
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Projectile")
float ProjectileSpeed = 2500.0f; // Slightly slower than player projectiles
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Projectile")
float DamageAmount = 10.0f; // Less damage than player projectiles
// Add a particle effect for impact
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Effects")
class UParticleSystem* ImpactEffect;
UFUNCTION()
void OnHit(UPrimitiveComponent* HitComp, AActor* OtherActor, UPrimitiveComponent* OtherComp,
FVector NormalImpulse, const FHitResult& Hit);
// Add an overlap handler for redundant collision detection
UFUNCTION()
void OnOverlapBegin(UPrimitiveComponent* OverlappedComp, AActor* OtherActor,
UPrimitiveComponent* OtherComp, int32 OtherBodyIndex,
bool bFromSweep, const FHitResult& SweepResult);
};