@Override public void removeEmptyItems() { for (int i = 0; i < myList.myLength; i++) { GameElement e = myList.get(i); if (e.shouldBeRemoved()) myList.remove(e); } }
private void buildWall() { // sets bricks to the wall within a given height and width // the height depends on the current game level // the width depends on the actual width of the game field while(getBrickY() < wallHeight) { while(getBrickX() < wallWidth) { // get a new brick and set parameters to the brick randomBrick = getRandomBrick(); randomBrick.setXCoord(getBrickX()); randomBrick.setYCoord(getBrickY()); randomBrick.setId(Integer.toString(getBrickX()) + Integer.toString(getBrickY())); brickList.add(randomBrick); setBrickX(getBrickX() + randomBrick.getWidth() + 10); } setBrickY(getBrickY() + randomBrick.getHeight() + 10); setBrickX(BreakWallModel.randomFromRange(1, 3) * 15); } }
@Override public void resolveCollisionWith(GameElement rightObj) { rightObj.collideWith(this); }