so I'm trying to make a space shooting game where it has 2 types of enemies, the 1st enemy will hit the player directly, and for the second one I want him to shoot and move to the right and left while moving towards the player, and the question is how to create the maneuverability in 2nd enemy ? should I calculate the enemy's position and move it when the position is over / equal to / near the viewport boundary? or have to do something else?
the 2nd enemy code is almost the same as the first but I I just added firepower and and also the enemy will appear in a random x position
i hope you can help me, thank you