added more battle graphics and effects

This commit is contained in:
musilto9 2020-06-08 03:07:16 +02:00
parent 3c91433a23
commit 58c1ed49f0
15 changed files with 196 additions and 66 deletions

View File

@ -44,9 +44,14 @@ public class Battle {
public void setPlayerAttack(boolean playerAttack) { public void setPlayerAttack(boolean playerAttack) {
windowOfBattle.getMenuOfActions().setVisible(false); windowOfBattle.getMenuOfActions().setVisible(false);
windowOfBattle.getEnemyDescription().setVisible(false); windowOfBattle.getEnemyDescription().setVisible(false);
windowOfBattle.getSituationText().setVisible(true);
this.playerAttack = playerAttack; this.playerAttack = playerAttack;
} }
public void addToTurnOrder(BattlePerson person) {
turnOrder.add(person);
}
public Battle(LinkedList<Hero> heroes, LinkedList<Enemy> enemies, WindowOfBattle window) { public Battle(LinkedList<Hero> heroes, LinkedList<Enemy> enemies, WindowOfBattle window) {
this.heroes = heroes; this.heroes = heroes;
this.enemies = enemies; this.enemies = enemies;
@ -73,7 +78,7 @@ public class Battle {
public void startBattle() { public void startBattle() {
turnBelongTo = heroes.getFirst(); turnBelongTo = heroes.getFirst();
windowOfBattle.getMenuOfActions().setVisible(true); windowOfBattle.getMenuOfActions().setVisible(true);
windowOfBattle.getEnemyDescription().setVisible(true); windowOfBattle.getEnemyDescription().updateDescription();
windowOfBattle.repaint(); windowOfBattle.repaint();
turnOrder = new LinkedList<>(); turnOrder = new LinkedList<>();
timer = new Timer(1000, actionEvent -> { timer = new Timer(1000, actionEvent -> {
@ -93,7 +98,7 @@ public class Battle {
}); });
} }
private void endBattle(boolean b) { public void endBattle(boolean b) {
timer.stop(); timer.stop();
timerStopped = true; timerStopped = true;
windowOfBattle.setVisible(false); windowOfBattle.setVisible(false);
@ -113,7 +118,7 @@ public class Battle {
windowOfFreeMove.setVisible(true); windowOfFreeMove.setVisible(true);
windowOfFreeMove.requestFocus(); windowOfFreeMove.requestFocus();
windowOfBattle.getGame().remove(windowOfBattle); windowOfBattle.getGame().remove(windowOfBattle);
windowOfBattle.getMusicManager().stopMusic(); if (windowOfBattle.getMusicManager() != null) windowOfBattle.getMusicManager().stopMusic();
} }
// SaveManager saveManager = game.getFreeMove().getMapManager().getSaveManager(); // SaveManager saveManager = game.getFreeMove().getMapManager().getSaveManager();
// saveManager.saveGame(); // saveManager.saveGame();
@ -124,18 +129,18 @@ public class Battle {
timerStopped = true; timerStopped = true;
windowOfBattle.getMenuOfActions().setVisible(true); windowOfBattle.getMenuOfActions().setVisible(true);
for (Component e: windowOfBattle.getMenuOfActions().getComponents()) e.setEnabled(true); for (Component e: windowOfBattle.getMenuOfActions().getComponents()) e.setEnabled(true);
windowOfBattle.getEnemyDescription().setVisible(true); windowOfBattle.getEnemyDescription().updateDescription();
windowOfBattle.getSituationText().hideText();
} }
private void attackByHero(Enemy e) { private void attackByHero(Enemy e) {
turnCount++; turnCount++;
windowOfBattle.repaint(); windowOfBattle.repaint();
turnBelongTo.attack(e); turnBelongTo.attack(e);
if (windowOfBattle.getHitSound() != null) soundManager.playSound(windowOfBattle.getHitSound(), 6.0f); turnBelongTo.setImageEffect("attack");
if (windowOfBattle.getHitSound() != null) soundManager.playSound(windowOfBattle.getHitSound(), -10.0f);
windowOfBattle.writeToOutput(turnBelongTo.getName() + " deal " + turnBelongTo.getLevel() * turnBelongTo.getStrength() + " damage to " + e.getName()+"!"); windowOfBattle.writeToOutput(turnBelongTo.getName() + " deals " + turnBelongTo.getLevel() * turnBelongTo.getStrength() + " damage to " + e.getName()+"!");
//TODO Animation of Death if (e.health <= 0) e.getKilled(this);
if (e.health <= 0) enemies.remove(e);
turnOrder.add(turnBelongTo); turnOrder.add(turnBelongTo);
playerAttack = false; playerAttack = false;
@ -169,11 +174,11 @@ public class Battle {
private void attackByMonster(Hero e) { private void attackByMonster(Hero e) {
turnCount++; turnCount++;
turnBelongTo.attack(e); turnBelongTo.attack(e);
if (windowOfBattle.getHitSound() != null) soundManager.playSound(windowOfBattle.getHitSound(), 6.0f); turnBelongTo.setImageEffect("attack");
if (windowOfBattle.getHitSound() != null) soundManager.playSound(windowOfBattle.getHitSound(), -10.0f);
windowOfBattle.writeToOutput(turnBelongTo.getName() + " deal " + turnBelongTo.getLevel() + " damage to " + e.getName()+"!"); windowOfBattle.writeToOutput(turnBelongTo.getName() + " deals " + turnBelongTo.getLevel() + " damage to " + e.getName()+"!");
//TODO Animation of Death if (e.health <= 0) e.getKilled(this);
if (e.health <= 0) heroes.remove(e);
turnOrder.add(turnBelongTo); turnOrder.add(turnBelongTo);
delay = 2; delay = 2;
@ -206,4 +211,9 @@ public class Battle {
} }
return true; return true;
} }
public void removePersonFromList(BattlePerson person) {
if (person.getClass().getName().equals("ruscz.game.gameOfProd.Battle.Hero")) heroes.remove(person);
else enemies.remove(person);
}
} }

View File

@ -48,6 +48,7 @@ public abstract class BattlePerson {
} }
private void effectCoords(String effect) { private void effectCoords(String effect) {
System.out.println(effect);
if (effect.equals("hover")) { if (effect.equals("hover")) {
final boolean[] isGoingUp = {true}; final boolean[] isGoingUp = {true};
effectTimer = new Timer(100, actionEvent -> { effectTimer = new Timer(100, actionEvent -> {
@ -74,11 +75,32 @@ public abstract class BattlePerson {
i[0]++; i[0]++;
}); });
} }
else if (effect.equals("attack")) {
final boolean[] isAttacking = {true};
if (getClass().getName().equals("ruscz.game.gameOfProd.Battle.Hero")) {
effectedCoords[0] = -1;
effectTimer = new Timer(10, actionEvent -> {
if (effectedCoords[0] >= 0) effectTimer.stop();
else if (effectedCoords[0] <= -40) isAttacking[0] = false;
if (isAttacking[0]) effectedCoords[0] -= 7;
else effectedCoords[0] += 2;
});
}
else {
effectedCoords[0] = 1;
effectTimer = new Timer(10, actionEvent -> {
if (effectedCoords[0] <= 0) effectTimer.stop();
else if (effectedCoords[0] >= 40) isAttacking[0] = false;
if (isAttacking[0]) effectedCoords[0] += 7;
else effectedCoords[0] -= 2;
});
}
}
effectTimer.start(); effectTimer.start();
} }
private void stopEffectTimer() { protected void stopEffectTimer() {
effectTimer.stop(); if (effectTimer!= null) effectTimer.stop();
} }
private void getHurt() { private void getHurt() {
@ -89,8 +111,8 @@ public abstract class BattlePerson {
rescaleOp.filter(originalImage, whiteImage); rescaleOp.filter(originalImage, whiteImage);
rescaleOp.filter(whiteImage, whiteImage); rescaleOp.filter(whiteImage, whiteImage);
Graphics2D g = newImage.createGraphics(); Graphics2D g = newImage.createGraphics();
g.setComposite(AlphaComposite.SrcOver);
g.drawImage(originalImage, 0, 0, null); g.drawImage(originalImage, 0, 0, null);
g.setComposite(AlphaComposite.SrcOver);
final float[] a = {0.1f}; final float[] a = {0.1f};
final boolean[] isGoingWhite = {true}; final boolean[] isGoingWhite = {true};
timer = new Timer(10, actionEvent -> { timer = new Timer(10, actionEvent -> {
@ -99,7 +121,7 @@ public abstract class BattlePerson {
g.setComposite(AlphaComposite.SrcOver.derive(a[0])); g.setComposite(AlphaComposite.SrcOver.derive(a[0]));
g.drawImage(whiteImage, 0, 0, null); g.drawImage(whiteImage, 0, 0, null);
image = newImage; image = newImage;
if (a[0] < 0.1f) stopTimer(); if (a[0] < 0.1f) timer.stop();
if (a[0] >= 0.9f) isGoingWhite[0] = false; if (a[0] >= 0.9f) isGoingWhite[0] = false;
if (isGoingWhite[0]) a[0] += 0.1f; if (isGoingWhite[0]) a[0] += 0.1f;
else a[0] -= 0.1f; else a[0] -= 0.1f;
@ -107,8 +129,72 @@ public abstract class BattlePerson {
timer.start(); timer.start();
} }
private void stopTimer() { protected void getHealed() {
timer.stop(); BufferedImage originalImage = image;
BufferedImage whiteImage = new BufferedImage(originalImage.getWidth(), originalImage.getHeight(), BufferedImage.TYPE_INT_ARGB);
BufferedImage newImage = new BufferedImage(originalImage.getWidth(), originalImage.getHeight(), BufferedImage.TYPE_INT_ARGB);
RescaleOp rescaleOp = new RescaleOp(255.0f, 15, null);
rescaleOp.filter(originalImage, whiteImage);
rescaleOp.filter(whiteImage, whiteImage);
Graphics2D g = newImage.createGraphics();
final int[] i = {whiteImage.getHeight() - 2};
timer = new Timer(5, actionEvent -> {
g.drawImage(originalImage, 0, 0, null);
g.drawImage(whiteImage.getSubimage(0, i[0], whiteImage.getWidth(), 2), 0, i[0], null);
i[0]--;
image = newImage;
if (i[0] == 0) {
image = originalImage;
timer.stop();
}
});
timer.start();
}
public void getKilled(Battle battle) {
BufferedImage originalImage = image;
BufferedImage whiteImage = new BufferedImage(originalImage.getWidth(), originalImage.getHeight(), BufferedImage.TYPE_INT_ARGB);
BufferedImage newImage = new BufferedImage(originalImage.getWidth(), originalImage.getHeight(), BufferedImage.TYPE_INT_ARGB);
RescaleOp rescaleOp = new RescaleOp(255.0f, 15, null);
rescaleOp.filter(originalImage, whiteImage);
rescaleOp.filter(whiteImage, whiteImage);
Graphics2D g = newImage.createGraphics();
final int[] i = {1};
final int[] j = {1};
int xLines = whiteImage.getHeight() / 5;
int yLines = whiteImage.getWidth() / 5;
final int[] m = {0};
final int[] n = {0};
timer = new Timer(5, actionEvent -> {
if (i[0] < whiteImage.getHeight() || j[0] < whiteImage.getWidth()) {
g.drawImage(originalImage, 0, 0, null);
for (int k = 0; k < yLines; k++) {
g.drawImage(whiteImage.getSubimage(k * 5, 0, 1, i[0]), k * 5, 0, null);
}
for (int k = 0; k < xLines; k++) {
g.drawImage(whiteImage.getSubimage(0, k * 5, j[0], 1), 0, k * 5, null);
}
if (i[0] < whiteImage.getHeight()) i[0]++;
if (j[0] < whiteImage.getWidth()) j[0]++;
image = newImage;
}
else {
g.setColor(new Color(0, 0, 0, 0));
g.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC));
g.fillRect(m[0] * 5, n[0] * 5, 5, 5);
image = newImage;
if (m[0] == 0 && n[0] == xLines) {
battle.removePersonFromList(this);
timer.stop();
}
if (m[0] < yLines) m[0]++;
if (m[0] == yLines) {
n[0]++;
m[0] = 0;
}
}
});
timer.start();
} }
public int[] getEffectedCoords() { public int[] getEffectedCoords() {
@ -139,12 +225,12 @@ public abstract class BattlePerson {
} }
public void setHealth(int health) { public void setHealth(int health) {
if (this.health > health && image != null) { if (this.health > health && image != null && health > 0) {
getHurt(); getHurt();
setImageEffect("hurt"); if (health <= maxHealth/10) setImageEffect("shake");
else setImageEffect("hurt");
} }
this.health = health; this.health = health;
if (health <= maxHealth/10) setImageEffect("shake");
} }
public int getLevel() { public int getLevel() {

View File

@ -21,7 +21,10 @@ public class Hero extends BattlePerson {
@Override @Override
public void heal(int heal) { public void heal(int heal) {
health += heal; if (health + heal < maxHealth) health += heal;
else health = maxHealth;
stopEffectTimer();
getHealed();
} }
@Override @Override

View File

@ -12,10 +12,13 @@ public class CommandList extends JPanel {
public CommandList(WindowOfBattle window){ public CommandList(WindowOfBattle window){
setSize(CELL_SIZE * 8, CELL_SIZE * 6); setSize(CELL_SIZE * 8, CELL_SIZE * 6);
setLocation(CELL_SIZE * 4, CELL_SIZE * 2); setLocation(CELL_SIZE * 4, CELL_SIZE * 2);
setBackground(new Color(255, 255, 255, 150));
setBorder(BorderFactory.createLineBorder(new Color(213, 108, 18), 2));
setVisible(false); setVisible(false);
JLabel text = new JLabel("It's not a situation to use command line, idiot!"); JLabel text = new JLabel("It's not a situation to use command line, nerd!");
JButton jButton = new JButton("Hide this field"); text.setFont(new Font(Font.SERIF, Font.PLAIN, 20));
JButton jButton = window.style(new JButton("Hide this field"));
jButton.addActionListener(e -> { jButton.addActionListener(e -> {
this.setVisible(false); this.setVisible(false);
}); });

View File

@ -19,12 +19,14 @@ public class ConsoleInput extends JPanel {
setSize(CELL_SIZE * (CANVAS_WIDTH - 4), CELL_SIZE); setSize(CELL_SIZE * (CANVAS_WIDTH - 4), CELL_SIZE);
setLocation(CELL_SIZE * 4, CELL_SIZE * CANVAS_HEIGHT * 3 / 4 - CELL_SIZE); setLocation(CELL_SIZE * 4, CELL_SIZE * CANVAS_HEIGHT * 3 / 4 - CELL_SIZE);
setBackground(new Color(255, 255, 255, 150));
setBorder(BorderFactory.createLineBorder(new Color(213, 108, 18), 2));
setVisible(false); setVisible(false);
input = new JTextPane(); input = new JTextPane();
submit = new JButton("Submit"); submit = window.style(new JButton("Submit"));
list = new JButton("List"); list = window.style(new JButton("List"));
exit = new JButton("x"); exit = window.style(new JButton("x"));
submit.addActionListener(e -> { submit.addActionListener(e -> {
//TODO Take text from Field and work with parser //TODO Take text from Field and work with parser

View File

@ -5,7 +5,6 @@ import ruscz.game.gameOfProd.Windows.WindowOfBattle;
import javax.swing.*; import javax.swing.*;
import java.awt.*; import java.awt.*;
import java.util.Arrays;
import java.util.LinkedList; import java.util.LinkedList;
import static ruscz.game.gameOfProd.Windows.WindowOfBattle.*; import static ruscz.game.gameOfProd.Windows.WindowOfBattle.*;
@ -19,23 +18,17 @@ public class EnemyDescription extends JPanel {
setSize(CELL_SIZE * CANVAS_WIDTH * 2 / 3, CELL_SIZE * CANVAS_HEIGHT / 4); setSize(CELL_SIZE * CANVAS_WIDTH * 2 / 3, CELL_SIZE * CANVAS_HEIGHT / 4);
setLocation(0, CELL_SIZE * CANVAS_HEIGHT * 3 / 4); setLocation(0, CELL_SIZE * CANVAS_HEIGHT * 3 / 4);
setBackground(Color.cyan); setBackground(new Color(255, 255, 255, 150));
setBorder(BorderFactory.createLineBorder(new Color(213, 108, 18), 2));
setVisible(false); setVisible(false);
updateDescription();
} }
public void updateDescription() { public void updateDescription() {
Timer timer = new Timer(1000, e -> { setVisible(true);
if (isVisible()){ deletePreviousDescription();
deletePreviousDescription(); addNewDescription();
addNewDescription(); revalidate();
revalidate(); repaint();
repaint();
}
});
timer.start();
} }
private void addNewDescription() { private void addNewDescription() {
@ -45,18 +38,20 @@ public class EnemyDescription extends JPanel {
LinkedList<BattlePerson> he = new LinkedList<>(windowOfBattle.getBattle().getHeroes()); LinkedList<BattlePerson> he = new LinkedList<>(windowOfBattle.getBattle().getHeroes());
he.addAll(windowOfBattle.getBattle().getEnemies()); he.addAll(windowOfBattle.getBattle().getEnemies());
setLayout(new GridLayout (he.size() + 1, 3)); setLayout(new GridLayout (he.size(), 3));
for (BattlePerson person: he){ for (BattlePerson person: he){
Font f = new Font(Font.DIALOG, Font.BOLD, 20); Font f = new Font(Font.SERIF, Font.BOLD, 20);
Font t = new Font(Font.SERIF, Font.PLAIN, 20);
JPanel jPanel = new JPanel(); JPanel jPanel = new JPanel();
jPanel.setOpaque(false);
JLabel name = new JLabel(person.getName()); JLabel name = new JLabel(person.getName());
name.setFont(f); name.setFont(f);
JLabel level = new JLabel("Level: " + person.getLevel()); JLabel level = new JLabel("Level: " + person.getLevel());
level.setFont(f); level.setFont(t);
JLabel health = new JLabel("Health: " + person.getHealth() + "/" + person.getMaxHealth()); JLabel health = new JLabel("Health: " + person.getHealth() + "/" + person.getMaxHealth());
health.setFont(f); health.setFont(t);
jPanel.add(name); jPanel.add(name);
jPanel.add(level); jPanel.add(level);
jPanel.add(health); jPanel.add(health);

View File

@ -24,12 +24,13 @@ public class ItemsInventory extends JPanel {
setSize(CELL_SIZE * 8, CELL_SIZE * 6); setSize(CELL_SIZE * 8, CELL_SIZE * 6);
setLocation(CELL_SIZE * 4, CELL_SIZE * 2); setLocation(CELL_SIZE * 4, CELL_SIZE * 2);
setBackground(Color.yellow); setBackground(new Color(255, 255, 255, 150));
setBorder(BorderFactory.createLineBorder(new Color(213, 108, 18), 2));
setVisible(false); setVisible(false);
items = new JPanel(); items = new JPanel();
JButton returnToMenu = new JButton("x"); JButton returnToMenu = window.style(new JButton(" x "));
returnToMenu.addActionListener(e -> { returnToMenu.addActionListener(e -> {
window.getMenuOfActions().getAttack().setEnabled(true); window.getMenuOfActions().getAttack().setEnabled(true);
window.getMenuOfActions().getConsole().setEnabled(true); window.getMenuOfActions().getConsole().setEnabled(true);
@ -61,14 +62,16 @@ public class ItemsInventory extends JPanel {
jPanel.add(new JLabel(String.valueOf(item.getItemAction()))); jPanel.add(new JLabel(String.valueOf(item.getItemAction())));
if (item.getItemAction().equals(ItemAction.HEAL)){ if (item.getItemAction().equals(ItemAction.HEAL)){
JButton use = new JButton("Use"); JButton use = windowOfBattle.style(new JButton("Use"));
use.addActionListener(e -> { use.addActionListener(e -> {
setVisible(false); setVisible(false);
windowOfBattle.getBattle().getHeroes().getFirst().heal(100); windowOfBattle.getBattle().getHeroes().getFirst().heal(100);
windowOfBattle.getMenuOfActions().setVisible(false); windowOfBattle.getMenuOfActions().setVisible(false);
windowOfBattle.getEnemyDescription().setVisible(false); windowOfBattle.getEnemyDescription().setVisible(false);
windowOfBattle.getSituationText().setVisible(true);
windowOfBattle.writeToOutput(windowOfBattle.getBattle().getHeroes().getFirst().getName() + " heals 100 HP"); windowOfBattle.writeToOutput(windowOfBattle.getBattle().getHeroes().getFirst().getName() + " heals 100 HP");
InventoryManager.removeItem(item, 1); InventoryManager.removeItem(item, 1);
windowOfBattle.getBattle().addToTurnOrder(windowOfBattle.getBattle().getHeroes().getFirst());
windowOfBattle.getBattle().setTurnBelongTo(null); windowOfBattle.getBattle().setTurnBelongTo(null);
windowOfBattle.getBattle().setDelay(2); windowOfBattle.getBattle().setDelay(2);
windowOfBattle.getBattle().getTimer().start(); windowOfBattle.getBattle().getTimer().start();
@ -82,6 +85,4 @@ public class ItemsInventory extends JPanel {
items.setVisible(true); items.setVisible(true);
if (items.getComponents().length == 0) items.setVisible(false); if (items.getComponents().length == 0) items.setVisible(false);
} }
} }

View File

@ -18,13 +18,13 @@ public class MenuOfActions extends JPanel {
setSize(CELL_SIZE * CANVAS_WIDTH / 3, CELL_SIZE * CANVAS_HEIGHT / 4); setSize(CELL_SIZE * CANVAS_WIDTH / 3, CELL_SIZE * CANVAS_HEIGHT / 4);
setLocation(CELL_SIZE * CANVAS_WIDTH * 2 / 3, CELL_SIZE * CANVAS_HEIGHT * 3 / 4); setLocation(CELL_SIZE * CANVAS_WIDTH * 2 / 3, CELL_SIZE * CANVAS_HEIGHT * 3 / 4);
setBackground(Color.green);
setVisible(false); setVisible(false);
setBorder(BorderFactory.createLineBorder(new Color(213, 108, 18), 2));
attack = new JButton("Attack"); attack = window.style(new JButton("Attack"));
console = new JButton("Console"); console = window.style(new JButton("Console"));
inventory = new JButton("Items"); inventory = window.style(new JButton("Items"));
escape = new JButton("Run Away"); escape = window.style(new JButton("Run Away"));
attack.addActionListener(e -> { attack.addActionListener(e -> {
attack.setEnabled(false); attack.setEnabled(false);
@ -61,7 +61,7 @@ public class MenuOfActions extends JPanel {
inventory.setEnabled(false); inventory.setEnabled(false);
escape.setEnabled(false); escape.setEnabled(false);
//TODO RunAway window.getBattle().endBattle(true);
}); });
add(attack); add(attack);

View File

@ -11,6 +11,13 @@ public class SituationText extends JPanel {
public SituationText(WindowOfBattle window) { public SituationText(WindowOfBattle window) {
setSize(CELL_SIZE * CANVAS_WIDTH, CELL_SIZE * CANVAS_HEIGHT / 4); setSize(CELL_SIZE * CANVAS_WIDTH, CELL_SIZE * CANVAS_HEIGHT / 4);
setLocation(0, CELL_SIZE * CANVAS_HEIGHT * 3 / 4); setLocation(0, CELL_SIZE * CANVAS_HEIGHT * 3 / 4);
setBackground(Color.BLUE); setBackground(new Color(255, 255, 255, 150));
setBorder(BorderFactory.createLineBorder(new Color(213, 108, 18), 2));
}
public void hideText() {
JLabel label = (JLabel) getComponent(0);
label.setText("");
setVisible(false);
} }
} }

View File

@ -47,7 +47,11 @@ public class Person extends Cell {
} }
public void setDirectionMove(int directionMove) { public void setDirectionMove(int directionMove) {
if ((directionMove >= WindowOfFreeMove.KEY_LEFT) && (directionMove <= WindowOfFreeMove.KEY_EVENT)) if (directionMove == WindowOfFreeMove.KEY_LEFT ||
directionMove == WindowOfFreeMove.KEY_RIGHT ||
directionMove == WindowOfFreeMove.KEY_UP ||
directionMove == WindowOfFreeMove.KEY_DOWN ||
directionMove == WindowOfFreeMove.KEY_EVENT)
this.directionMove = directionMove; this.directionMove = directionMove;
} }

View File

@ -13,9 +13,9 @@ public class Game extends JFrame {
private static final int WINDOW_HEIGHT = 13; private static final int WINDOW_HEIGHT = 13;
public static final int CELL_SIZE = 60; public static final int CELL_SIZE = 60;
private final WindowOfMenu menu; private WindowOfMenu menu;
private final WindowOfFreeMove freeMove; private WindowOfFreeMove freeMove;
private final WindowOfBattle battle; private WindowOfBattle battle;
private TilesetOverview tilesetOverview; private TilesetOverview tilesetOverview;
public WindowOfMenu getMenu() { public WindowOfMenu getMenu() {

View File

@ -142,7 +142,7 @@ public class WindowOfBattle extends JPanel {
enemies.add(enemy); enemies.add(enemy);
} }
else if (data[0].equals("<music>")) { else if (data[0].equals("<music>")) {
musicManager = new MusicManager(data[1], Float.parseFloat(data[2])); // musicManager = new MusicManager(data[1], Float.parseFloat(data[2]));
} }
else if (data[0].equals("<image>")) { else if (data[0].equals("<image>")) {
if (data[1].equals("flicker")) canvas.flicker(Integer.parseInt(data[2])); if (data[1].equals("flicker")) canvas.flicker(Integer.parseInt(data[2]));
@ -197,6 +197,19 @@ public class WindowOfBattle extends JPanel {
repaint(); repaint();
} }
public JButton style(JButton button) {
Font f = new Font(Font.SERIF, Font.BOLD, 16);
Color c = new Color(255, 217, 112);
Color b = new Color(213, 108, 18);
button.setFont(f);
button.setBackground(c);
button.setForeground(b);
button.setBorder(BorderFactory.createLineBorder(b, 2));
button.setFocusPainted(false);
return button;
}
public Game getGame() { public Game getGame() {
return game; return game;
} }

View File

@ -14,7 +14,7 @@
<trigger> <trigger>
<x>6</x> <x>6</x>
<y>4</y> <y>4</y>
<active>true</active> <active>false</active>
</trigger> </trigger>
<trigger> <trigger>
<x>14</x> <x>14</x>
@ -24,7 +24,7 @@
<chest> <chest>
<x>1</x> <x>1</x>
<y>2</y> <y>2</y>
<active>true</active> <active>false</active>
</chest> </chest>
<chest> <chest>
<x>15</x> <x>15</x>

View File

@ -0,0 +1,6 @@
<item>
<name>cup-o'-coffee</name>
<multiplicity>1</multiplicity>
<image>295</image>
<action>heal</action>
</item>

View File

@ -74,7 +74,7 @@ public class WindowOfFreeMoveTest {
@MethodSource("argumentsStream") @MethodSource("argumentsStream")
public void move_moveCharacterOnMap_CharacterChangesPositionWithCollisionDetection(int[] directions, int xPath, int yPath) { public void move_moveCharacterOnMap_CharacterChangesPositionWithCollisionDetection(int[] directions, int xPath, int yPath) {
//Arrage //Arrage
//is in setUp() freeMove.revalidate();
//Act //Act
final int[] i = {0}; final int[] i = {0};