Battle fix

This commit is contained in:
iryupnik 2020-04-29 14:14:46 +02:00
parent a4c49e1439
commit 414a6602ed
5 changed files with 98 additions and 22 deletions

View File

@ -147,16 +147,14 @@ public class WindowOfBattle extends JPanel {
battle = new Battle(a, b, this);
isReadyToPaint = true;
Thread repainting = new Thread(() -> {
Timer t = new Timer(10, actionEvent -> {
repaint();
canvas.repaint();
if (situationText.isVisible()) {
situationText.repaint();
}
});
t.start();
});
repainting.start();
battle.startBattle();
}
@ -168,13 +166,13 @@ public class WindowOfBattle extends JPanel {
public void writeToOutput(String s) {
System.out.println(s);
Font f = new Font(Font.SERIF, Font.BOLD, 20);
if (situationText.getComponents().length != 0)
situationText.remove(0);
if (situationText.getComponents().length == 0) {
JLabel text = new JLabel();
text.setText(s);
text.setFont(f);
situationText.add(text);
situationText.getComponents()[0].repaint();
}
JLabel jLabel = (JLabel) situationText.getComponents()[0];
jLabel.setText(s);
jLabel.setFont(f);
repaint();
}

View File

@ -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>

View File

@ -0,0 +1,6 @@
<item>
<name>white-key-card</name>
<multiplicity>1</multiplicity>
<image>19</image>
<action>key</action>
</item>

View File

@ -0,0 +1,6 @@
<location>
<map>office</map>
<x>8</x>
<y>6</y>
<direction>3</direction>
</location>

View File

@ -0,0 +1 @@
TODO: Village