alien = loadImage("Spaceinvaders1.png");
createCanvas(windowWidth, windowHeight);
aliens = new Alien(posX, posY, speedX, shiftDown);
function Alien(x, y, speedX, shiftDown){
this.shiftDown = shiftDown;
this.display = function(){
for (var i = 0; i < 10; i++){
copy(alien, 242, 104, w, h, this.x + (i*80), this.y + 5, w, h);
for (var i = 0; i < 10; i++){
copy(alien, 338, 104, w, h, this.x + (i*80), this.y + 5, w, h);
for (var i = 0; i < 10; i++){
copy(alien, 18, 105, w+24, h-2, this.x + (i*80), this.y + 75, w, h);
for (var i = 0; i < 10; i++){
copy(alien, 130, 105, w+24, h-2, this.x + (i*80), this.y + 75, w, h);
for (var i = 0; i < 10; i++){
copy(alien, 18, 105, w+24, h-2, this.x + (i*80), this.y + 145, w, h);
for (var i = 0; i < 10; i++){
copy(alien, 130, 105, w+24, h-2, this.x + (i*80), this.y + 145, w, h);
for (var i = 0; i < 10; i++){
copy(alien, 176, 18, w+32, h, this.x + (i*80), this.y + 215, w, h);
for (var i = 0; i < 10; i++){
copy(alien, 296, 18, w+32, h, this.x + (i*80), this.y + 215, w, h);
for (var i = 0; i < 10; i++){
copy(alien, 176, 18, w+32, h, this.x + (i*80), this.y + 285, w, h);
for (var i = 0; i < 10; i++){
copy(alien, 296, 18, w+32, h, this.x + (i*80), this.y + 285, w, h);
this.x = this.x + this.changeDir;
if ((this.x >= width-770) || (this.x <= + 0)){
this.changeDir = this.changeDir * -1;
this.y = this.y + this.shiftDown;