/** defines the updating at 60Hz for the sea bottom */ @Override public void onTick() { xPos -= 6; xPos2 -= 6; if (xPos <= -5 * Util.getDISTANCE_TO_EDGE()) { xPos = xPos2 + (Util.getDISTANCE_TO_EDGE() * 4 - 30); } else if (xPos2 <= -Util.getDISTANCE_TO_EDGE() * 5) { xPos2 = xPos + Util.getDISTANCE_TO_EDGE() * 4 - 30; } line1.setX(xPos); line2.setX(xPos2); }
/** * reutrns true if the sea bottom and the Charcter c have collided * * @param c the character * @return boolean true or false */ public boolean isIn(characters.Character c) { return line1.isBelowLine(c.getX(), c.getY()) || line2.isBelowLine(c.getX(), c.getY()); }