This site requires JavaScript, please enable it in your browser!
Greenfoot back
SilverCS
SilverCS wrote ...

2022/1/8

"ImageHeight has private access in greenfoot.Actor"

SilverCS SilverCS

2022/1/8

#
I have these two errors in my code that both say "ImageHeight has private access in greenfoot.Actor" and have no idea on how to patch it. (Lines 7 & 8)
  public boolean isOnSolidGround(){
        boolean isOnGround = false;
        if (getY() > getWorld().getHeight() - 100) isOnGround = true;

        int imageWidth = getImage().getWidth();
        int ImageHeight = getImage().getHeight();
        if (getOneObjectAtOffset(imageWidth / -2, imageHeight / 2, ground.class) != null || 
            getOneObjectAtOffset(imageWidth / 2, imageHeight / 2, ground.class) != null)   
            isOnGround = true;
        return isOnGround;
    }
That is the block of code that the error is in
Spock47 Spock47

2022/1/8

#
There is a typo in line 6: at the declaration, imageHeight is upper case, but it has to be lower case:
    int imageHeight = getImage().getHeight();
Live long and prosper, Spock47
SilverCS SilverCS

2022/1/8

#
Spock47 wrote...
There is a typo in line 6: at the declaration, imageHeight is upper case, but it has to be lower case:
    int imageHeight = getImage().getHeight();
Live long and prosper, Spock47
GOOD EYE! THANK YOU, THIS HAS BEEN TRIPPING ME FOR HOURS NOW
You need to login to post a reply.