|
|
@@ -75,14 +75,14 @@ public class PlayState extends State {
|
|
|
}
|
|
|
|
|
|
/* UPDATE AND PAINTING */
|
|
|
- public void updatePlayerInfo(int x, int y, int health, int score, Player player) {
|
|
|
+ synchronized public void updatePlayerInfo(int x, int y, int health, int score, Player player) {
|
|
|
player.setX(x);
|
|
|
player.setY(y);
|
|
|
player.setHealth(health);
|
|
|
player.setScore(score);
|
|
|
}
|
|
|
|
|
|
- public void updateLines(int l1x, int l1y, int l1h, int l2x, int l2y, int l2h) {
|
|
|
+ synchronized public void updateLines(int l1x, int l1y, int l1h, int l2x, int l2y, int l2h) {
|
|
|
if (line1 == null)
|
|
|
line1 = new ShootingLine(l1x, l1y);
|
|
|
line1.setLength(l1h);
|
|
|
@@ -96,7 +96,7 @@ public class PlayState extends State {
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public void update() {
|
|
|
+ synchronized public void update() {
|
|
|
if (player1 != null && player2 != null) {
|
|
|
if (player1.getHealth() == 0 && player2.getHealth() == 0) {
|
|
|
setOverlayText("Game over");
|
|
|
@@ -107,7 +107,7 @@ public class PlayState extends State {
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public void paint(Graphics2D g2d) {
|
|
|
+ synchronized public void paint(Graphics2D g2d) {
|
|
|
g2d.drawImage(Images.getImage(ImageType.BACKGROUND), null, 0, 0);
|
|
|
g2d.setColor(Color.RED);
|
|
|
g2d.drawString(overlayText, 100, 300);
|