Fehlerkorrektur 3

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

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

Loading…
Cancel
Save