Battle fix
This commit is contained in:
parent
a4c49e1439
commit
414a6602ed
@ -132,10 +132,10 @@ public class WindowOfBattle extends JPanel {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public void startBattle(){
|
public void startBattle() {
|
||||||
Hero hero = new Hero(100, 1, "Mark", 1, 100, 1);
|
Hero hero = new Hero(100, 1, "Mark", 1, 100, 1);
|
||||||
Enemy enemy1 = new Enemy(10, 1, "123", 1, 1);
|
Enemy enemy1 = new Enemy(10, 1, "123", 1, 1);
|
||||||
Enemy enemy2 = new Enemy(10, 1, "test", 1, 2);
|
Enemy enemy2 = new Enemy(10, 1, "test", 1, 2);
|
||||||
|
|
||||||
LinkedList<Hero> a = new LinkedList<>();
|
LinkedList<Hero> a = new LinkedList<>();
|
||||||
a.add(hero);
|
a.add(hero);
|
||||||
@ -147,16 +147,14 @@ public class WindowOfBattle extends JPanel {
|
|||||||
battle = new Battle(a, b, this);
|
battle = new Battle(a, b, this);
|
||||||
|
|
||||||
isReadyToPaint = true;
|
isReadyToPaint = true;
|
||||||
Thread repainting = new Thread(() -> {
|
Timer t = new Timer(10, actionEvent -> {
|
||||||
Timer t = new Timer(10, actionEvent -> {
|
repaint();
|
||||||
canvas.repaint();
|
canvas.repaint();
|
||||||
if (situationText.isVisible()){
|
if (situationText.isVisible()) {
|
||||||
situationText.repaint();
|
situationText.repaint();
|
||||||
}
|
}
|
||||||
});
|
|
||||||
t.start();
|
|
||||||
});
|
});
|
||||||
repainting.start();
|
t.start();
|
||||||
|
|
||||||
battle.startBattle();
|
battle.startBattle();
|
||||||
}
|
}
|
||||||
@ -168,13 +166,13 @@ public class WindowOfBattle extends JPanel {
|
|||||||
public void writeToOutput(String s) {
|
public void writeToOutput(String s) {
|
||||||
System.out.println(s);
|
System.out.println(s);
|
||||||
Font f = new Font(Font.SERIF, Font.BOLD, 20);
|
Font f = new Font(Font.SERIF, Font.BOLD, 20);
|
||||||
if (situationText.getComponents().length != 0)
|
if (situationText.getComponents().length == 0) {
|
||||||
situationText.remove(0);
|
JLabel text = new JLabel();
|
||||||
JLabel text = new JLabel();
|
situationText.add(text);
|
||||||
text.setText(s);
|
}
|
||||||
text.setFont(f);
|
JLabel jLabel = (JLabel) situationText.getComponents()[0];
|
||||||
situationText.add(text);
|
jLabel.setText(s);
|
||||||
situationText.getComponents()[0].repaint();
|
jLabel.setFont(f);
|
||||||
repaint();
|
repaint();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -182,11 +180,11 @@ public class WindowOfBattle extends JPanel {
|
|||||||
@Override
|
@Override
|
||||||
public void paint(Graphics g) {
|
public void paint(Graphics g) {
|
||||||
super.paint(g);
|
super.paint(g);
|
||||||
if (isReadyToPaint){
|
if (isReadyToPaint) {
|
||||||
for (Enemy battlePerson: battle.getEnemies()){
|
for (Enemy battlePerson : battle.getEnemies()) {
|
||||||
battlePerson.paint(g, CELL_SIZE * 2, CELL_SIZE *3 * battlePerson.getId());
|
battlePerson.paint(g, CELL_SIZE * 2, CELL_SIZE * 3 * battlePerson.getId());
|
||||||
}
|
}
|
||||||
for (BattlePerson battlePerson: battle.getHeroes()){
|
for (BattlePerson battlePerson : battle.getHeroes()) {
|
||||||
battlePerson.paint(g, CELL_SIZE * 12, CELL_SIZE * 4);
|
battlePerson.paint(g, CELL_SIZE * 12, CELL_SIZE * 4);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -0,0 +1,65 @@
|
|||||||
|
<map>
|
||||||
|
<mapName>tutorial</mapName>
|
||||||
|
<events>
|
||||||
|
<trigger>
|
||||||
|
<x>11</x>
|
||||||
|
<y>6</y>
|
||||||
|
<active>false</active>
|
||||||
|
</trigger>
|
||||||
|
</events>
|
||||||
|
</map>
|
||||||
|
<map>
|
||||||
|
<mapName>openspace</mapName>
|
||||||
|
<events>
|
||||||
|
<trigger>
|
||||||
|
<x>6</x>
|
||||||
|
<y>4</y>
|
||||||
|
<active>true</active>
|
||||||
|
</trigger>
|
||||||
|
<trigger>
|
||||||
|
<x>14</x>
|
||||||
|
<y>16</y>
|
||||||
|
<active>false</active>
|
||||||
|
</trigger>
|
||||||
|
<chest>
|
||||||
|
<x>15</x>
|
||||||
|
<y>7</y>
|
||||||
|
<active>false</active>
|
||||||
|
</chest>
|
||||||
|
</events>
|
||||||
|
</map>
|
||||||
|
<map>
|
||||||
|
<mapName>office</mapName>
|
||||||
|
<events>
|
||||||
|
<trigger>
|
||||||
|
<x>4</x>
|
||||||
|
<y>2</y>
|
||||||
|
<active>false</active>
|
||||||
|
</trigger>
|
||||||
|
<chest>
|
||||||
|
<x>1</x>
|
||||||
|
<y>9</y>
|
||||||
|
<active>false</active>
|
||||||
|
</chest>
|
||||||
|
</events>
|
||||||
|
</map>
|
||||||
|
<map>
|
||||||
|
<mapName>boss</mapName>
|
||||||
|
<events>
|
||||||
|
<trigger>
|
||||||
|
<x>4</x>
|
||||||
|
<y>18</y>
|
||||||
|
<active>true</active>
|
||||||
|
</trigger>
|
||||||
|
</events>
|
||||||
|
</map>
|
||||||
|
<map>
|
||||||
|
<mapName>treasure</mapName>
|
||||||
|
<events>
|
||||||
|
<trigger>
|
||||||
|
<x>6</x>
|
||||||
|
<y>1</y>
|
||||||
|
<active>true</active>
|
||||||
|
</trigger>
|
||||||
|
</events>
|
||||||
|
</map>
|
||||||
@ -0,0 +1,6 @@
|
|||||||
|
<item>
|
||||||
|
<name>white-key-card</name>
|
||||||
|
<multiplicity>1</multiplicity>
|
||||||
|
<image>19</image>
|
||||||
|
<action>key</action>
|
||||||
|
</item>
|
||||||
@ -0,0 +1,6 @@
|
|||||||
|
<location>
|
||||||
|
<map>office</map>
|
||||||
|
<x>8</x>
|
||||||
|
<y>6</y>
|
||||||
|
<direction>3</direction>
|
||||||
|
</location>
|
||||||
@ -0,0 +1 @@
|
|||||||
|
TODO: Village
|
||||||
Loading…
x
Reference in New Issue
Block a user