Merge branch 'master' into GeneralMapErweiterung

Update Merge
pull/60/head
Felix Stupp 8 years ago
commit 0e9bd093d2

@ -0,0 +1,125 @@
import greenfoot.*; // (World, Actor, GreenfootImage, Greenfoot and MouseInfo)
/**
* Write a description of class Colors here.
*
* @author (your name)
* @version (a version number or a date)
*/
public class Colours extends World implements ButtonEvent
{
Button schwarz = new Button ("Schwarz", 16, this);
Button blau = new Button ("Blau", 16, this);
Button grün = new Button ("Grün", 16, this);
Button rot = new Button ("Rot", 16, this);
Button lila = new Button ("Lila", 16, this);
Button gelb = new Button ("Gelb", 16, this);
Button weiter = new Button ("Weiter", 16, this);
int [] color = new int [6];
String [] pn = new String [6];
int x = 0;
boolean possw = true;
boolean posbl = true;
boolean posgr = true;
boolean posrt = true;
boolean posgb = true;
boolean posli = true;
int sw = 1;
int bl = 2;
int gr = 3;
int rt = 4;
int gb = 5;
int li = 6;
/**
* Constructor for objects of class Colors.
*
*/
public Colours(int x, int y, int z)
{
super(x, y, z);
addObject(schwarz, 50, 30);
addObject ( blau, 170, 30);
addObject ( grün, 280, 30);
addObject ( rot, 390, 30);
addObject(gelb, 500, 30);
addObject(lila, 610, 30);
addObject (weiter, 335,90);
schwarz.setSize(100, 50);
gelb.setSize(100, 50);
blau.setSize(100, 50);
grün.setSize(100, 50);
rot.setSize(100, 50);
lila.setSize(100, 50);
weiter.setSize(100, 50);
}
// Überprüft, ob ein Farbbutton geklickt wurde
//Überprüft, ob die Farbe noch nicht ausgewählt wurde
// Wenn alle Bedingungen erfüllt wurden:
// Setzt die aktuelle Stelle des Farbarrays gleich der Zahl der aktuellen Farbe
// erhöht die Variable zum Durchzählen um eins
// verhindert durch falschsetzten einer Variable die Wiederauswahl einer Farbe
// wenn Weiter geklickt wurde und x größer 1 ist wird eine neue Welt Map erzeugt,
//der per Konstruktor die Daten der Colorklasse übertragen werden, dannach wird die Map die aktive Welt
public void buttonClicked (Button b)
{
if ( b == schwarz && possw == true)
{
color [x] = sw;
pn[x]="Schwarz";
x+=1;
possw = false;
}
if (b == blau && posbl == true)
{
color[x] = bl;
pn[x] = "Blau";
x+=1;
posbl = false;
}
if (b == grün && posgr == true )
{
color[x] = gr;
pn[x]="Grün";
x+=1;
posgr = false;
}
if ( b == rot && posrt == true)
{
color[x] = rt;
pn[x]="Rot";
x+=1;
posrt = false;
}
if ( b == gelb && posgb == true)
{
color [x] = gb;
pn[x]="Gelb";
x+=1;
posgb = false;
}
if ( b == lila && posli == true)
{
color [x] = li;
pn[x]="Lila";
x+=1;
posli = false;
}
if ( b == weiter && x >=2 )
{
String[] newpn = new String[x];
int[] newcolor = new int[x];
for (int i = 0; i< x; i++)
{
newpn[i] = pn[i];
newcolor[i] = color[i];
}
World m = new Map(newcolor, x,newpn);
Greenfoot.setWorld(m);
}
}
}

@ -0,0 +1,72 @@
import greenfoot.*; // (World, Actor, GreenfootImage, Greenfoot and MouseInfo)
/**
* Write a description of class Map here.
*
* @author (your name)
* @version (a version number or a date)
*/
public class Map extends World implements ButtonEvent
{
private Button map1 = new Button ("map1",16,this);
private Button map2 = new Button ("map2",16,this);
private Button fertigst = new Button (" Fertigstellen",16,this);
int [] colour = new int[6];
String [] pn = new String [6];
int pnu;
//private int x;
//private int y;
private int m=0;
private Map_World MW ;
// int [] newcolour = new int [pnu];
// String [] newpn = new String [pnu];
public Map( int [] bunt, int zahl , String [] name)
{
super (1600,900,1);
for (int i=0; i<pnu; i++)
{
colour[i] = bunt[i];
pn[i] = name[i];
}
pnu=zahl;
addObject(map1, 50, 30);
addObject(map2, 170, 30);
addObject(fertigst,110,90 );
map1.setSize(100, 50);
map2.setSize(100, 50);
fertigst.setSize(100, 50);
// for ( int i=0; i<=pnu; i++)
// {
// newpn[i] = pn[i];
// newcolour[i] = colour[i];
// }
}
// Die Map Buttons geben der Variable m einen Wert
public void buttonClicked(Button b)
{
if (b== map1)
{
//x= ;
//y= ;
m =1;
}
if (b== map2)
{
m =2;
}
if (b == fertigst)
{
if (m==1)
{
GeneralMap m = new Map_World (pn, colour);
Greenfoot.setWorld(m);
}
}
}
}

@ -21,7 +21,7 @@ public class Map_World extends GeneralMap
konstruiert eine GeneralMap mit den Ausmassen 1600 auf 900 Pixel.
*/
public Map_World(String[] playerList, int[] colorList)
public Map_World(String[] playerList, int[] colourList)
{
super("",playerList,colorList);
setBackground("Risiko Karte.png");

@ -261,7 +261,7 @@ public class Player extends Actor
private void redraw(GreenfootImage statistics,GreenfootImage flag, int textSize)
{
flag.scale(137,100);
flag.scale(137,83);
statistics.drawImage(flag,0,textSize);
GreenfootImage playerStatistics = new GreenfootImage(stats[0] + "||" + stats[1] + "||" + stats[2],textSize,new Color(0,0,0),new Color(1.0f,1.0f,1.0f,0.5f));
GreenfootImage playerStatistics2 = new GreenfootImage(stats[3] + "||" + stats[4] + "||" + stats[5],textSize,new Color(0,0,0),new Color(1.0f,1.0f,1.0f,0.5f));

@ -169,7 +169,7 @@ public class Province extends Actor
{
int textSize;
textSize = 20;
GreenfootImage province = new GreenfootImage(100,100);
GreenfootImage province = new GreenfootImage(120,100);
GreenfootImage provinceName = new GreenfootImage(displayName,textSize,new Color(0,0,0),new Color(1.0f,1.0f,1.0f,0.5f));
province.drawImage(provinceName,0,0);
oDecide(province,textSize);
@ -235,18 +235,18 @@ public class Province extends Actor
if(eCountTanks == 2)
{
province.drawImage(tank,0,textSize);
province.drawImage(tank,17,textSize);
province.drawImage(tank,textSize,textSize);
}
if(eCountTanks == 3)
{
province.drawImage(tank,0,textSize);
province.drawImage(tank,textSize,textSize);
province.drawImage(tank,textSize,textSize);
province.drawImage(tank,textSize*2,textSize);
}
}
else
{
GreenfootImage eCountTanksImage = new GreenfootImage(Integer.toString(eCountTanks) + "x",textSize,Color.CYAN,new Color(1.0f,1.0f,1.0f,0.5f));
GreenfootImage eCountTanksImage = new GreenfootImage(Integer.toString(eCountTanks) + "x",textSize,Color.BLACK,new Color(1.0f,1.0f,1.0f,0.5f));
province.drawImage(eCountTanksImage,0,textSize);
province.drawImage(tank,45,textSize);
}
@ -255,7 +255,7 @@ public class Province extends Actor
horse.scale(textSize,textSize);
if(eCountHorse == 1)
{
province.drawImage(horse,0,2 * textSize);
province.drawImage(horse,4*textSize,textSize);
}
GreenfootImage Inf = new GreenfootImage("images\\infanterieskal-" + ownerString + ".png");
int eCountInf = eCount - (eCountTanks * 5) - (eCountHorse * 3);
@ -264,12 +264,12 @@ public class Province extends Actor
{
if(eCountInf == 1)
{
province.drawImage(Inf,0,3* textSize);
province.drawImage(Inf,5*textSize,textSize);
}
if(eCountInf == 2)
{
province.drawImage(Inf,0,3 * textSize);
province.drawImage(Inf,25,3 * textSize);
province.drawImage(Inf,5*textSize,textSize);
province.drawImage(Inf,5*textSize,textSize);
}
}
setImage(province);

@ -0,0 +1,41 @@
import greenfoot.*; // (World, Actor, GreenfootImage, Greenfoot and MouseInfo)
/**
* Beginnt neues Spiel/ lädt altes Spiel.
*
* @author 4ngelica
* @version 1.0
*/
public class Start_Load extends World implements ButtonEvent
{
Button chulien = new Button("Neues Spiel", 16 , this);
/**
* Constructor for objects of class Start_Load.
*
*/
public Start_Load()
{
// Create a new world with 600x400 cells with a cell size of 1x1 pixels.
super(1600, 900, 1);
chulien.setSize(100,50);
addObject (chulien, (1600-chulien.getWidth())/2, (900-chulien.getHeight())/2);
}
public void buttonClicked ( Button b)
{
if ( b == chulien)
{
World chean = new Colours (1600, 900, 1);
Greenfoot.setWorld(chean);
}
}
public void Load()
{
}
}

@ -1,147 +1,317 @@
#Greenfoot properties
#Sun May 29 22:05:35 CEST 2016
editor.fx.0.height=700
target2.width=100
target8.name=Map_World
target11.y=190
target11.x=10
class.GUI_Interface.superclass=greenfoot.Actor
target1.type=ClassTarget
target7.showInterface=false
mainWindow.height=600
target6.typeParameters=
target1.height=50
class.Dice_Offender.superclass=Dice
target8.y=70
target8.x=170
dependency2.type=UsesDependency
target5.type=ClassTarget
target6.y=10
target6.x=120
target1.showInterface=false
target4.y=310
target4.x=10
target4.showInterface=false
target9.type=ClassTarget
target2.y=250
target2.x=10
target10.type=ClassTarget
target8.height=50
target11.height=50
target10.typeParameters=
dependency4.from=Map_World
class.Weltenauswahl.superclass=Spieloptionen
target1.name=Dice
target10.showInterface=false
class.Map_World.superclass=GeneralMap
target4.typeParameters=
target5.name=Province
world.lastInstantiated=Map_World
class.Dice.superclass=greenfoot.Actor
mainWindow.width=800
readme.width=47
#Greenfoot project file
class.ArmySchubser.superclass=Map_World
class.Button.superclass=GUI_Interface
class.ButtonEvent.superclass=
class.Colours.superclass=greenfoot.World
class.CurrentPlayerArrow.superclass=GUI_Interface
class.DefenderDices.superclass=DicesList
class.Dice.superclass=GUI_Interface
class.Dice_Defender.superclass=Dice
class.Dice_Offender.superclass=Dice
class.DicesList.superclass=greenfoot.Actor
class.Fight.superclass=Map_World
class.GUI_Interface.superclass=greenfoot.Actor
class.GeneralMap.superclass=greenfoot.World
class.CurrentPlayerArrow.superclass=GUI_Interface
target9.name=Button
target5.height=50
target10.name=Dice_Offender
target2.type=ClassTarget
class.Label.superclass=GUI_Interface
class.Map.superclass=
class.Map_World.superclass=GeneralMap
class.Menue_Button.superclass=Button
class.OffenderDices.superclass=DicesList
class.Player.superclass=greenfoot.Actor
class.Province.superclass=greenfoot.Actor
class.Roll_Button.superclass=Button
class.Spieleranzahl.superclass=Spieloptionen
class.Spieloptionen.superclass=greenfoot.World
class.Start_Load.superclass=greenfoot.World
class.Utils.superclass=
class.Weltenauswahl.superclass=Spieloptionen
dependency1.from=Province
dependency1.to=Utils
dependency1.type=UsesDependency
dependency10.from=Province
dependency10.to=GeneralMap
dependency10.type=UsesDependency
dependency11.from=GeneralMap
dependency11.to=Player
dependency11.type=UsesDependency
dependency12.from=Button
dependency12.to=ButtonEvent
dependency12.type=UsesDependency
dependency13.from=Button
dependency13.to=Utils
dependency13.type=UsesDependency
dependency14.from=ButtonEvent
dependency14.to=Button
dependency14.type=UsesDependency
dependency15.from=Roll_Button
dependency15.to=ButtonEvent
dependency15.type=UsesDependency
dependency16.from=Start_Load
dependency16.to=Button
dependency16.type=UsesDependency
dependency17.from=Start_Load
dependency17.to=ButtonEvent
dependency17.type=UsesDependency
dependency18.from=Colours
dependency18.to=Button
dependency18.type=UsesDependency
dependency19.from=Colours
dependency19.to=Map
dependency19.type=UsesDependency
dependency2.from=GeneralMap
dependency2.to=Menue_Button
dependency2.type=UsesDependency
dependency20.from=Fight
dependency20.to=Province
dependency20.type=UsesDependency
dependency21.from=Fight
dependency21.to=Dice_Offender
dependency21.type=UsesDependency
dependency22.from=Fight
dependency22.to=Dice_Defender
dependency22.type=UsesDependency
dependency23.from=Map
dependency23.to=Button
dependency23.type=UsesDependency
dependency24.from=Map
dependency24.to=GeneralMap
dependency24.type=UsesDependency
dependency25.from=Colours
dependency25.to=Map_World
dependency25.type=UsesDependency
dependency26.from=Start_Load
dependency26.to=Colours
dependency26.type=UsesDependency
dependency27.from=Map
dependency27.to=GeneralMap
dependency27.type=UsesDependency
dependency28.from=Colours
dependency28.to=Map_World
dependency28.type=UsesDependency
dependency3.from=GeneralMap
dependency3.to=Roll_Button
dependency3.type=UsesDependency
target2.height=50
target2.typeParameters=
target6.type=ClassTarget
editor.swing.0.height=700
class.Spieloptionen.superclass=greenfoot.World
target9.typeParameters=
target11.type=ClassTarget
version=2.8.0
editor.fx.0.y=0
dependency4.from=Map_World
dependency4.to=Province
dependency4.type=UsesDependency
dependency5.from=Player
dependency5.to=GeneralMap
dependency5.type=UsesDependency
dependency6.from=Menue_Button
dependency6.to=ButtonEvent
dependency6.type=UsesDependency
dependency7.from=ArmySchubser
dependency7.to=Province
dependency7.type=UsesDependency
dependency8.from=DicesList
dependency8.to=Dice
dependency8.type=UsesDependency
dependency9.from=DicesList
dependency9.to=Utils
dependency9.type=UsesDependency
editor.fx.0.height=700
editor.fx.0.width=700
editor.fx.0.x=0
target2.showInterface=false
dependency1.from=Province
mainWindow.y=10
editor.swing.0.y=0
mainWindow.x=10
editor.fx.0.y=0
editor.swing.0.height=700
editor.swing.0.width=701
editor.swing.0.x=78
target5.showInterface=false
target8.showInterface=false
target7.typeParameters=
target2.name=GUI_Interface
editor.swing.0.y=0
mainWindow.height=744
mainWindow.width=1375
mainWindow.x=-8
mainWindow.y=0
package.numDependencies=26
package.numTargets=22
project.charset=UTF-8
readme.height=58
readme.name=@README
class.Menue_Button.superclass=Button
editor.swing.0.width=701
target6.name=CurrentPlayerArrow
target9.height=50
target12.y=190
target12.x=190
editor.fx.0.width=700
readme.width=47
readme.x=10
readme.y=10
target1.height=50
target1.name=Player
target1.showInterface=false
target1.type=ClassTarget
target1.typeParameters=
target1.width=80
target1.x=120
target1.y=10
target10.height=50
target10.name=DefenderDices
target10.showInterface=false
target10.type=ClassTarget
target10.typeParameters=
target10.width=110
target10.x=10
target10.y=490
target11.height=50
target11.name=Province
target11.showInterface=false
target10.y=130
target10.x=100
dependency2.to=Menue_Button
target12.width=90
target11.name=Utils
target12.height=50
class.Province.superclass=greenfoot.Actor
target9.y=130
target9.x=10
target3.type=ClassTarget
target6.height=50
target7.y=70
target7.x=70
target11.type=ClassTarget
target11.typeParameters=
target5.y=310
target5.x=130
dependency4.type=UsesDependency
target7.type=ClassTarget
target10.width=110
target3.y=250
target3.x=120
target11.width=80
target11.x=130
target11.y=310
target12.height=50
target12.name=GeneralMap
target12.showInterface=false
target12.type=AbstractTarget
target12.typeParameters=
target12.width=90
target12.x=70
target12.y=70
target13.height=50
target13.name=Map_World
target13.showInterface=false
target13.type=ClassTarget
target13.typeParameters=
target13.width=90
target13.x=170
target13.y=70
target14.height=50
target14.name=Button
target14.showInterface=false
target14.type=ClassTarget
target14.typeParameters=
target14.width=80
target14.x=10
target14.y=130
target15.height=50
target15.name=ButtonEvent
target15.showInterface=false
target15.type=InterfaceTarget
target15.typeParameters=
target15.width=90
target15.x=130
target15.y=490
target16.height=50
target16.name=Dice_Offender
target16.showInterface=false
target16.type=ClassTarget
target16.typeParameters=
target16.width=110
target16.x=100
target16.y=130
target17.height=50
target17.name=Utils
target17.showInterface=false
target17.type=ClassTarget
target17.typeParameters=
target17.width=80
target17.x=10
target17.y=190
target18.height=50
target18.name=Colours
target18.showInterface=false
target18.type=ClassTarget
target18.typeParameters=
target18.width=80
target18.x=10
target18.y=610
target19.height=50
target19.name=Start_Load
target19.showInterface=false
target19.type=ClassTarget
target19.typeParameters=
target19.width=90
target19.x=10
target19.y=550
target2.height=50
target2.name=Dice
target2.showInterface=false
target2.type=ClassTarget
target2.typeParameters=
target2.width=80
target2.x=100
target2.y=190
target20.height=50
target20.name=Roll_Button
target20.showInterface=false
target20.type=ClassTarget
target20.typeParameters=
target20.width=90
target20.x=190
target20.y=190
target21.height=50
target21.name=Fight
target21.showInterface=false
target21.type=ClassTarget
target21.typeParameters=
target21.width=80
target21.x=100
target21.y=610
target22.height=50
target22.name=Map
target22.showInterface=false
target22.type=ClassTarget
target22.typeParameters=
target22.width=80
target22.x=190
target22.y=610
target23.height=50
target23.name=Map
target23.showInterface=false
target23.type=ClassTarget
target23.typeParameters=
target23.width=80
target23.x=190
target23.y=610
target3.height=50
target1.y=190
target1.x=100
target12.type=ClassTarget
target5.typeParameters=
dependency2.from=GeneralMap
project.charset=UTF-8
target3.name=GUI_Interface
target3.showInterface=false
class.Spieleranzahl.superclass=Spieloptionen
target3.name=Menue_Button
target6.showInterface=false
target3.type=AbstractTarget
target3.typeParameters=
target9.showInterface=false
dependency3.to=Roll_Button
target7.name=GeneralMap
package.numDependencies=4
package.numTargets=12
target12.name=Roll_Button
dependency1.type=UsesDependency
target3.width=100
target3.x=10
target3.y=250
target4.height=50
target4.name=Menue_Button
target4.showInterface=false
target4.type=ClassTarget
target12.showInterface=false
target8.width=90
target9.width=80
target4.typeParameters=
target4.width=110
target4.x=120
target4.y=250
target5.height=50
target5.name=Label
target5.showInterface=false
target5.type=ClassTarget
target5.typeParameters=
target5.width=80
target5.x=10
target5.y=370
target6.height=50
target6.name=ArmySchubser
target6.showInterface=false
target6.type=ClassTarget
target6.typeParameters=
target6.width=110
target6.x=100
target6.y=370
target7.height=50
target7.name=DicesList
target7.showInterface=false
target7.type=AbstractTarget
target7.typeParameters=
target7.width=80
target7.x=10
target7.y=430
target8.height=50
target8.name=OffenderDices
target8.showInterface=false
target8.type=ClassTarget
class.Button.superclass=GUI_Interface
target6.width=140
target10.height=50
target7.width=90
class.Roll_Button.superclass=Button
dependency3.from=GeneralMap
target1.typeParameters=
target3.width=110
target4.width=110
target8.typeParameters=
target5.width=80
dependency4.to=Province
class.Utils.superclass=
target4.name=Dice_Defender
readme.y=10
readme.x=10
target4.height=50
readme.height=58
target12.typeParameters=
target1.width=80
target8.width=110
target8.x=100
target8.y=430
target9.height=50
target9.name=Dice_Defender
target9.showInterface=false
target9.type=ClassTarget
target9.typeParameters=
target9.width=110
target9.x=10
target9.y=310
version=2.8.0
world.lastInstantiated=Map_World

Loading…
Cancel
Save