Consists of one EventGraph and one Function (SpawnSegments).
The game spawns 4 segments ahead of the player (using a For Loop from 0 to 3). Using the length of the main/parent segment (BP_BaseGroundSegment), each of the 4 segments spawns exactly 4,300 units ahead of the previous one (Variable: NextSpawnXLocation), creating a perfect match. I've limited the number of segments in the level to 10. When we reach 12 segments (4+4+4), the first 4 segments are deleted and removed from the array.
All segments inherit from BP_BaseGroundSegment, making it simple to create new segments. After creating a new segment, add it to the SegmentClassesArray variable in the Details panel (shown on the right of the image).
By adjusting the SpawnWeight, you can control how frequently each type of segment appears, affecting both difficulty and randomness.
Controls the main player character, manages the follower crowd, and handles movement input and battle states. Contains one EventGraph and four functions: UpdateFollowerCount, HandleFollowerDestroyed, CheckForGameOver, and RefreshMyFollowerCountDisplay.
UpdateFollowerCount
: Adds or removes BP_Follower
instances to match the TargetFollowerCount
.HandleFollowerDestroyed
: Called when a BP_Follower
is destroyed. Removes it from the CurrentFollowers
array and checks for game over.CheckForGameOverPlayer
: Checks if CurrentFollowers
count is zero; if so, signals the Game Mode to trigger a game over.RefreshMyFollowerCountDisplay
: Updates the FollowerCounterWidget
with the current follower icon and count.The spawn sound for player followers can be modified in the UpdateFollowerCount function, immediately after the SpawnActor node. The unit death sound can be found in the HandleFollowerDestroyed function.
You can also modify the PlayerFollowerIconTexture in this Blueprint.