I'm wondering what would be the best way to do this: A boss enemy tosses a smaller enemy as a projectile. After landing the thrown enemy starts behaving like a normal enemy with walking, shooting etc.

My ideas would be either to make an enemy blueprint that has this behavior defined (for example, all the "normal" behavior is turned off until it lands), or to make two classes, the projectile and the enemy... then somehow convert them?

But how would I do it? I'm more interested in the latter method. The first one I could figure out myself. So how would I change the projectile to an enemy? Define some casting? Destroy the projectile and immediately spawn an enemy?

EDIT: What is really interesting to me is the technical side of the problem. If we go with the route of enemy who starts as a projectile and turns into a walking enemy, that would probably involve 2 sets of AI (I'm just grasping that, forgive me) and some trigger to switche between them, like hitting a wall. Seems simple.

If we go with the route of 2 classes, the transition is what bothers me. The most simple way would be to destroy the ProjectileEnemy and spawn the Enemy from it. That obviously won't work - after destroying Projectile enemy, there's nothing to call "Spawn" method. I have a crude workaround, spawn Enemy first and immediately after - destroy ProjectileEnemy. Won't that cause visual issues and other problems though?

  • \$\begingroup\$ "The first one I could figure out myself." The first one sounds like the correct way to go, and you can figure out yourself, so what exactly is the question? The second method is more complicated in my opinion. Keep in mind that you can simply have an enemy handle what happens while they are "flying" in the air, so if they land on the player they deal damage equal to their speed, so if a boss throws them, the mechanics are already there and there is no need to seperate the two. \$\endgroup\$ Sep 18, 2018 at 15:14
  • \$\begingroup\$ My question was what would be a better method. And of the two answers that I got, I got voices for both of them, so apparently the answer isn't so simple... Also it's always good to get more opinions. \$\endgroup\$
    – lilKriT
    Sep 20, 2018 at 21:38
  • \$\begingroup\$ I understand and I'm glad you found help here :) Just keep in mind that from the Tour questions that ask for opinions are discouraged, as there is no correct answer. It's easier to get an answer when the question has a concrete answer, one example being if you tried the first way, and got stuck on something, this would be the perfect place to ask for help. \$\endgroup\$ Sep 21, 2018 at 8:35
  • \$\begingroup\$ Thanks. I will try to be more specific next time - I don't have much experience posting here. Would it be better if I worded the question "what are the pros and cons of both methods?" \$\endgroup\$
    – lilKriT
    Sep 22, 2018 at 2:41
  • \$\begingroup\$ A better way to word it would be "I tried X but it doesn't work / it doesn't solve my problem, why not? Would Y solve it instead?". I'm not sure if Pros and Cons would work, as they show low effort. The general expectation is, first you try it yourself, then you search google and other forums, and if you are still stuck ask here. This is to keep people asking questions that can be answered within 5 minutes of googling, or problems that someone could solve if they actually tried their idea first. \$\endgroup\$ Sep 22, 2018 at 17:25

1 Answer 1


Although I suspect this question is somewhat opinion based, I believe the best way would be to have 2 different classes and have the enemy spawn where the projectile lands using an OnCollision event.

The main reason is that while it is possible that to calculate the angles and velocity to throw the enemy so it lands on its feet before turning into a normal AI, it's not the most efficient way. Using a projectile in an circle (or similar) basic shape means it can land any way it likes and the enemy spawns in the correct position.

Using the OnCollision event means you can run a check on where the projectile is (did it hit a wall? The player? Was it shot by the player?) so you can decide whether you want the trigger event to take place.

It also means you can have different weights, physics, materials and other things needed to make the spawned projectile move smoothly through the air and not need to change and of these on landing which could potentially slow down render time.

ADDITIONAL BASED ON EDIT TO QUESTION: You won't need two sets of AI. The projectile is just that. Fired with a velocity and physics.

To get around the issue of having both the projectile and the enemy AI on screen at the same time, you could have two extra variables on your boss. A boolean as to whether the projectile has landed and an FVector of the landing location.

On collision of the projectile with a floor, wall, whatever, the projectile casts to the boss, changing these two variables then destroying itself. The boss on tick, can check if the boolean is true and if it is, spawn the enemy AI at the FVector location before setting the bool to false so it doesn't spawn multiple enemies at the same location.

  • \$\begingroup\$ Thank you for the answer. I edited my question to answer and specify some things :) \$\endgroup\$
    – lilKriT
    Sep 17, 2018 at 17:50
  • \$\begingroup\$ That's a good idea to make the boss hold information about the enemy... I was ready to make a temporary object to take care of the transition. Obviously your method is better! \$\endgroup\$
    – lilKriT
    Sep 22, 2018 at 2:42

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .