2026-03-25 21:28:33 +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-25 21:28:33 +01:00
|
|
|
|
2026-03-27 19:17:03 +01:00
|
|
|
public class BonusTaille extends ObjetCollectible {
|
2026-03-25 21:28:33 +01:00
|
|
|
|
2026-03-26 20:08:52 +01:00
|
|
|
public BonusTaille(Ligne l, List<Joueur> joueurs, Jeu j) {
|
2026-03-27 19:17:03 +01:00
|
|
|
super(l, joueurs, j);
|
|
|
|
|
this.taille = 12;
|
2026-03-25 21:28:33 +01:00
|
|
|
this.couleur = Color.CYAN;
|
2026-03-27 19:17:03 +01:00
|
|
|
this.compteurFrames = 200; // démarre déjà à 200 pour apparaître plus tôt
|
2026-03-25 21:28:33 +01:00
|
|
|
}
|
|
|
|
|
|
2026-03-27 19:17:03 +01:00
|
|
|
@Override protected int getSeuilActivation() { return 320; }
|
|
|
|
|
|
|
|
|
|
@Override protected Color getCouleurCapture() { return new Color(255, 255, 255, 100); }
|
|
|
|
|
|
2026-03-25 21:28:33 +01:00
|
|
|
@Override
|
2026-03-27 19:17:03 +01:00
|
|
|
protected double calculerY(double hauteurLigne) {
|
|
|
|
|
if (Math.random() > 0.5) return hauteurLigne - 8 - (Math.random() * 45);
|
|
|
|
|
else return hauteurLigne + 8 + (Math.random() * 45);
|
2026-03-25 21:28:33 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
2026-03-27 19:17:03 +01:00
|
|
|
protected void appliquerEffet(Joueur joueur) {
|
|
|
|
|
joueur.activerBonusTaille();
|
|
|
|
|
}
|
2026-03-25 21:28:33 +01:00
|
|
|
|
2026-03-27 19:17:03 +01:00
|
|
|
@Override
|
|
|
|
|
protected void dessiner(Graphics g) {
|
|
|
|
|
g.fillOval((int)Math.round(x), (int)Math.round(y), (int)taille, (int)taille);
|
2026-03-25 21:28:33 +01:00
|
|
|
}
|
|
|
|
|
}
|