I'm making a horror game #07

Picking up cards and using them.

I'M MAKING A HORROR GAME

7/22/20233 min read

Gif of Unreal engine 5 where the player is targeting an enemy and swapping between two enemies
Gif of Unreal engine 5 where the player is targeting an enemy and swapping between two enemies

Welcome to another I'm making a horror game post. On today's live stream, we worked on a feature that'll be core to the game. I'm talking about the ability to capture dead enemies' soul in order to defeat future threats. Happy reading!

The camera's purpose changed a little. Its new calling is to capture dead enemies' soul into an object, allowing the player to use the enemy's soul later on to defeat other enemies.

While the camera has this new mechanic tied to it, I did take the time to give it an enemy finding logic in the event that I decide to make the camera stun enemies, as was originally intended.

This enemy finding logic uses distance to find which enemy is closest, saving the order in an array which can then be used to instantly change targets. This makes potential targeting extremely easy for the player, and given the fixed camera angles, it feels particularly nice as repositioning isn't the easiest.

THE CAMERA

THE CARDS

As of now, the object in which you capture the creatures, is cards. You find empty cards around the levels and can use those to capture the souls of creatures using your camera.

In itself, it's very similar to a regular inventory system. It's an array of structs, comprised of a few variables.

Additionally, because you need to carry empty cards, I need to keep track of those, which I do using a basic integer. If you capture a creature, the empty card count decreases. Then, when the card is used, it may return to the empty card pool (depending on the card's parameters.)

It's looking really promising so far and will share more details down the line!

USING THE CARDS

Now the cool part about using the cards is that they'll summon the creature to fight for the player. Whether it's a single hit or a companion that follows the player for a short while, there'll be different types of cards to fit the player's needs in a variety of situations.

To the right, you can see that the card details are broken up as to access the different variables inside the struct. From there, we spawn an actor using the card's actor class. As of now, it spawns at the player's location, but it's highly possible that each card will have specific offsets to spawn at - which would be in the struct.

Well, that's it for now.

I hope you're as excited as I am! This project is really shaping up and there's a lot of functionality coming together as of late. I should probably work on some visuals soon™.

I'll see you for part #08!

When you spawn the actor, different things will happen. Here's an example of an instant hit card type. When the actor is spawned using the logic shown in the previous picture, it only fires the Begin Play node and then it destroys itself after a given lifetime.

What does it look like, you ask? Well, I've got a gif just for you!

This is the very very short version of the whole use camera -> capture -> use card flow, but you get the idea.

Some cards will hold creatures that cannot be found in the game world, so players will have to make sure to check the environment, just in case.

These extra special cards will have higher stats than regular creatures, giving the player a worthwhile investment.