Don't draw the gem in the status section until the animation is finished

Signed-off-by: Chris Cromer <chris@cromer.cl>
This commit is contained in:
Chris Cromer 2019-10-13 21:22:43 -03:00
parent 00c54e5e15
commit 8ed02cf2ac
2 changed files with 11 additions and 1 deletions

View File

@ -94,6 +94,15 @@ public class Cell extends JComponent implements Constants {
this.object = object; this.object = object;
} }
/**
* Get a top object
*
* @return Returns the top object
*/
public Object getObjectOnTop() {
return objectOnTop;
}
/** /**
* Set a top object * Set a top object
* *

View File

@ -490,7 +490,8 @@ public class Player extends Object implements Constants {
public ArrayList<Gem> getInventoryGems() { public ArrayList<Gem> getInventoryGems() {
ArrayList<Gem> gems = new ArrayList<>(); ArrayList<Gem> gems = new ArrayList<>();
for (Object object : carrying) { for (Object object : carrying) {
if (object instanceof Gem) { if (object instanceof Gem && object.getCell().getObjectOnTop() == null) {
// Only count the gem as in inventory once it stops showing
gems.add((Gem) object); gems.add((Gem) object);
} }
} }