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