import greenfoot.*; // (World, Actor, GreenfootImage, Greenfoot and MouseInfo) /** * Write a description of class MyWorld here. * * @author (your name) * @version (a version number or a date) */ public class Space extends World { int x; int y; GreenfootImage background; /** * Constructor for objects of class MyWorld. * */ public Space() { // Create a new world with 1600x1200 cells with a cell size of 1x1 pixels. super(1600, 1200, 1); x = getWidth()/2; y = getHeight()/2; addObject(new Rocket(),getWidth()/2,getHeight()/2); addEnemy(); addBack(); } public void addEnemy() { int x1 = 1600 / 8; for(int i =0;i<=1600;i=i+x1) { addObject( new enemy1(),200+x1,30); } } public void addBack() { if( enemy1.class == null ) { addEnemy(); } } }