Game Development Reference
In-Depth Information
To ensure that the player can't just shoot continuously, we check the value of the local
variable bullets before processing a bullet spawning process. Every time the player
presses the shoot button, we make sure that the number of bullets is more than
0
and then
call the
shoot
event to process a bullet and call the
changeAmmoValue
to reduce the
number of bullets.
The
shoot
event itself is just using the
spawnPoint
type of
billboard
component to get a
world transform and then using the
Spawn Actor of Class
node to spawn the
bullet
blue-
print.
Then it reduces the total number of the current bullets in the local variable
bullets
by
1
us-
ing the
integer - integer
node, and finally plays a shooting sound at the location of the
spawning.
In case the character controller
Event Hit
gets hit with a component that has an
enemy
tag, then the level needs to be restarted as the player will die.
Search WWH ::
Custom Search