I wrote this code so that my character can stand on this platform walk on it etc. But that doesn't happen and my character seems to just go through it. When I compile there aren't any syntax errors, so is there something missing from the code?
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | public boolean isOnSolidGround() { boolean isOnGround = false ; if (getY() > getWorld().getHeight() - 30 ) isOnGround = true ; int imageWidth = getImage().getWidth(); int imageHeight = getImage().getHeight(); if (getOneObjectAtOffset(imageWidth / - 2 , imageHeight / 2 , Platform. class ) != null || getOneObjectAtOffset(imageWidth / 2 , imageHeight / 2 , Platform. class ) != null ) isOnGround = true ; return isOnGround; } |