I am currently working on a wave-based zombie survival game for a final project. I have been successful in getting the enemy sprites to follow the player and avoid obstacles to a degree. My main issue at the moment is getting the enemies to face the player at all times (or at least the enemies in view). Would anyone know of any extensions or example codes that would show how to do this??
character animation extension. Very helpful for animations.
You could use the location of the sprites so for example
if zombie y < player y
zombie look down
Thats all I can do for you rn but if you need further help with it tell me!
You can use this code:
So for every enemy it detects if it is to the left or to the right of the player, then changes its image accordingly. Also, if you want to optimize it more, use something like the sprite utils extension’s (paste into the search bar in the extensions page: https://github.com/jwunderl/arcade-sprite-util) for "array of sprites of kind within “(maybe 80??)” pixels of " instead of "array of sprites of kind . Also, if you have left and right animations, use the timer extension’s "for action “action” at most every ", then put the animations under it.
Also here is a link to the game, the code is currently very messy and I’m waiting to optimize, but I will put comments on the blocks I’m having issues with. https://makecode.com/_AD027Ud83HXX