if((String) getImage() == "Shamrock Square with border big.png")
over ++;
I am trying to see what the image that is represented by my actor class is called. If the image is called 'Shamrock Square with border big.png' it will add one to the over variable. The over variable has been initialized to 0 and this code is all contained in my actor class. Does anyone know how to fix it?
The 'getImage' method returns a GreenfootImage object, not a String object. If you want to track which image is current for the actor, you will need to keep a reference to what GreenfootImage you set to the actor. This can be done by having a field hold a reference to the image itself (as a GreenfootImage object) or, if you number the images, it can be stored as an int value. If only two possible images are used, a boolean value could then be used.