Hi, I am making space invaders on greenfoot and am having trouble moving the invaders left to right while simultaneously shooting.
This is my code in the MyWorld class (to set up the invaders):
I am unsure even where to start in the invaders class to get them all to move to the left and right
Thanks for the help!
1 2 3 4 5 6 7 8 9 10 11 12 13 | Invader[] invaders = new Invader[ 5 ]; for ( int i= 0 ; i< 5 ; i++){ invaders[i] = new Invader(); addObject (invaders[i], 85 +(i* 100 ), 86 ); } for ( int i= 0 ; i< 5 ; i++){ invaders[i] = new Invader(); addObject (invaders[i], 85 +(i* 100 ), 180 ); } for ( int i= 0 ; i< 5 ; i++){ invaders[i] = new Invader(); addObject (invaders[i], 85 +(i* 100 ), 274 ); } |