internal void setFreeDirections(AEnnemy m) { float x = m.getX(); float y = m.getY(); m.resetFreePath(); if (!pixelIsWall(x - 5, y) && !pixelIsWall(x - 5, y - 3) && !pixelIsWall(x - 5, y + 3)) { m.setFreePath(ACharacter.EOrientation.LEFT); } if (!pixelIsWall(x + 5, y) && !pixelIsWall(x + 5, y + 3) && !pixelIsWall(x + 5, y - 3)) { m.setFreePath(ACharacter.EOrientation.RIGHT); } if (!pixelIsWall(x, y - 5) && !pixelIsWall(x - 3, y - 5) && !pixelIsWall(x + 3, y - 5)) { m.setFreePath(ACharacter.EOrientation.UP); } if (!pixelIsWall(x, y + 5) && !pixelIsWall(x + 3, y + 5) && !pixelIsWall(x - 3, y + 5)) { m.setFreePath(ACharacter.EOrientation.DOWN); } }
internal void setFreeDirections(AEnnemy m) { float x = m.getX(); float y = m.getY(); m.resetFreePath(); if (!pixelIsWall(x - 5, y) && !pixelIsWall(x - 5, y - 3) && !pixelIsWall(x - 5, y + 3)) m.setFreePath(ACharacter.EOrientation.LEFT); if (!pixelIsWall(x + 5, y) && !pixelIsWall(x + 5, y + 3) && !pixelIsWall(x + 5, y - 3)) m.setFreePath(ACharacter.EOrientation.RIGHT); if (!pixelIsWall(x, y - 5) && !pixelIsWall(x - 3, y - 5) && !pixelIsWall(x + 3, y - 5)) m.setFreePath(ACharacter.EOrientation.UP); if (!pixelIsWall(x, y + 5) && !pixelIsWall(x + 3, y + 5) && !pixelIsWall(x - 3, y + 5)) m.setFreePath(ACharacter.EOrientation.DOWN); }