Booleans and Branches UE5

Chris Didier
May 21, 2022

--

We are now going to stop you from firing once we run out of ammo. To do this we must add some booleans to our code.

Booleans let us know if something is true or false and we create branches off it.

A branch is an if statement in C++

In this case we do not want to be able to fire if our ammo = 0.

So we are going to get our ammo count and see if our count is greater than 0 if it is we are going to be able to fire if not we will not be able to and a string will print out that we are out of ammo

We now can no longer shoot after we are out of ammo.

--

--

Chris Didier
Chris Didier

No responses yet