Starting AI

i want to make a game where the char walks from side to side on the screen and shoots enemies, who come from the sides.

how do i make the enemies come from the sides randomly and attack?