Game Development Reference
In-Depth Information
Building the logic
As you may have noticed while building the blueprints, the only two blueprints that can
possibly hold logic were the
Character
type blueprint called
madScientist
and the
Actor
type blueprint called
levelLayout
. The first one will hold the logic for the controller and
anything related to the player, while the second will hold the logic for the level movement/
generation of collectables and score updating.
• On
Event Begin Play
, I will be using
View Target With Blend
to set the current
camera view as the main camera for this level.
• Then, add a custom event called
addScore
to be the one that will control the
Col-
lectables Score
variable of type
int
that holds the score result. Next, use the result-
ant final score to be displayed by the UI
Score
text object using the
Set Text
node
and pass the
Collectables Score
value as a string using the
Int to String conver-
sion
node.
• Now on the
Tick
event, which takes place in every frame, we will be checking
whether the
Collectables Score
value is less than
100
or not. Because if the value
is more than
100
, I'll consider the player victorious and then play the level again
using the
Open Level
node (or show a win screen as in
Chapter 4
,
Advanced Game
Content Generation with a Fruit Chopper Game
). However, if the player's score is
Search WWH ::
Custom Search