blueprint

Paperboy BP_Player Lives and Highscore Screen 210260

  • Exposure: public
  • UE Version: 5.0

TobiyC

January 18, 2023, 5:12 pm

Click the button above, it will automatically copy blueprint in your clipboard. Then in Unreal Engine blueprint editor, paste it with ctrl + v

1 comment

  • TobiyC

    January 18, 2023, 6:36 pm

    This is the section of the BP_Player blueprint that relates to lives. The blueprint starts off by checking to see if Paperboy overlaps with a number of other blueprints that kill him, such as BP_DeathSequence. For all but one, if Paperboy does overlap, an Event Dispatch is sent to BP_MainTheme to reset the main theme music, and then there is a delay of 4.2 seconds (the amount of time the death sequence takes to complete before Paperboy respawns) before feeding into a branch. The branch checks if the "Lives" integer variable is larger than 0. If it is, then the Lives variable is decreased by 1, and Paperboy's speed is reset for when we respawns, so he does go flying off when he respawns. By default, the Lives variable is 4.

    The one blueprint overlap that behaves differently is for BP_EndSequence. There is nothing in that blueprint, but it is used to determine if Paperboy has touched the end area. If Paperboy has reached the end of the level, there is a delay of 4.2 seconds, before the Lives variable is set to 0, rather than subtracted by one, and his speed is halted.

    If the branch that checks the Lives variable is above 0 comes back negative, and directly after the BP_EndSequence detour, the Highscore Screen gets activated. It starts by calling an EventDispatch that goes to BP_MainTheme, which completely stops the main theme playing. Afterwards, it calls the function Submit Score. The target is the "HighScoreUI", a widget variable tied to the HighScore widget. Additionally, the current score (Score Integer64 variable) and breakage bonus score (Break Score Integer64 variable) are taken from the UI widget (UI Reference widget variable), and added together to get the player's final score, and plugged into 'New Score.' This uses interfaces to call a function on the target called submit score, which is how your score shows up in the Highscore screen.

    Afterwards, Paperboy is teleported far below the map, where we isn't able to move or interact with anything, player inputs are disabled so the player can't control Paperboy anymore, Paperboy's speed is set to 0 so he won't move forward, and the Highscore Screen music starts playing.