// ------------------------------------------------------------------------------------------------------------------------------------------------------- // Decorations public void newDecos() { int prob = (int) (Math.random() * 100); // randomly spawnst he decoration if (prob == 1) { if (decoList.size() < 1) { int prob2 = (int) (Math.random() * 2); if (prob2 == 1) { // right side or left side decoList.add(new Decorations(-700, (int) (backy * 0.1) % 23080, false)); } else { decoList.add(new Decorations(-700, (int) (backy * 0.1) % 23080, true)); } } } Boolean check = true; for (Decorations i : decoList) { if (i.getYTop() >= 2000) { check = false; break; } } if (check == false && decoList.size() > 0) { // theres only on in the lsit but for consitency we kept it as a list decoList.remove(0); } }
public void moveLayerTwo(Graphics g) { // making it look fancy and shit Graphics2D g2d = (Graphics2D) g; for (Decorations i : decoList) { if (i.isFlipped() == true) { // if its flipped then flip the image or don't g2d.drawImage( i.getImage(), 479, i.getYTop(), -i.getImage().getWidth(null), i.getImage().getHeight(null), null); } else { g.drawImage(i.getImage(), 0, i.getYTop(), this); } } }
public void scrollDecorations() { for (Decorations i : decoList) { i.setY(i.getYTop() + (int) (player1.getVelocity() * 0.45)); } }