600 Game Development and Simulation with Unreal Technology
16. Connect the return value of the G et Player Controller to the Target of the Set
View Target with Blend.
17. Connect the return value of the GameOver Camera re ference to the New Vi ew
Target.
18. Change the Ble nd Func to VTBlend Cubic and set th e blend time to 0.25.
19. From the set view target with blend, drag off a delay node with a duration of 5.0 .
20. From that Delay node, drag off a Open Level node and type in your level name
in the Level Name box.
21. Finally from the Open Level node drag off another Print String node that out-
puts Reloading level....
22. You can comment a ll these as Gameover and Reloading Level ( see Fig-
ure 9.33).
23. Compile and save yo ur blu eprint.
What Happened in TUTORIAL 9.10. . .
With the logic for our player, enemy, and projectile’s damage implemented, we
need to have a mecha nism to declare game over. We will also need to visually
convey the end-game to the player’s attention through a cut-scene.
In this tutorial we implemented the end game and game over cinematic. We
first created a second camera to change our view fr om the top-down view of the
player to the gam e-over view. This view will have a wider angle and looks at
the player in a wider area of the level. Later on, wh en we implement the visual
effects for the player’s death sequence with fires and smoke, this view will be
pretty interesting.
To cut to the new camera, we looked for an event on the play er character’s
class called onDestroyed. When a player’s health reaches zero, form the dam-
age logic we had called a Destro y Actor function to destroy the player. Once
this happens, the onDestroyed event will fire. When the event fires, we will cut
to the game over camera, stay there for 5 minutes an d restart the level.
9.8 AI AND ENEMY SPAWNING
We have been making great progress so far in establishing our level, designing our
character, projectiles, and enemy classes and implementing the damage functional-
ities. However, our game is nowhere close to being p la yable. For one thing, our
enemies are going to be q uite static if we place them in the game.
This is because we do not have a mechanism in place fo r our enemy to play the
game. That requir es Artificial Intelligence (AI). The A I we will e stablish in this level
is going to be quite simple. In fact, it will be so simple that only on e beh avior could
describe it. T hat behavior is the seeking behavior. We will implement this behavior
in such a way that our enemy instances c ould detect the p la yer and try to chase him.