Files
projet-dev/src/Bonus.java

37 lines
927 B
Java
Raw Normal View History

package linea;
import java.awt.Color;
import java.awt.Graphics;
2026-03-26 20:08:52 +01:00
import java.util.List;
public class Bonus extends ObjetCollectible {
2026-03-26 20:08:52 +01:00
public Bonus(Ligne l, List<Joueur> joueurs, Jeu j) {
super(l, joueurs, j);
this.taille = 10;
this.couleur = Color.GREEN;
}
@Override protected int getSeuilActivation() { return 220; }
@Override protected Color getCouleurCapture() { return Color.BLUE; }
@Override
protected double calculerY(double hauteurLigne) {
if (Math.random() > 0.5) return hauteurLigne - 10 - (Math.random() * 50);
else return hauteurLigne + 10 + (Math.random() * 50);
}
@Override
protected void appliquerEffet(Joueur joueur) {
if (!monJeu.cheatMode) joueur.ajouterVie();
}
@Override
protected void dessiner(Graphics g) {
g.fillRect((int)Math.round(x), (int)Math.round(y), (int)taille, (int)taille);
}
2026-03-26 20:08:52 +01:00
}