1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37
|
public class Test01_Fenetre extends JFrame /*implements ActionListener*/ {
JButton aff_Score=new JButton("Cilquez ici pour voire votre score.");//Affichge du score
public Test01_Fenetre(){
aff_Score.addActionListener(new Aff_Score_Listener());
add(aff_Score);//Score
}
//Comptage de pts
private void Compt(){
int x = pan.getPosX(), y = pan.getPosY();//Cible principale
int xb=pan.getPosXb(),yb=pan.getPosYb();//Cible bonus
int x1=pan.getPosX1(),y1=pan.getPosY1();//tir
if(x1==x || y1==y){
for(int i=0;;i++){
System.out.print("Vs avez"+i+"points");
}
}
if(x1==xb || y1==yb){
for(int i=0;;i++){
System.out.print("Votre multiplicateur BONUS est de:"+i);
}
}
}
//Comptage de point
public class Aff_Score_Listener implements ActionListener{
public void actionPerformed(ActionEvent e) {
Compt();
}
}
} |