Einfügen des Hintergrundbilds

master
Zocker1999NET 10 years ago
parent b97a86ff10
commit da64a01151

@ -39,6 +39,7 @@ public class Colours extends World implements ButtonEvent
{ {
super(x, y, z); super(x, y, z);
setBackground(Start_Load.backgroundImage);
addObject(schwarz, 50, 30); addObject(schwarz, 50, 30);
addObject ( blau, 170, 30); addObject ( blau, 170, 30);
addObject ( grün, 280, 30); addObject ( grün, 280, 30);

@ -23,6 +23,7 @@ public class Map extends World implements ButtonEvent
public Map( int[] bunt, int zahl , String [] name) public Map( int[] bunt, int zahl , String [] name)
{ {
super (1600,900,1); super (1600,900,1);
setBackground(Start_Load.backgroundImage);
colour = new int[zahl]; colour = new int[zahl];
pn = new String[zahl]; pn = new String[zahl];
for (int i=0; i<zahl; i++) for (int i=0; i<zahl; i++)

@ -8,7 +8,11 @@ import greenfoot.*; // (World, Actor, GreenfootImage, Greenfoot and MouseInfo)
*/ */
public class Start_Load extends World implements ButtonEvent public class Start_Load extends World implements ButtonEvent
{ {
Button chulien = new Button("Neues Spiel", 16 , this); static String backgroundImage = "backgroundLight.png" // Gibt an, welches Bild in allen Menüs als Hintergrund gewählt werden soll.
// Light Theme: "backgroundLight.png"
// Dark Theme: "backgroundDark.png"
Button chulien = new Button("Neues Spiel", 16 , this);
/** /**
* Constructor for objects of class Start_Load. * Constructor for objects of class Start_Load.
@ -18,24 +22,25 @@ public class Start_Load extends World implements ButtonEvent
{ {
// Create a new world with 600x400 cells with a cell size of 1x1 pixels. // Create a new world with 600x400 cells with a cell size of 1x1 pixels.
super(1600, 900, 1); super(1600, 900, 1);
setBackground(backgroundImage);
chulien.setSize(100,50); chulien.setSize(100,50);
addObject (chulien, (1600-chulien.getWidth())/2, (900-chulien.getHeight())/2); addObject (chulien, (1600-chulien.getWidth())/2, (900-chulien.getHeight())/2);
} }
public void buttonClicked ( Button b) public void buttonClicked ( Button b)
{ {
if ( b == chulien) if ( b == chulien)
{ {
World chean = new Colours (1600, 900, 1); World chean = new Colours (1600, 900, 1);
Greenfoot.setWorld(chean); Greenfoot.setWorld(chean);
} }
} }
public void Load() public void Load()
{ {
} }
} }

Loading…
Cancel
Save