New Enemy Movement
Objective: make enemies that will move in a different pattern than straight down
I did this by modifying the Enemy script adding the variables I would need:
Then to start off I check if this enemy is one I will have zigzagging:
Then if it is, it will determine if it has zigged long enough to start zagging and determine how long, and say that it has just swapped and record the time it swapped.
Here I determine if it has been long enough to change direction and then set it to redirect next frame.
Then I move left or right twice as much as it moves down based on the direction of zigzagRight.
I also added the code to have the enemy move to the other side of the screen if they start to go off screen: