Starting of creating battle module

This commit is contained in:
iryupnik 2020-04-16 16:19:35 +02:00
parent 22b177ca57
commit 93faa22b9b
14 changed files with 90 additions and 110 deletions

View File

@ -0,0 +1,4 @@
package ruscz.game.gameOfProd.Battle;
public class Battle {
}

View File

@ -0,0 +1,4 @@
package ruscz.game.gameOfProd.Battle;
public class BattlePerson {
}

View File

@ -0,0 +1,4 @@
package ruscz.game.gameOfProd.Battle;
public class Enemy extends BattlePerson {
}

View File

@ -0,0 +1,4 @@
package ruscz.game.gameOfProd.Battle;
public class Hero extends BattlePerson {
}

View File

@ -0,0 +1,17 @@
package ruscz.game.gameOfProd.Cells;
import ruscz.game.gameOfProd.Game;
import ruscz.game.gameOfProd.Windows.WindowOfFreeMove;
import java.awt.*;
public class RandomEncounterCell extends Cell {
private final int level;
private final Game game;
public RandomEncounterCell(int x, int y, int lvl, Game game) {
super(x, y, WindowOfFreeMove.CELL_SIZE, Color.pink);
this.level = lvl;
this.game = game;
}
}

View File

@ -0,0 +1,6 @@
package ruscz.game.gameOfProd.Dialog;
import javax.swing.*;
public class MenuBar extends JPanel {
}

View File

@ -1,13 +1,11 @@
package ruscz.game.gameOfProd;
import ruscz.game.gameOfProd.Windows.WindowOfBattle;
import ruscz.game.gameOfProd.Windows.WindowOfFreeMove;
import ruscz.game.gameOfProd.Windows.WindowOfMenu;
import javax.swing.*;
import java.awt.*;
import java.awt.event.KeyAdapter;
import java.awt.event.KeyEvent;
import java.awt.event.KeyListener;
import java.awt.event.WindowEvent;
import java.awt.image.BufferedImage;
public class Game extends JFrame {
private static final int WINDOW_WIDTH = 13;
@ -16,6 +14,19 @@ public class Game extends JFrame {
private WindowOfMenu menu;
private WindowOfFreeMove freeMove;
private WindowOfBattle battle;
public WindowOfMenu getMenu() {
return menu;
}
public WindowOfFreeMove getFreeMove() {
return freeMove;
}
public WindowOfBattle getBattle() {
return battle;
}
public static void main(String[] args) {
new Game();
@ -23,7 +34,8 @@ public class Game extends JFrame {
public Game() {
freeMove = new WindowOfFreeMove(this);
menu = new WindowOfMenu(this, freeMove);
menu = new WindowOfMenu(this);
battle = new WindowOfBattle(this);
//tohle spustí na začátku menu
add(menu);
@ -40,8 +52,6 @@ public class Game extends JFrame {
setVisible(true);
getContentPane().setBackground(Color.BLACK);
setExtendedState(MAXIMIZED_BOTH);
getContentPane().getComponent(0).setLocation((Toolkit.getDefaultToolkit().getScreenSize().width - (WINDOW_WIDTH * CELL_SIZE)) / 2, (Toolkit.getDefaultToolkit().getScreenSize().height - (WINDOW_HEIGHT * CELL_SIZE)) / 2);
getContentPane().getComponent(0).setSize(WINDOW_WIDTH * CELL_SIZE, WINDOW_HEIGHT * CELL_SIZE);
}
public Game game() {return this;}

View File

@ -0,0 +1,23 @@
package ruscz.game.gameOfProd.Windows;
import ruscz.game.gameOfProd.Game;
import javax.swing.*;
import java.awt.*;
public class WindowOfBattle {
private Canvas canvas;
public WindowOfBattle(Game game) {
canvas = new Canvas();
}
class Canvas extends JPanel {
@Override
public void paint(Graphics g) {
}
}
}

View File

@ -1,25 +1,26 @@
package ruscz.game.gameOfProd.Windows;
import ruscz.game.gameOfProd.Game;
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
import java.awt.image.BufferedImage;
import java.sql.Time;
public class WindowOfMenu extends JLayeredPane {
public static final int WINDOW_WIDTH = 13;
public static final int WINDOW_HEIGHT = 13;
public static final int CELL_SIZE = 50;
private JFrame game;
private Game game;
private WindowOfFreeMove freeMove;
private JButton startNewGame;
private JButton loadSavedGame;
private JButton exitGame;
public WindowOfMenu(JFrame game, WindowOfFreeMove freeMove) {
public WindowOfMenu(Game game) {
this.game = game;
this.freeMove = freeMove;
this.freeMove = game.getFreeMove();
startNewGame = new JButton("START NEW GAME");
//startNewGame.setFocusable(false);
@ -49,6 +50,7 @@ public class WindowOfMenu extends JLayeredPane {
add(loadSavedGame);
add(exitGame);
}
private void cleanUp() {
setVisible(false);
startNewGame.removeActionListener(startNewGame.getActionListeners()[0]);

View File

@ -0,0 +1,3 @@
Manifest-Version: 1.0
Main-Class: ruscz.game.gameOfProd.Game

View File

@ -2,7 +2,7 @@
<wait>
<image> boss-face.png
Oh, hi Mark.
I know, this is on very short notice<br/>but as you've probably heard,<br/>we kinda need someone on the Game of Prod.
I know, this is on very short notice<br/>but as you've probably heard,<br/>we kinda need someone on the ruscz.game.gameOfProd.Game of Prod.
And that someone is gonna be,<br/>you guessed it, you. You start by tomorrow.
You can go now.
Bye.

View File

@ -1,90 +0,0 @@
<map>
<mapName>m1</mapName>
<events>
</events>
</map>
<map>
<mapName>m2</mapName>
<events>
<trigger>
<x>7</x>
<y>2</y>
<active>true</active>
</trigger>
</events>
</map>
<map>
<mapName>m3</mapName>
<events>
<trigger>
<x>2</x>
<y>5</y>
<active>true</active>
</trigger>
</events>
</map>
<map>
<mapName>m4</mapName>
<events>
<trigger>
<x>3</x>
<y>3</y>
<active>true</active>
</trigger>
</events>
</map>
<map>
<mapName>m6</mapName>
<events>
<trigger>
<x>11</x>
<y>11</y>
<active>true</active>
</trigger>
</events>
</map>
<map>
<mapName>tutorial</mapName>
<events>
</events>
</map>
<map>
<mapName>openspace</mapName>
<events>
<trigger>
<x>7</x>
<y>4</y>
<active>true</active>
</trigger>
<chest>
<x>15</x>
<y>7</y>
<active>true</active>
</chest>
</events>
</map>
<map>
<mapName>office</mapName>
<events>
<chest>
<x>1</x>
<y>9</y>
<active>true</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>
</events>
</map>

View File

@ -1,6 +0,0 @@
<location>
<map>boss</map>
<x>4</x>
<y>18</y>
<direction>2</direction>
</location>

View File

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