Game Development Reference
In-Depth Information
Congratulations! Now you have built your first functional and complex blueprint that con-
tains the main and important functionalities everyone must use in any game. Also, you got
the trick of how you can randomly generate or change things such as the color of the
blocks to make the levels feel different every time.
The Ball blueprint graph
The main event node that will be used in the ball graph is Event Hit , which will be fired
automatically every time the ball collider hits another collider. If you still remember,
while creating the platform, walls, and blocks, we used to add tags for every static mesh to
define them. Those names are used now. Using a node called Component Has Tag , we
can compare the object component that the ball has hit with the value of the Component
Has Tag node, and then, we either get a positive or negative result. So, this is how it
should work:
• Whenever the ball gets hit with another collider, check whether it is a brickPiece
tagged component. If this is true, then disable the collision of the brick piece via
the Set Collision Enabled node and set it to No Collision to stop responding to
any other collisions. Then, hide the brick mesh using the Set Visibility node and
keep the New Visibility option unmarked, which means that it will be hidden.
Then, play a sound effect of the hit to make it a more dynamic gameplay. You can
play sound in many different ways, but let's use the Play Sound at Location node
now, use the location of the ball itself, and use the hitBrick sound effect from the
Audio folder by assigning it to the Sound slot of the Play Sound at Location
node. Finally, reset the velocity of the ball using the Set Velocity node referenced
by the Projectile Movement component and set it to XYZ 300, 0, 300 :
Search WWH ::




Custom Search