Building an Enemy
These notes start at 2:00 Creating an Enemy Base.
And end at 2:45
He states that he is going to build a hierarchy.
This is why you took 330.
Do this.
Note he starts with an existing class as his base class!
And the first thing he does is go into a design.
Remember, this is the most generic of the enemies
So it shouldn't contain any specializations
Think this through thoroughly as you design your game.
"What should/must all enemies be able to do?"
The specialize with child classes after that.
Note he discusses that movement might not be a property of an enemy.
He decides that all enemies need
DefaultHealth, Health.
He will probably do this later, but I decided to expose these to the outside world.
Then add an BP_EnemyBase to the world.
And I can change the health on a per_enemy basis.
He builds methods for health.
He builds a pure virtual function!
But I don't think you have the ability to prohibit creating an instance of this abstract class however.
That is all he adds at this point.
Remember, the good part of this system is that you can add more to the base class later if you find yourself reproducing functionality.
He then goes on to build a bat subclass.
Shows calling the base constructor!
And how to provide a member function to override base behavior.
Finally five minuets of easy!
Clear up to bat movement.
I didn't see how he was testing movement.
And I wanted better control anyway, so I added a keypress.
I am fairly sure that the only thing that takes keypresses by default is the player.
So I added
A change direction member function to the bat.
BatT::ChangeDirection{ MoveRight = not MoveRight SetSprintDirection(moveRight); }
And a function in my player character debug events to switch the direction of all bats on the screen.
Finally, I added three more bats. And moved my player start so I could see everything from the start
He starts working on bat navigation.
A
surface normal
is a vector pointing straight out (perpendicular) to a surface
See
Hit Results
in the unreal documentation.
This essentially points from the impact location back to the thing hitting.
I think the normal part comes in as this vector is
normalized
His bat collision left me confused about the checking the hit normal vector.
I will work it out later when we figure out what he is doing with all of his collisions.