The basic enemy
The basic enemy
![]() |
| Idle sprite of the enemy, crackling. |
Introducing the first enemy of the game, the crackling. It is a four-legged insect the player encounters while traversing the desert canyons of the planet Unu'qu. The crackling is classified as a fodder-type enemy, meaning it is weak and not particularly threatening, but several of them could overwhelm the player.
The crackling follows a simple enemy AI that begins to chase the player after seeing them or receiving damage, and after a few seconds returns back to their original location if they lose track of the player. Once the crackling is close enough to the player, it begins executing its attack, which is a short-range dash to hit the player with its claws. While preparing, the attack locks onto the player's location, and then the crackling dashes towards that position. If the player moves too far during the preparation, the dash is still executed but falls short.
The video clip below shows the crackling in action. During the dash attack, the yellow debug circle indicates the target location of the attack and the pink sphere is the attack's hitbox.
AI movement and 2D sprite
After making the AI chase the player I noticed that the AI treats its pawn as a 3D character (which it really is), so the sprite rotates along with the actor on the z-axis as the enemy moves. Rotation can be disabled by unchecking controller rotation yaw in the class's default settings, but this also counts the actor's line of sight and the directionality variable that is used in sprite animations is not updated. So I let the AI rotate the actor as it pleased and implemented an event that, while the actor is moving, keeps the sprite's rotation at set values while updating the directionality to have animations in the correct directions.
![]() |
| The function that sets the directionality variable from the actor's forward vector. |

