Fehlerkorrektur 3

Beheben des GetProvinceCount, den Achim erwähnt hat, beheben von
Anzeigeproblemen bei redrawPlayer
master
SariusRu 10 years ago
parent b3c21d9ada
commit bddc7d07cf

@ -2,7 +2,7 @@ public class Debug3 extends Map_World {
public Debug3() { public Debug3() {
super( super(
new String[] {"Spieler Nr. 1", "Player No. 2", "Spieler Nr. 3"}, new String[] {"Spieler Nr. 1", "Player No. 2", "Spieler Nr. 3"},
new int[] {0,1,2} new int[] {1,2,3}
); );
} }
} }

@ -24,6 +24,7 @@ public class Player extends Actor
String n; String n;
int color; int color;
int textsize; int textsize;
int c;
//definiert die ID und Namens Variable //definiert die ID und Namens Variable
public Player(int identity,String name, int c) public Player(int identity,String name, int c)
@ -117,19 +118,16 @@ public class Player extends Actor
public int getProvinceCount () public int getProvinceCount ()
{ {
GeneralMap w= getWorld(); GeneralMap w= getWorld();
int[] provinces = w.getProvinceOwners(); // int[] provinces = w.getProvinceOwners();
for (int x=0; x<=42; x++ ) for (int x=1; x<=42; x++ )
{ {
if ( provinces [x] ==id) c = w.provinces[x].getOwner();
if (c ==id+1)
{ {
provZahl++; provZahl++;
stats[2] = provZahl;
} redrawPlayer();
} }
if(stats[2] < provZahl)
{
stats[2]=provZahl;
} }
return provZahl; return provZahl;
} }
@ -137,11 +135,14 @@ public class Player extends Actor
public void gotEntities(int gotEnt) public void gotEntities(int gotEnt)
{ {
stats[3]+= gotEnt; stats[3]+= gotEnt;
redrawPlayer();
} }
public void lostEntity() public void lostEntity()
{ {
stats[4]+=1; stats[4]+=1;
redrawPlayer();
} }
private void maxEntities(int entNumber) private void maxEntities(int entNumber)
@ -149,6 +150,7 @@ public class Player extends Actor
if (stats[5]< entNumber) if (stats[5]< entNumber)
{ {
stats[5]=entNumber; stats[5]=entNumber;
redrawPlayer();
} }
} }
@ -168,6 +170,7 @@ public class Player extends Actor
} }
} }
redrawPlayer();
return pBesitzer; return pBesitzer;
} }
@ -191,23 +194,28 @@ public class Player extends Actor
lostProv = true; lostProv = true;
stats[1]+=1; stats[1]+=1;
} }
redrawPlayer();
provVgl = provZahl; provVgl = provZahl;
} }
public boolean getGotProvince () public boolean getGotProvince ()
{ {
redrawPlayer();
return gotProv; return gotProv;
} }
public boolean getLostProvince() public boolean getLostProvince()
{ {
redrawPlayer();
return lostProv; return lostProv;
} }
public int[] getStatistics() public int[] getStatistics()
{ {
redrawPlayer();
return stats; return stats;
} }
public int setColor(int c) public int setColor(int c)
{ {
color = c; color = c;
@ -276,10 +284,8 @@ public class Player extends Actor
flag.scale(137,83); flag.scale(137,83);
statistics.drawImage(flag,0,textSize); 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 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));
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)); statistics.drawImage(playerStatistics, 0, 103);
statistics.drawImage(playerStatistics, 0, 123);
statistics.drawImage(playerStatistics2, 0, 123 + textSize);
setImage(statistics); setImage(statistics);
} }

Loading…
Cancel
Save