The EnemyBrain has an additional behavior. The AI can also feint after attacking, when it’s not moving (because it’s probably blocked) and sometimes at random.
Before shooting it LineTraces the player to see if you’re on sight and only fires when it’s true.
But because of the movement speed and the small delay after the trace it still can hit and damage other enemies.
Missiles spawn explosions, a good way to get feedback on where do projectiles hit.
This is a demonstration of how easy is to create a basic enemy using a small bunch of nodes.
With the PawnSensing component the enemy activates when I enter its peripheral vision.
Then it enters Move or Attack mode randomly. It doesn’t have any aiming detection so it fires indiscriminately with hilarious results.
Platforms and doors can be activated with switches. They’re
interconnected through interfaces and they communicate their states to each other.
The moving platform is a blueprint actor with a timeline and an array of target actors distributed around the map.
From the array you can get the actor location and with a little bit of
math increase or decrease the timeline play rate so the movement speed is constant between points.
Making some changes to the door blueprint I created a vertical moving platform. It activates the same way but it’s interactive only when it’s on the starting position.
I added strafe running just like in Doom. If you run diagonally the speed goes from 1200 units (cm.) per second to 1800.
Because of the friction you need to run some distance until you get to the maximum speed.
This opens the possibility to speedrunning tricks.
I expanded the logic so pickups can now respawn after a while.
I also added a basic widget to see the values and stats at work, now it looks more like a game without the Print Strings.
Characters make sound when dead including the player, which actually dies when health gets to 0 and respawns after 3 seconds.
I also created an event called DeathCam. When the player dies the camera moves back to watch the death animation.
With a basic damage system in place I proceeded to create a basic
inventory system and the pickups including keys, health packs, armors, ammo and powerups.
To test if they work I put four pain causing volumes on the map and a couple of Print String nodes printing the stats.
With a macro and a basic loop flipbooks are slightly scaled down and up creating a sense of movement while idling, I called it Idle Breathing.
Vanilla Doom just plays the first 2 frames of the walking animation but I prefer this.
When an enemy dies a corpse actor is spawned changing the collision shape and size and depending on the amount of damage received it plays a normal dying animation or one with explosion.
This corpse actor will be expanded so when damaged it explodes spawning flying gibs and blood squirts and pools.
Now the missile is set up to deal random damage from 1 to 100 and the zombie to destroy itself when he gets to 0 from 20 health points.
Some enemies will have “gib points” which is the damage threshold beyond 0 HP in which they will die exploding.
In the future every character’s corpse will be able to explode like in Duke Nukem or Brutal Doom and the gibs will bleed.
I also bound firing to a timer so it can be done at faster rate.
Now it’s when fun really starts.
I created some macros to calculate which sprite should be displayed depending on the angle formed by the forward vector and the player position.
I used those macros with a zombie and the projectile and this is the result.
The missile is the only projectile with different angle sprites, the rest will just face the player like the placeables.