So I have this player class, who is supposed to return a variable whenever a method is called from another class, and I think I've done it right, but the value never changes from 0.
This is the snippet of code here:
And in my other class, I have this to call it:
Ideally, the barrel would hide unless both plyrWorld and locationMap are equal, but plyr.getCurrentWorld() always returns 0. What have I done wrong?
public int getCurrentWorld()
{
return world;
}Player plyr = new Player();
public void act()
{
plyrWorld = plyr.getCurrentWorld();
if (plyrWorld == locationMap)
{
Barrel.setTransparency(255);
setImage(Barrel);
}
else
{
Barrel.setTransparency(0);
setImage(Barrel);
}
}
