Book Image

Learning C++ by creating games with UE4

By : William Sherif
Book Image

Learning C++ by creating games with UE4

By: William Sherif

Overview of this book

Table of Contents (19 chapters)
Learning C++ by Creating Games with UE4
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
2
Variables and Memory
Index

Chapter 12. Spell Book

The player does not yet have a means to defend himself. We will equip the player with a very useful and interesting way, of doing so called magic spells. Magic spells will be used by the player to affect monsters nearby.

Practically, spells will be a combination of a particle system with an area of effect represented by a bounding volume. The bounding volume is checked for contained actors in each frame. When an actor is within the bounding volume of a spell, then that actor is affected by that spell.

The following is a screenshot of the blizzard and force field spells, with their bounding volumes highlighted in orange:

Visualization of the blizzard spell can be seen at the right, with a long, box-shaped bounding volume. Visualization of the force field spell, with a spherical bounding volume, for pushing monsters away, is shown in the following screenshot:

In each frame, the bounding volume is checked for contained actors. Any actor contained in the spell's bounding volume...