Basically, I need to keep track of what image my Lives.class is, to induce some effect (a temporary decrease in world speed, in case you wanted to know). There is only ever one Lives.class inserted into the world at any given point in time. Below is the code (called within the World's Act statement) is syntactically correct but has some logic error in it that I can't see, because there is no induced effect:
As usual, I'm extremely grateful for any and all help on the matter. Thanks in advance!
public void damageControl() { damageCount = worldCount + 2; Lives lives = (Lives) (getObjects(Lives.class).get(0)); GreenfootImage twoLives = new GreenfootImage("2 Lives.png"); GreenfootImage oneLife = new GreenfootImage("Last Life.png"); GreenfootImage Health = new GreenfootImage(lives.getImage()); if (Health == twoLives || Health == oneLife && worldCount == damageCount) { originSpeed = speedIncrease; slowDownRevert = worldCount + 20; Greenfoot.setSpeed(40); } if (worldCount == slowDownRevert) { Greenfoot.setSpeed(45+originSpeed); chance -= 5; addObstacle -= 2; addLimit += 2;//when hit, obstacles become more frequent } }