void ABxtAsteroidSpawner::SpawnAsteroid() { FActorSpawnParameters spawnParams; spawnParams.Owner = this; spawnParams.bDeferConstruction = true; const FVector spawnLocation = GetRandomSpawnLocation(); const FRotator spawnRotation = FRotator::ZeroRotator; auto asteroid = GetWorld()->SpawnActor<ABxtAsteroid>( AsteroidClass, spawnLocation, spawnRotation, spawnParams ); if (asteroid) { asteroid->SetInitialSpeed(AsteroidSpeed); asteroid->SetDirection(GetRandomSpawnDirection()); // preserve original root component scale const FVector spawnScale = GetRootComponent() ? GetRootComponent()->RelativeScale3D : FVector(1.0f, 1.0f, 1.0f); asteroid->FinishSpawning(FTransform(spawnRotation, spawnLocation, spawnScale), true); } }
CPoints::CPoints() { ID = ++CEntity::EntityCounter; Type = 5; FollowPath = false; LoopPath = false; LifeSpan = 1000; Flags = POINTS_FLAGS; NumberOfFrames = POINTS_ANIMATION_NUM_FRAMES; Collision_Width = POINTS_COLLISION_WIDTH; Collision_Height = POINTS_COLLISION_HEIGHT; Collision_X = POINTS_COLLISION_X; Collision_Y = POINTS_COLLISION_Y; MaxSpeedX = POINTS_MAXSPEED_X; MaxSpeedY = POINTS_MAXSPEED_Y; SetInitialSpeed(0, -25, 0 , 0); }
void CBanzaiBill::Kill() { CSoundManager::SoundManager.Play(FX_STOMP); // Display Points ShowPoints(CONST_POINTS_EARNED, X, Y); // Add points to score CAreaScoring::AreaScoring.AddPoints(CONST_POINTS_EARNED); // STOP! FollowPath = false; MoveLeft = MoveRight = false; // Jump Off Screen Flags = ENTITY_FLAG_GHOST | ENTITY_FLAG_GRAVITY; X -= 100; Y -= 100; SetInitialSpeed(5,5,0,0); CEntity::Kill(); }