Fehlerbehebung Province

Sorry habs zu spät gelesen, das man eigene Branches machen soll
master
SariusRu 8 years ago
parent 37f505b724
commit a989c5d98d

@ -9,7 +9,7 @@ import java.awt.Color;
Oberklasse für verschiedene Maps;
neue Maps werden als Unterklasse dieser Klasse eingefügt.
@author GruenerWal, MaxiJohl, Felix Stupp
@author GruenerWal, MaxiJohl, Felix Stupp, Samuel
@version 0.3.0
*/
public abstract class GeneralMap extends World implements ButtonEvent
@ -21,7 +21,7 @@ public abstract class GeneralMap extends World implements ButtonEvent
Button modus = new Button("Kampf",25,this);
private final int X_OFFSET = 200; // Verschiebt die Provinzen nach rechts
private final int Y_OFFSET = 25; // Verschiebt die Provinzen nach unten
private final int Y_OFFSET = 0; // Verschiebt die Provinzen nach unten
/*
Die einzelnen Positionen der Provinzen wird mit SCALE_VALUE/10000 multipliziert.
@ -73,6 +73,13 @@ public abstract class GeneralMap extends World implements ButtonEvent
createPlayerObjects(playerList.length);
}
public int currentPlayer()
{
return currentPlayer;
}
public void redrawGameStates()

@ -22,6 +22,7 @@ public class Player extends Actor
int color;
int textsize;
int c;
public int active;
//definiert die ID und Namens Variable
public Player(int identity,String name, int c)
@ -46,47 +47,47 @@ public class Player extends Actor
{
return stars;
}
// Von Felix: Methode nicht architektur-konform
/* // erhöht die Sternenzahl um eine random ausgewählte Anzahl von 1-3
public void addToStars()
{
int rand;
int pre;
rand = (int)(1+6*Math.random());
if (rand == 1 || rand == 2|| rand == 3)
{
add = 1;
redrawPlayer();
}
if (rand == 4|| rand == 5)
{
add = 2;
redrawPlayer();
}
if (rand == 6)
{
add = 3;
redrawPlayer();
}
if (gotProv== true)
{
pre = stars;
stars+=add;
System.out.println("Deine vorherige Sternenanzahl betrug " + pre + ".");
System.out.println("Du hast " + add + " Sterne erhalten.");
System.out.println("Deine aktuelle Sternenanzahl beträgt " + stars + ".");
redrawPlayer();
}
int rand;
int pre;
rand = (int)(1+6*Math.random());
if (rand == 1 || rand == 2|| rand == 3)
{
add = 1;
redrawPlayer();
}
if (rand == 4|| rand == 5)
{
add = 2;
redrawPlayer();
}
if (rand == 6)
{
add = 3;
redrawPlayer();
}
if (gotProv== true)
{
pre = stars;
stars+=add;
System.out.println("Deine vorherige Sternenanzahl betrug " + pre + ".");
System.out.println("Du hast " + add + " Sterne erhalten.");
System.out.println("Deine aktuelle Sternenanzahl beträgt " + stars + ".");
redrawPlayer();
}
} */
private void checkStars() {
if(stars < 0) {
stars = 0;
}
}
// Von Felix: Architektur-konforme Funktion
public int addToStars(int s) {
stars += s;
@ -110,7 +111,7 @@ public class Player extends Actor
redrawPlayer();
return stars;
}
public boolean canStarsRemoved(int s) {
return (stars - s) >= 0;
}
@ -233,16 +234,31 @@ public class Player extends Actor
break;
case 3:
flag = new GreenfootImage("images\\GrueneArmee.jpg");
redraw(statistics,flag,textSize);
redrawArrow(statistics,flag,textSize);
break;
}
}
private void redraw(GreenfootImage statistics,GreenfootImage flag, int textSize)
private void redrawArrow(GreenfootImage statistics,GreenfootImage flag, int textSize)
{
// redraw(statistics,flag,textSize);
GreenfootImage Arrow = new GreenfootImage(137,120);
if(id == 0 || id == 1|| id == 2)
{
Arrow.setColor(Color.GRAY);
Arrow.fill();
Arrow.drawImage(statistics,0,0);
redraw(Arrow,flag,textSize);
}
else
{
redraw(statistics,flag,textSize);
}
}
private void redraw(GreenfootImage statistics,GreenfootImage flag, int textSize)
{
flag.scale(137,83);
statistics.drawImage(flag,0,textSize);
GreenfootImage playerStatistics = new GreenfootImage(stats[0] + "||" + stats[1] + "||" + stats[2] + "||" +stats[3] + "||" + stats[4] + "||" + stats[5],textSize,new Color(0,0,0),new Color(1.0f,1.0f,1.0f,0.5f));

@ -22,6 +22,7 @@ public class Province extends Actor
private int xPos;
private int yPos;
private int eCount;
public int textSize;
private boolean clicked = false;
/**
@ -171,13 +172,14 @@ public class Province extends Actor
public void redrawProvince(int ColorInt)
{
int textSize;
textSize = 20;
GreenfootImage province = new GreenfootImage(120,100);
if(ColorInt ==1)
{
GreenfootImage provinceName = new GreenfootImage(displayName,textSize,new Color(0,0,0),new Color(1.0f,1.0f,1.0f,0.5f));
GreenfootImage province = new GreenfootImage(120,2*textSize);
province.drawImage(provinceName,0,0);
setImage(province);
oDecide(province,textSize,owner,eCount);
@ -185,6 +187,7 @@ public class Province extends Actor
if(ColorInt ==2)
{
GreenfootImage provinceName = new GreenfootImage(displayName,textSize,new Color(0,0,0),Color.GREEN);
GreenfootImage province = new GreenfootImage(120,2*textSize);
province.drawImage(provinceName,0,0);
setImage(province);
oDecide(province,textSize,owner,eCount);
@ -192,6 +195,7 @@ public class Province extends Actor
if(ColorInt == 3)
{
GreenfootImage provinceName = new GreenfootImage(displayName,textSize,new Color(0,0,0),Color.RED);
GreenfootImage province = new GreenfootImage(120,2*textSize);
province.drawImage(provinceName,0,0);
setImage(province);
oDecide(province,textSize,owner,eCount);

Loading…
Cancel
Save