-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPoderes.java
More file actions
111 lines (100 loc) · 3.95 KB
/
Poderes.java
File metadata and controls
111 lines (100 loc) · 3.95 KB
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
import javax.swing.*;
import java.awt.*;
public class Poderes extends JPanel {
private InterfaceCaixa painel;
private JLabel background = new JLabel();
private Font Fonte = DefinirFonte.fonte();
public Poderes(InterfaceCaixa painel) {
this.painel = painel;
editar();
}
public void editar() {
setLayout(new BorderLayout());
background.setIcon(new ImageIcon("assets/battleElements/fundo poderes.png"));
background.setLayout(null);
switch (Player.pokemonSelecionado.getNome()) {
case "Bulbasaur":
botao("Tackle", 20, 40);
botao("Vine Whip", 230, 40);
botao("Razor Leaf", 20, 100);
botao("Seed Bomb", 230, 100);
break;
case "Ivysaur":
botao("Tackle", 20, 40);
botao("Vine Whip", 230, 40);
botao("Razor Leaf", 20, 100);
botao("Solar Beam", 230, 100);
break;
case "Venusaur":
botao("Tackle", 20, 40);
botao("Vine Whip", 230, 40);
botao("Razor Leaf", 20, 100);
botao("Solar Beam", 230, 100);
break;
case "Squirtle":
botao("Tackle", 20, 40);
botao("Water Gun", 230, 40);
botao("Bite", 20, 100);
botao("Hydro Pump", 230, 100);
break;
case "Wartortle":
botao("Tackle", 20, 40);
botao("Water Gun", 230, 40);
botao("Bite", 20, 100);
botao("Hydro Cannon", 230, 100);
break;
case "Blastoise":
botao("Tackle", 20, 40);
botao("Water Gun", 230, 40);
botao("Bite", 20, 100);
botao("Hydro Cannon", 230, 100);
break;
case "Charmander":
botao("Scratch", 20, 40);
botao("Ember", 230, 40);
botao("Flamethrower", 20, 100);
botao("Fire Blast", 230, 100);
break;
case "Charmeleon":
botao("Scratch", 20, 40);
botao("Ember", 230, 40);
botao("Flamethrower", 20, 100);
botao("Fire Blast", 230, 100);
break;
case "Charizard":
botao("Scratch", 20, 40);
botao("Ember", 230, 40);
botao("Flamethrower", 20, 100);
botao("Fire Blast", 230, 100);
break;
}
add(background, BorderLayout.NORTH);
}
public void botao(String nome, int x, int y) {
JButton botao = new JButton(nome.toUpperCase());
botao.addActionListener(e -> {
System.out.println(nome.toUpperCase() + " disparado!!");
painel.limparMsgTexto();
painel.msgTexto(Player.pokemonSelecionado.getNome().toUpperCase() + " usou", nome.toUpperCase() + "!");
painel.mostrarAtaque();
Timer timer = new Timer(1000, f -> {
Player.atacar();
if (Enemy.inimigoAtual.getVida() > 0) {
painel.mostrarAtaqueInimigo();
Timer timer2 = new Timer(1000, g -> {
Enemy.atacar();
});
timer2.setRepeats(false);
timer2.start();
}
});
timer.setRepeats(false);
timer.start();
});
botao.setContentAreaFilled(false);
botao.setBorderPainted(false);
botao.setFont(Fonte.deriveFont(Font.PLAIN, 40));
botao.setBounds(x, y, botao.getPreferredSize().width, botao.getPreferredSize().height); // Definir posição e tamanho
background.add(botao);
}
}