Question : Java Client Applet - Server Side Items?

This is what happens when a user picks an item up.

1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
 if ("pickup".equalsIgnoreCase(temp[4]))
{
      c.append("\n"+temp[0] + "|" + temp[1] + "|" + temp[2] + "|" + temp[3] + "|" + temp[4]);
      //int changeX = Integer.parseInt(temp[1]);
      //int changeY = Integer.parseInt(temp[2]);
      //board[changeY][changeX] = 4;
      int theItem = Integer.parseInt(temp[1]);
      pickedUp(theItem, temp[0]);
      //c.append("\n"+temp[2] + " is... " + drawSword);
}


and here is the method:
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
 public void pickedUp(int e, String x) {

              if (e == 1) {
                                  drawFlail = false;
              }
              if (e == 2) {
                                  drawBattleaxe = false;
              }
              if (e == 3) {
                                  drawSword = false;
              }

              c.append("\n"+ x + " picked up a " + getItem(e)[0]+".");


        }


which WORKS! :)

But here's the problem.

Player A logs in... player B logs in. Player a sees player B take the flail on the ground. The flail is not draw on the ground anymore. But then player C logs in and sees the flail on the ground because his drawFlail is STILL true... get it?

So.. I'm thinking.. should I make this server-side or do you have another way of keeping all booleans on all connected clients the same...?

Answer : Java Client Applet - Server Side Items?

> They appear on a certain X and Y spot on the map.. they are "painted on"

ie. they do have a location

> Well I say that because the tileGen looks for a comand.. so when they send the status of the items out.. it will say NullPointerException or sometihng like that...

you need to add more commands
Random Solutions  
 
programming4us programming4us