Header file * // Fill out your copyright notice in the Description page of Project Settings.
pragma once
include “CoreMinimal.h”
include “GameFramework/Character.h” #include “CharacterData.generated.h”
UCLASS() class BALLROLLER_API ACharacterData : public ACharacter { GENERATED_BODY()
public: // Sets default values for this character’s properties ACharacterData();
protected: // Called when the game starts or when spawned virtual void BeginPlay() override;
public:
// Called every frame virtual void Tick(float DeltaTime) override;
// Called to bind functionality to input
virtual void SetupPlayerInputComponent(class UInputComponent* PlayerInputComponent) override;
UPROPERTY(Editanywhere)
int gamescore;
};
CPP file ***
// Fill out your copyright notice in the Description page of Project Settings.
include “CharacterData.h”
// Sets default values ACharacterData::ACharacterData() { // Set this character to call Tick() every frame. You can turn this off to improve performance if you don’t need it. PrimaryActorTick.bCanEverTick = true;
}
// Called when the game starts or when spawned void ACharacterData::BeginPlay() { Super::BeginPlay();
}
// Called every frame void ACharacterData::Tick(float DeltaTime) { Super::Tick(DeltaTime);
}
// Called to bind functionality to input void ACharacterData::SetupPlayerInputComponent(UInputComponent* PlayerInputComponent) { Super::SetupPlayerInputComponent(PlayerInputComponent);
}