improved directory tree & added battle graphics
@ -1,14 +1,31 @@
|
|||||||
package ruscz.game.gameOfProd.Battle;
|
package ruscz.game.gameOfProd.Battle;
|
||||||
|
|
||||||
import ruscz.game.gameOfProd.Windows.WindowOfBattle;
|
import javax.imageio.ImageIO;
|
||||||
|
import javax.swing.*;
|
||||||
import java.awt.*;
|
import java.awt.*;
|
||||||
|
import java.awt.image.BufferedImage;
|
||||||
|
import java.awt.image.RescaleOp;
|
||||||
|
import java.io.File;
|
||||||
|
import java.io.IOException;
|
||||||
|
|
||||||
public abstract class BattlePerson {
|
public abstract class BattlePerson {
|
||||||
|
protected int maxHealth;
|
||||||
protected int health;
|
protected int health;
|
||||||
protected int level;
|
protected int level;
|
||||||
protected String name;
|
protected String name;
|
||||||
protected int strength;
|
protected int strength;
|
||||||
|
private BufferedImage image;
|
||||||
|
private int[] effectedCoords;
|
||||||
|
private Timer effectTimer;
|
||||||
|
private Timer timer;
|
||||||
|
|
||||||
|
public BattlePerson(int hp, int lvl, String name, int str, String image){
|
||||||
|
health = maxHealth = hp;
|
||||||
|
level = lvl;
|
||||||
|
this.name = name;
|
||||||
|
strength = str;
|
||||||
|
parseImage(image);
|
||||||
|
}
|
||||||
|
|
||||||
public BattlePerson(int hp, int lvl, String name, int str){
|
public BattlePerson(int hp, int lvl, String name, int str){
|
||||||
health = hp;
|
health = hp;
|
||||||
@ -17,6 +34,92 @@ public abstract class BattlePerson {
|
|||||||
strength = str;
|
strength = str;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void parseImage(String name) {
|
||||||
|
try {
|
||||||
|
image = ImageIO.read(new File("src/main/resources/characters/" + name.substring(0, name.indexOf("-battle")) + "/" + name + ".png"));
|
||||||
|
} catch (IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setImageEffect(String effect) {
|
||||||
|
effectedCoords = new int[]{0, 0};
|
||||||
|
effectCoords(effect);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void effectCoords(String effect) {
|
||||||
|
if (effect.equals("hover")) {
|
||||||
|
final boolean[] isGoingUp = {true};
|
||||||
|
effectTimer = new Timer(100, actionEvent -> {
|
||||||
|
if (effectedCoords[1] == 0) isGoingUp[0] = true;
|
||||||
|
else if (effectedCoords[1] == -20) isGoingUp[0] = false;
|
||||||
|
if (isGoingUp[0]) effectedCoords[1]--;
|
||||||
|
else effectedCoords[1]++;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
else if (effect.equals("shake")) {
|
||||||
|
effectedCoords[0] = 1;
|
||||||
|
effectTimer = new Timer(50, actionEvent -> {
|
||||||
|
if (effectedCoords[0] == 1) effectedCoords[0] = -1;
|
||||||
|
else effectedCoords[0] = 1;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
else if (effect.equals("hurt")) {
|
||||||
|
effectedCoords[0] = 3;
|
||||||
|
final int[] i = {0};
|
||||||
|
effectTimer = new Timer(100, actionEvent -> {
|
||||||
|
if (i[0] == 5) stopEffectTimer();
|
||||||
|
if (effectedCoords[0] == 3) effectedCoords[0] = -3;
|
||||||
|
else effectedCoords[0] = 3;
|
||||||
|
i[0]++;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
effectTimer.start();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void stopEffectTimer() {
|
||||||
|
effectTimer.stop();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void getHurt() {
|
||||||
|
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();
|
||||||
|
g.setComposite(AlphaComposite.SrcOver);
|
||||||
|
g.drawImage(originalImage, 0, 0, null);
|
||||||
|
final float[] a = {0.1f};
|
||||||
|
final boolean[] isGoingWhite = {true};
|
||||||
|
timer = new Timer(10, actionEvent -> {
|
||||||
|
g.setComposite(AlphaComposite.SrcOver);
|
||||||
|
g.drawImage(originalImage, 0, 0, null);
|
||||||
|
g.setComposite(AlphaComposite.SrcOver.derive(a[0]));
|
||||||
|
g.drawImage(whiteImage, 0, 0, null);
|
||||||
|
image = newImage;
|
||||||
|
if (a[0] < 0.1f) stopTimer();
|
||||||
|
if (a[0] >= 0.9f) isGoingWhite[0] = false;
|
||||||
|
if (isGoingWhite[0]) a[0] += 0.1f;
|
||||||
|
else a[0] -= 0.1f;
|
||||||
|
});
|
||||||
|
timer.start();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void stopTimer() {
|
||||||
|
timer.stop();
|
||||||
|
}
|
||||||
|
|
||||||
|
public int[] getEffectedCoords() {
|
||||||
|
if (effectedCoords == null) return new int[]{0, 0};
|
||||||
|
return effectedCoords;
|
||||||
|
}
|
||||||
|
|
||||||
|
public BufferedImage getImage() {
|
||||||
|
return image;
|
||||||
|
}
|
||||||
|
|
||||||
public abstract void heal(int heal);
|
public abstract void heal(int heal);
|
||||||
|
|
||||||
public abstract void attack(BattlePerson enemy);
|
public abstract void attack(BattlePerson enemy);
|
||||||
@ -31,16 +134,17 @@ public abstract class BattlePerson {
|
|||||||
|
|
||||||
public abstract void runAway();
|
public abstract void runAway();
|
||||||
|
|
||||||
public void paint(Graphics g, int x, int y) {
|
|
||||||
g.fillOval(x,y, WindowOfBattle.CELL_SIZE, WindowOfBattle.CELL_SIZE);
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getHealth() {
|
public int getHealth() {
|
||||||
return health;
|
return health;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setHealth(int health) {
|
public void setHealth(int health) {
|
||||||
|
if (this.health > health) {
|
||||||
|
getHurt();
|
||||||
|
setImageEffect("hurt");
|
||||||
|
}
|
||||||
this.health = health;
|
this.health = health;
|
||||||
|
if (health <= maxHealth/10) setImageEffect("shake");
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getLevel() {
|
public int getLevel() {
|
||||||
|
|||||||
@ -3,6 +3,11 @@ package ruscz.game.gameOfProd.Battle;
|
|||||||
public class Enemy extends BattlePerson {
|
public class Enemy extends BattlePerson {
|
||||||
private int id;
|
private int id;
|
||||||
|
|
||||||
|
public Enemy(int hp, int lvl, String name, int str, int id, String image) {
|
||||||
|
super(hp, lvl, name, str, image);
|
||||||
|
this.id = id;
|
||||||
|
}
|
||||||
|
|
||||||
public Enemy(int hp, int lvl, String name, int str, int id) {
|
public Enemy(int hp, int lvl, String name, int str, int id) {
|
||||||
super(hp, lvl, name, str);
|
super(hp, lvl, name, str);
|
||||||
this.id = id;
|
this.id = id;
|
||||||
|
|||||||
@ -5,6 +5,13 @@ public class Hero extends BattlePerson {
|
|||||||
private int defence;
|
private int defence;
|
||||||
private boolean isBlocking;
|
private boolean isBlocking;
|
||||||
|
|
||||||
|
public Hero(int hp, int lvl, String name, int str, int mana, int defence, String image){
|
||||||
|
super(hp, lvl, name, str, image);
|
||||||
|
this.mana = mana;
|
||||||
|
this.defence = defence;
|
||||||
|
isBlocking = false;
|
||||||
|
}
|
||||||
|
|
||||||
public Hero(int hp, int lvl, String name, int str, int mana, int defence){
|
public Hero(int hp, int lvl, String name, int str, int mana, int defence){
|
||||||
super(hp, lvl, name, str);
|
super(hp, lvl, name, str);
|
||||||
this.mana = mana;
|
this.mana = mana;
|
||||||
|
|||||||
@ -332,7 +332,7 @@ public class InteractionCell extends Cell {
|
|||||||
}
|
}
|
||||||
else if (data[1].equals("<npc>")) {
|
else if (data[1].equals("<npc>")) {
|
||||||
if (data[2].equals("add")) {
|
if (data[2].equals("add")) {
|
||||||
File npcFile = new File("src/main/resources/characters/" + data[3] + ".txt");
|
File npcFile = new File("src/main/resources/characters/" + data[3] + "/" + data[3] + ".txt");
|
||||||
Scanner sc = new Scanner(npcFile);
|
Scanner sc = new Scanner(npcFile);
|
||||||
String[] position = sc.nextLine().split(" ");
|
String[] position = sc.nextLine().split(" ");
|
||||||
Npc npc = new Npc(Integer.parseInt(position[0]), Integer.parseInt(position[1]), data[3], Map.findMapByName(position[2], window), window.getMapManager());
|
Npc npc = new Npc(Integer.parseInt(position[0]), Integer.parseInt(position[1]), data[3], Map.findMapByName(position[2], window), window.getMapManager());
|
||||||
|
|||||||
@ -93,7 +93,7 @@ public class Npc extends Person {
|
|||||||
private void moveUp() {
|
private void moveUp() {
|
||||||
int y = getY() - 1;
|
int y = getY() - 1;
|
||||||
set(getX(), y);
|
set(getX(), y);
|
||||||
direction = 3;
|
direction = 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void moveDown() {
|
private void moveDown() {
|
||||||
@ -105,17 +105,17 @@ public class Npc extends Person {
|
|||||||
private void moveLeft() {
|
private void moveLeft() {
|
||||||
int x = getX() - 1;
|
int x = getX() - 1;
|
||||||
set(x, getY());
|
set(x, getY());
|
||||||
direction = 2;
|
direction = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void moveRight() {
|
private void moveRight() {
|
||||||
int x = getX() + 1;
|
int x = getX() + 1;
|
||||||
set(x, getY());
|
set(x, getY());
|
||||||
direction = 0;
|
direction = 3;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void loadNpc() {
|
private void loadNpc() {
|
||||||
File dialogFile = new File("src/main/resources/characters/" + name + ".txt");
|
File dialogFile = new File("src/main/resources/characters/" + name + "/" + name + ".txt");
|
||||||
Scanner scanner = null;
|
Scanner scanner = null;
|
||||||
try {
|
try {
|
||||||
scanner = new Scanner(dialogFile);
|
scanner = new Scanner(dialogFile);
|
||||||
@ -140,7 +140,7 @@ public class Npc extends Person {
|
|||||||
if (name != null) {
|
if (name != null) {
|
||||||
BufferedImage image = null;
|
BufferedImage image = null;
|
||||||
try {
|
try {
|
||||||
image = ImageIO.read(new File("src/main/resources/characters/" + imageNpc)).getSubimage(width * direction, 0, width, height);
|
image = ImageIO.read(new File("src/main/resources/characters/" + name + "/" + imageNpc)).getSubimage(width * direction, 0, width, height);
|
||||||
g.drawImage(image, getX() * getSize() + (getSize() / 5) + offsetX,
|
g.drawImage(image, getX() * getSize() + (getSize() / 5) + offsetX,
|
||||||
getY() * getSize() - (getSize() * 3 / 5) + offsetY, getSize() * widthCoef / 5, getSize() * heightCoef / 2, null);
|
getY() * getSize() - (getSize() * 3 / 5) + offsetY, getSize() * widthCoef / 5, getSize() * heightCoef / 2, null);
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
|
|||||||
@ -23,7 +23,7 @@ public class ImageDialog {
|
|||||||
|
|
||||||
public static void parseBackground() {
|
public static void parseBackground() {
|
||||||
try {
|
try {
|
||||||
dialogBack = ImageIO.read(new File("src/main/resources/DialogBox.png"));
|
dialogBack = ImageIO.read(new File("src/main/resources/dialogs/DialogBox.png"));
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
@ -31,7 +31,7 @@ public class ImageDialog {
|
|||||||
|
|
||||||
private void parseImage(){
|
private void parseImage(){
|
||||||
try {
|
try {
|
||||||
image = ImageIO.read(new File("src/main/resources/characters/" + name));
|
image = ImageIO.read(new File("src/main/resources/characters/" + name.substring(0, name.indexOf("-face.png")) + "/" + name));
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
|||||||
@ -33,12 +33,12 @@ public class ImagePerson {
|
|||||||
|
|
||||||
public ImagePerson(String name, Rectangle[] rectangles) {
|
public ImagePerson(String name, Rectangle[] rectangles) {
|
||||||
try {
|
try {
|
||||||
File dialogFile = new File("src/main/resources/characters/" + name + ".txt");
|
File dialogFile = new File("src/main/resources/characters/main/" + name + ".txt");
|
||||||
Scanner scanner = new Scanner(dialogFile);
|
Scanner scanner = new Scanner(dialogFile);
|
||||||
String[] subimageSize = scanner.nextLine().split(" ");
|
String[] subimageSize = scanner.nextLine().split(" ");
|
||||||
subimageWidth = Integer.parseInt(subimageSize[0]);
|
subimageWidth = Integer.parseInt(subimageSize[0]);
|
||||||
subimageHeight = Integer.parseInt(subimageSize[1]);
|
subimageHeight = Integer.parseInt(subimageSize[1]);
|
||||||
image = ImageIO.read(new File("src/main/resources/characters/" + scanner.nextLine()));
|
image = ImageIO.read(new File("src/main/resources/characters/main/" + scanner.nextLine()));
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
|||||||
@ -101,7 +101,7 @@ public class LoadManager {
|
|||||||
while (scanner.hasNextLine()) {
|
while (scanner.hasNextLine()) {
|
||||||
String[] npcName = scanner.nextLine().split(" ");
|
String[] npcName = scanner.nextLine().split(" ");
|
||||||
if (npcName[0].equals("<" + WindowOfFreeMove.getCHAPTER() + ">")) {
|
if (npcName[0].equals("<" + WindowOfFreeMove.getCHAPTER() + ">")) {
|
||||||
File npcFile = new File("src/main/resources/characters/" + npcName[1] + ".txt");
|
File npcFile = new File("src/main/resources/characters/" + npcName[1] + "/" + npcName[1] + ".txt");
|
||||||
Scanner sc = new Scanner(npcFile);
|
Scanner sc = new Scanner(npcFile);
|
||||||
String[] position = sc.nextLine().split(" ");
|
String[] position = sc.nextLine().split(" ");
|
||||||
Npc npc = new Npc(Integer.parseInt(position[0]), Integer.parseInt(position[1]), npcName[1], Map.findMapByName(position[2], window), mapManager);
|
Npc npc = new Npc(Integer.parseInt(position[0]), Integer.parseInt(position[1]), npcName[1], Map.findMapByName(position[2], window), mapManager);
|
||||||
|
|||||||
@ -6,16 +6,18 @@ import ruscz.game.gameOfProd.Battle.Enemy;
|
|||||||
import ruscz.game.gameOfProd.Battle.Hero;
|
import ruscz.game.gameOfProd.Battle.Hero;
|
||||||
import ruscz.game.gameOfProd.BattleUI.*;
|
import ruscz.game.gameOfProd.BattleUI.*;
|
||||||
import ruscz.game.gameOfProd.Game;
|
import ruscz.game.gameOfProd.Game;
|
||||||
import ruscz.game.gameOfProd.Save.SaveManager;
|
|
||||||
import ruscz.game.gameOfProd.Sounds.MusicManager;
|
import ruscz.game.gameOfProd.Sounds.MusicManager;
|
||||||
|
|
||||||
|
import javax.imageio.ImageIO;
|
||||||
import javax.swing.*;
|
import javax.swing.*;
|
||||||
import java.awt.*;
|
import java.awt.*;
|
||||||
import java.awt.event.KeyAdapter;
|
import java.awt.event.KeyAdapter;
|
||||||
import java.awt.event.KeyEvent;
|
import java.awt.event.KeyEvent;
|
||||||
import java.awt.event.WindowEvent;
|
import java.awt.event.WindowEvent;
|
||||||
|
import java.awt.image.BufferedImage;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.FileNotFoundException;
|
import java.io.FileNotFoundException;
|
||||||
|
import java.io.IOException;
|
||||||
import java.util.LinkedList;
|
import java.util.LinkedList;
|
||||||
import java.util.Scanner;
|
import java.util.Scanner;
|
||||||
|
|
||||||
@ -109,8 +111,8 @@ public class WindowOfBattle extends JPanel {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void startBattle(String name) {
|
public void startBattle(String name) {
|
||||||
SaveManager saveManager = game.getFreeMove().getMapManager().getSaveManager();
|
// SaveManager saveManager = game.getFreeMove().getMapManager().getSaveManager();
|
||||||
saveManager.saveGame();
|
// saveManager.saveGame();
|
||||||
|
|
||||||
LinkedList<Hero> heroes = new LinkedList<>();
|
LinkedList<Hero> heroes = new LinkedList<>();
|
||||||
LinkedList<Enemy> enemies = new LinkedList<>();
|
LinkedList<Enemy> enemies = new LinkedList<>();
|
||||||
@ -122,17 +124,23 @@ public class WindowOfBattle extends JPanel {
|
|||||||
String[] data = scanner.nextLine().split(" ");
|
String[] data = scanner.nextLine().split(" ");
|
||||||
if (data[0].equals("<hero>")) {
|
if (data[0].equals("<hero>")) {
|
||||||
Hero hero = new Hero(Integer.parseInt(data[1]), Integer.parseInt(data[2]), data[3],
|
Hero hero = new Hero(Integer.parseInt(data[1]), Integer.parseInt(data[2]), data[3],
|
||||||
Integer.parseInt(data[4]), Integer.parseInt(data[5]), Integer.parseInt(data[6]));
|
Integer.parseInt(data[4]), Integer.parseInt(data[5]), Integer.parseInt(data[6]), data[7]);
|
||||||
|
if (data.length > 8) hero.setImageEffect(data[8]);
|
||||||
heroes.add(hero);
|
heroes.add(hero);
|
||||||
}
|
}
|
||||||
else if (data[0].equals("<enemy>")) {
|
else if (data[0].equals("<enemy>")) {
|
||||||
Enemy enemy = new Enemy(Integer.parseInt(data[1]), Integer.parseInt(data[2]), data[3],
|
Enemy enemy = new Enemy(Integer.parseInt(data[1]), Integer.parseInt(data[2]), data[3],
|
||||||
Integer.parseInt(data[4]), Integer.parseInt(data[5]));
|
Integer.parseInt(data[4]), Integer.parseInt(data[5]), data[6]);
|
||||||
|
if (data.length > 7) enemy.setImageEffect(data[7]);
|
||||||
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>")) {
|
||||||
|
if (data[1].equals("flicker")) canvas.flicker(Integer.parseInt(data[2]));
|
||||||
|
else canvas.addImage(data[1]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} catch (FileNotFoundException e) {
|
} catch (FileNotFoundException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
@ -179,23 +187,68 @@ public class WindowOfBattle extends JPanel {
|
|||||||
}
|
}
|
||||||
|
|
||||||
class Canvas extends JPanel {
|
class Canvas extends JPanel {
|
||||||
|
private LinkedList<BufferedImage> images;
|
||||||
|
private BufferedImage image;
|
||||||
|
private Timer timer;
|
||||||
|
|
||||||
|
public void addImage(String name) {
|
||||||
|
try {
|
||||||
|
images.add(ImageIO.read(new File("src/main/resources/foregrounds/" + name + ".png")));
|
||||||
|
image = images.getLast();
|
||||||
|
} catch (IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setImage(String name) {
|
||||||
|
try {
|
||||||
|
image = ImageIO.read(new File("src/main/resources/foregrounds/" + name + ".png"));
|
||||||
|
} catch (IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void flicker(int delay) {
|
||||||
|
timer = new Timer(delay, actionEvent -> {
|
||||||
|
image = images.get((int) (Math.random() * images.size()));
|
||||||
|
});
|
||||||
|
timer.start();
|
||||||
|
}
|
||||||
|
|
||||||
Canvas(){
|
Canvas(){
|
||||||
setPreferredSize(new Dimension(
|
setPreferredSize(new Dimension(
|
||||||
CELL_SIZE * CANVAS_WIDTH,
|
CELL_SIZE * CANVAS_WIDTH,
|
||||||
CELL_SIZE * CANVAS_HEIGHT));
|
CELL_SIZE * CANVAS_HEIGHT));
|
||||||
setSize(CELL_SIZE * CANVAS_WIDTH, CELL_SIZE * CANVAS_HEIGHT);
|
setSize(CELL_SIZE * CANVAS_WIDTH, CELL_SIZE * CANVAS_HEIGHT);
|
||||||
setBackground(Color.RED);
|
setBackground(Color.RED);
|
||||||
|
images = new LinkedList<>();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void paint(Graphics g) {
|
public void paint(Graphics g) {
|
||||||
super.paint(g);
|
super.paint(g);
|
||||||
if (isReadyToPaint) {
|
if (isReadyToPaint) {
|
||||||
|
if (image != null) {
|
||||||
|
g.drawImage(image, 0, 0, CELL_SIZE * CANVAS_WIDTH,
|
||||||
|
CELL_SIZE * CANVAS_HEIGHT, this);
|
||||||
|
}
|
||||||
for (Enemy battlePerson : battle.getEnemies()) {
|
for (Enemy battlePerson : battle.getEnemies()) {
|
||||||
battlePerson.paint(g, CELL_SIZE * 2, CELL_SIZE * 3 * battlePerson.getId());
|
g.drawImage(
|
||||||
|
battlePerson.getImage(),
|
||||||
|
CELL_SIZE * 2 + battlePerson.getEffectedCoords()[0],
|
||||||
|
CELL_SIZE * 4 * battlePerson.getId() + battlePerson.getEffectedCoords()[1],
|
||||||
|
battlePerson.getImage().getWidth() * 2,
|
||||||
|
battlePerson.getImage().getHeight() * 2,
|
||||||
|
this);
|
||||||
}
|
}
|
||||||
for (BattlePerson battlePerson : battle.getHeroes()) {
|
for (BattlePerson battlePerson : battle.getHeroes()) {
|
||||||
battlePerson.paint(g, CELL_SIZE * 12, CELL_SIZE * 4);
|
g.drawImage(
|
||||||
|
battlePerson.getImage(),
|
||||||
|
CELL_SIZE * 12 + battlePerson.getEffectedCoords()[0],
|
||||||
|
CELL_SIZE * 4 + battlePerson.getEffectedCoords()[1],
|
||||||
|
battlePerson.getImage().getWidth() * 2,
|
||||||
|
battlePerson.getImage().getHeight() * 2,
|
||||||
|
this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -281,7 +281,7 @@ public class WindowOfFreeMove extends JLayeredPane {
|
|||||||
if (name == null) imageForeground = null;
|
if (name == null) imageForeground = null;
|
||||||
else {
|
else {
|
||||||
try {
|
try {
|
||||||
imageForeground = ImageIO.read(new File("src/main/resources/" + name + ".png"));
|
imageForeground = ImageIO.read(new File("src/main/resources/foregrounds/" + name + ".png"));
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
|||||||
|
Before Width: | Height: | Size: 451 B |
|
Before Width: | Height: | Size: 476 B |
|
Before Width: | Height: | Size: 1.5 KiB |
@ -1,3 +1,6 @@
|
|||||||
<hero> 100 10 Mark 1 10 1
|
<hero> 100 10 Mark 1 10 1 main-battle
|
||||||
<enemy> 100 10 Karen 10 1
|
<enemy> 100 10 Karen 10 1 monster-battle hover
|
||||||
<music> Fight_Music.wav -10.0f
|
<music> Fight_Music.wav -10.0f
|
||||||
|
<image> battle1
|
||||||
|
<image> battle2
|
||||||
|
<image> flicker 500
|
||||||
|
Before Width: | Height: | Size: 1.9 KiB |
|
Before Width: | Height: | Size: 1.2 KiB |
|
Before Width: | Height: | Size: 1.8 KiB |
|
Before Width: | Height: | Size: 1.3 KiB |
|
Before Width: | Height: | Size: 292 B |
|
Before Width: | Height: | Size: 291 B |
|
Before Width: | Height: | Size: 285 B |
|
Before Width: | Height: | Size: 273 B |
|
Before Width: | Height: | Size: 286 B |
|
Before Width: | Height: | Size: 283 B |
|
Before Width: | Height: | Size: 284 B |
|
Before Width: | Height: | Size: 290 B |
|
Before Width: | Height: | Size: 283 B |
|
Before Width: | Height: | Size: 1023 B |
|
Before Width: | Height: | Size: 1.0 KiB |
|
Before Width: | Height: | Size: 1.0 KiB |
|
Before Width: | Height: | Size: 1.0 KiB |
|
Before Width: | Height: | Size: 1.0 KiB |
|
Before Width: | Height: | Size: 1.0 KiB |
|
Before Width: | Height: | Size: 1.0 KiB |
|
Before Width: | Height: | Size: 1.0 KiB |
|
Before Width: | Height: | Size: 3.4 KiB After Width: | Height: | Size: 3.4 KiB |
|
Before Width: | Height: | Size: 14 KiB After Width: | Height: | Size: 14 KiB |
|
Before Width: | Height: | Size: 19 KiB After Width: | Height: | Size: 19 KiB |
|
Before Width: | Height: | Size: 3.4 KiB After Width: | Height: | Size: 3.4 KiB |
|
Before Width: | Height: | Size: 20 KiB After Width: | Height: | Size: 20 KiB |
|
Before Width: | Height: | Size: 2.1 KiB After Width: | Height: | Size: 2.1 KiB |
|
Before Width: | Height: | Size: 16 KiB After Width: | Height: | Size: 16 KiB |
|
Before Width: | Height: | Size: 14 KiB After Width: | Height: | Size: 14 KiB |
|
Before Width: | Height: | Size: 16 KiB After Width: | Height: | Size: 16 KiB |
|
Before Width: | Height: | Size: 3.9 KiB After Width: | Height: | Size: 3.9 KiB |
|
Before Width: | Height: | Size: 22 KiB After Width: | Height: | Size: 22 KiB |
|
Before Width: | Height: | Size: 18 KiB After Width: | Height: | Size: 18 KiB |
BIN
src/main/resources/characters/main/main-battle.png
Normal file
|
After Width: | Height: | Size: 9.5 KiB |
|
Before Width: | Height: | Size: 4.1 KiB After Width: | Height: | Size: 4.1 KiB |
|
Before Width: | Height: | Size: 52 KiB After Width: | Height: | Size: 52 KiB |
|
Before Width: | Height: | Size: 24 KiB After Width: | Height: | Size: 24 KiB |
|
Before Width: | Height: | Size: 22 KiB After Width: | Height: | Size: 22 KiB |
|
Before Width: | Height: | Size: 2.6 KiB |
@ -1,4 +0,0 @@
|
|||||||
7 7 storageroom
|
|
||||||
34 86 1 0 0 3 3
|
|
||||||
monster.png
|
|
||||||
storageroombattle
|
|
||||||
BIN
src/main/resources/characters/monster/monster-battle.png
Normal file
|
After Width: | Height: | Size: 1.7 KiB |
BIN
src/main/resources/characters/monster/monster.png
Normal file
|
After Width: | Height: | Size: 12 KiB |
4
src/main/resources/characters/monster/monster.txt
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
7 7 storageroom
|
||||||
|
30 79 1 0 20 2 2
|
||||||
|
monster.png
|
||||||
|
storageroombattle
|
||||||
|
Before Width: | Height: | Size: 13 KiB |
|
Before Width: | Height: | Size: 1.9 KiB |
|
Before Width: | Height: | Size: 1.4 KiB |
|
Before Width: | Height: | Size: 21 KiB After Width: | Height: | Size: 21 KiB |
BIN
src/main/resources/foregrounds/battle1.png
Normal file
|
After Width: | Height: | Size: 107 KiB |
BIN
src/main/resources/foregrounds/battle2.png
Normal file
|
After Width: | Height: | Size: 120 KiB |
|
Before Width: | Height: | Size: 155 KiB After Width: | Height: | Size: 155 KiB |
|
Before Width: | Height: | Size: 156 KiB After Width: | Height: | Size: 156 KiB |
|
Before Width: | Height: | Size: 158 KiB After Width: | Height: | Size: 158 KiB |
|
Before Width: | Height: | Size: 202 KiB After Width: | Height: | Size: 202 KiB |
|
Before Width: | Height: | Size: 222 KiB After Width: | Height: | Size: 222 KiB |
@ -74,7 +74,7 @@
|
|||||||
<trigger>
|
<trigger>
|
||||||
<x>6</x>
|
<x>6</x>
|
||||||
<y>2</y>
|
<y>2</y>
|
||||||
<active>false</active>
|
<active>true</active>
|
||||||
</trigger>
|
</trigger>
|
||||||
</events>
|
</events>
|
||||||
</map>
|
</map>
|
||||||
|
|||||||
@ -2,5 +2,5 @@
|
|||||||
<map>storageroom</map>
|
<map>storageroom</map>
|
||||||
<x>6</x>
|
<x>6</x>
|
||||||
<y>2</y>
|
<y>2</y>
|
||||||
<direction>0</direction>
|
<direction>1</direction>
|
||||||
</location>
|
</location>
|
||||||