NS
Size: a a a
NS
NS
NS
VK
YS
Св
VK
Св
DS
YS
E
YS
E
YS
YS
// Called when the game starts or when spawned
void ATurtle::BeginPlay()
{
Super::BeginPlay();
GetWorldTimerManager().SetTimer(MemberTimerHandle, this, &ATurtle::ChangeSpeed, 10.0f, true, 0.0f);
}
// Called every frame
void ATurtle::Tick(float DeltaTime)
{
CurrentLocation = this->GetActorLocation();
if (CurrentLocation.X < 410)
{
CurrentLocation.X += speed * DeltaTime;
SetActorLocation(CurrentLocation);
}
else
{
Destroy();
}
}
void ATurtle::ChangeSpeed()
{
speed = currentDirection ? 50 : -25;
currentDirection = !currentDirection;
}
E
// Called when the game starts or when spawned
void ATurtle::BeginPlay()
{
Super::BeginPlay();
GetWorldTimerManager().SetTimer(MemberTimerHandle, this, &ATurtle::ChangeSpeed, 10.0f, true, 0.0f);
}
// Called every frame
void ATurtle::Tick(float DeltaTime)
{
CurrentLocation = this->GetActorLocation();
if (CurrentLocation.X < 410)
{
CurrentLocation.X += speed * DeltaTime;
SetActorLocation(CurrentLocation);
}
else
{
Destroy();
}
}
void ATurtle::ChangeSpeed()
{
speed = currentDirection ? 50 : -25;
currentDirection = !currentDirection;
}
YS
YS
AD
E