Yes.
(Your description is a solid basis for the code itself.)
The following PseudoCode outlines a possible solution...
Variables:
global_Invaders_Direction
global_Invaders_Speed
invadersWin
Routines:
init_Invaders
{
invadersWin = FALSE
global_Invaders_Direction = RIGHT
global_Invaders_Speed = SLOWEST
( create invaders in start up position here )
}
On Draw Invader
{
myDirection = global_Invaders_Direction
mySpeed = global_Invaders_Speed
If too close to right ( eg x > max )
drop global level and change global direction
else If too close to left (eg x < min )
drop global level and change global direction
if global level is ground level ( eg y > max )
invadersWin = TRUE
adjust global_Invaders_Speed according to population of invaders
}
I hope this helps!