Simple. All I need to do set the color of an image.
The Invaders constructor sets the image and its color. The Invader is then called in Space (a world actor).
As you can see, the Invader class is being created, but I'm not sure how to set its color (I.e call a Color actor or method to set the actors color)
1 2 3 4 5 6 7 | public Invader(Color invaderColor) { GreenfootImage image = new GreenfootImage( 32 , 20 ); image.setColor(invaderColor); image.fill(); setImage(image); } |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | private void prepare() { removeObjects(getObjects( null )); for ( int j= 0 ; j< 3 +level; j++) { rows[j] = new Row(); addObject(rows[j], 225 , 25 +j* 50 ); for ( int i= 0 ; i< 3 ; i++) addObject( new Invader(), 50 +i* 50 , 20 +j* 50 ); } addObject( new Player(), 30 , 475 ); timer = 0 ; direction = 1 ; drop = false ; } |