What does it really do?
Why shouldn't we using it always?
I had a scenario in which I used many variables with static but don't really understand how it works. Can someone explain me?


public void checkIfBlockIsDestructible() { Actor destructibleBlock =(Block) getOneObjectAtOffset(0,0,DestructibleBlock.class); Actor undestructibleBlock =(Block) getOneObjectAtOffset(0,0,UndestructibleBlock.class); if (destructibleBlock != null) { destructibleBlock.remove(); //getWorld().removeObject(destructibleBlock); } if (undestructibleBlock != null) { getWorld().removeObject(this); return; } }
// in Pacman class Actor bigdot = getOneIntersectingObject(BigDot.class); if (bigdot != null) { getWorld().removeObject(bigdot); // add to score for eating big dot // play sound for eating dot for (Object obj : getWorld().getObjects(Ghost.class)) { ((Ghost)obj).setVulnerable(); } }