Before beginning, if this has already been answered and I just couldn’t find the correct forum post, please feel free to take this down. I’ve been trying to wrap my head around enemy movement and I experimented in 2d with a fair amount of success. However, when transferring my knowledge to 3d, I hit a snag. Everything executes as intended, except my enemy doesn’t go anywhere. He just animates in place.
Heres what Im fixing to do: the player sends out an invisible bullet as he moves which attracts the enemy. The enemy moves from an idle state, does a scream, and rushes toward the player (still havent worked out how to rotate toward the player yet), and then stop at the player and do an attack animation.
Also of note: Im using locked pointer movement set to a camera rotation of 180*MousePointerLock::MovementX()/SceneWindowWidth
and a 3d walk keypress for my player. I also set a 2d sprite at the players Center X/Y
is called up repeatedly for 1.5 seconds, until the animation is changed to “Run”. 1.5 seconds, at 60 game frames a second, means about 90 of the actions are queued up.
After 1.5 seconds has elapsed, the variable Scream of Enemies cannot be set to true or the animation changed from “Run” because the actions are queued up and the variable is overridden by being set to “Run”.
Simlarly, after another 1.5 seconds, the variable Chase of Enemies cannot be changed for 1.5 seconds also because of the queued up actions.
If you have a conditional event, it will get actioned every time those conditions are met. If you have a wait in there, those actions get queued up unless the conditions change or there is a “Trigger once”. A wait doesn’t pause the event - it adds the actions after the wait command to a queue for processing and then continues with the game.
Additionally, you have conditions referencing Enemies (object group?) but the actions reference Enemy. You may want to fix that, so you reference the correct object in both the conditions and actions.