In a video game, anything can be an obstacle and anything can be an enemy; it can start out as something harmless and suddenly become a threat, it can move from side to side or stay in the same position all the time, it can be predictable or not, and so on. The main focus here will be to learn the basic functionalities of an enemy and then we can choose whether we want to use them or not; that way we can create different type of enemies, just by choosing what we allow them to do.
As we can see in the following image, using this method, we are able to create a few distinct enemies:
This is a great approach, especially at the stage where we are still creating our first game; we can add a little bit of variety to our enemies and all of them share the same script.