fix of git(hopefully)
This commit is contained in:
commit
0abfc905e6
10
millennium-legacy/.classpath
Normal file
10
millennium-legacy/.classpath
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<classpath>
|
||||||
|
<classpathentry kind="src" path="src"/>
|
||||||
|
<<<<<<< HEAD
|
||||||
|
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>
|
||||||
|
=======
|
||||||
|
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7"/>
|
||||||
|
>>>>>>> 02c13080666632aea0bc8fa372361e43e18af2ef
|
||||||
|
<classpathentry kind="output" path="bin"/>
|
||||||
|
</classpath>
|
||||||
21
millennium-legacy/.project
Normal file
21
millennium-legacy/.project
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<projectDescription>
|
||||||
|
<<<<<<< HEAD
|
||||||
|
<name>EYS</name>
|
||||||
|
=======
|
||||||
|
<name>Millenium Legacy</name>
|
||||||
|
>>>>>>> 02c13080666632aea0bc8fa372361e43e18af2ef
|
||||||
|
<comment></comment>
|
||||||
|
<projects>
|
||||||
|
</projects>
|
||||||
|
<buildSpec>
|
||||||
|
<buildCommand>
|
||||||
|
<name>org.eclipse.jdt.core.javabuilder</name>
|
||||||
|
<arguments>
|
||||||
|
</arguments>
|
||||||
|
</buildCommand>
|
||||||
|
</buildSpec>
|
||||||
|
<natures>
|
||||||
|
<nature>org.eclipse.jdt.core.javanature</nature>
|
||||||
|
</natures>
|
||||||
|
</projectDescription>
|
||||||
21
millennium-legacy/.settings/org.eclipse.jdt.core.prefs
Normal file
21
millennium-legacy/.settings/org.eclipse.jdt.core.prefs
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
eclipse.preferences.version=1
|
||||||
|
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
|
||||||
|
<<<<<<< HEAD
|
||||||
|
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
|
||||||
|
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
|
||||||
|
org.eclipse.jdt.core.compiler.compliance=1.8
|
||||||
|
=======
|
||||||
|
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7
|
||||||
|
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
|
||||||
|
org.eclipse.jdt.core.compiler.compliance=1.7
|
||||||
|
>>>>>>> 02c13080666632aea0bc8fa372361e43e18af2ef
|
||||||
|
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
|
||||||
|
org.eclipse.jdt.core.compiler.debug.localVariable=generate
|
||||||
|
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
|
||||||
|
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
|
||||||
|
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
|
||||||
|
<<<<<<< HEAD
|
||||||
|
org.eclipse.jdt.core.compiler.source=1.8
|
||||||
|
=======
|
||||||
|
org.eclipse.jdt.core.compiler.source=1.7
|
||||||
|
>>>>>>> 02c13080666632aea0bc8fa372361e43e18af2ef
|
||||||
1
millennium-legacy/README.md
Normal file
1
millennium-legacy/README.md
Normal file
@ -0,0 +1 @@
|
|||||||
|
hi
|
||||||
16
millennium-legacy/bin/map.txt
Normal file
16
millennium-legacy/bin/map.txt
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
ggggggggggggggggggggggg
|
||||||
|
wwwwwwwwwwwwwwwwwwwwwww
|
||||||
|
ggggggggggggggggggggggg
|
||||||
|
wwwwwwwwwwwwwwwwwwwwwww
|
||||||
|
ggggggggggggggggggggggg
|
||||||
|
wwwwwwwwwwwwwwwwwwwwwww
|
||||||
|
ggggggggggggggggggggggg
|
||||||
|
wwwwwwwwwwwwwwwwwwwwwww
|
||||||
|
ggggggggggggggggggggggg
|
||||||
|
wwwwwwwwwwwwwwwwwwwwwww
|
||||||
|
ggggggggggggggggggggggg
|
||||||
|
wwwwwwwwwwwwwwwwwwwwwww
|
||||||
|
ggggggggggggggggggggggg
|
||||||
|
wwwwwwwwwwwwwwwwwwwwwww
|
||||||
|
ggggggggggggggggggggggg
|
||||||
|
wwwwwwwwwwwwwwwwwwwwwww
|
||||||
BIN
millennium-legacy/bin/milleniumlegacy/Algorithm.class
Normal file
BIN
millennium-legacy/bin/milleniumlegacy/Algorithm.class
Normal file
Binary file not shown.
BIN
millennium-legacy/bin/milleniumlegacy/GUI.class
Normal file
BIN
millennium-legacy/bin/milleniumlegacy/GUI.class
Normal file
Binary file not shown.
BIN
millennium-legacy/bin/milleniumlegacy/ImageLoader.class
Normal file
BIN
millennium-legacy/bin/milleniumlegacy/ImageLoader.class
Normal file
Binary file not shown.
BIN
millennium-legacy/bin/milleniumlegacy/Item.class
Normal file
BIN
millennium-legacy/bin/milleniumlegacy/Item.class
Normal file
Binary file not shown.
BIN
millennium-legacy/bin/milleniumlegacy/KeyManager.class
Normal file
BIN
millennium-legacy/bin/milleniumlegacy/KeyManager.class
Normal file
Binary file not shown.
BIN
millennium-legacy/bin/milleniumlegacy/MainGame.class
Normal file
BIN
millennium-legacy/bin/milleniumlegacy/MainGame.class
Normal file
Binary file not shown.
BIN
millennium-legacy/bin/milleniumlegacy/Map.class
Normal file
BIN
millennium-legacy/bin/milleniumlegacy/Map.class
Normal file
Binary file not shown.
BIN
millennium-legacy/bin/milleniumlegacy/MapLoader.class
Normal file
BIN
millennium-legacy/bin/milleniumlegacy/MapLoader.class
Normal file
Binary file not shown.
BIN
millennium-legacy/bin/milleniumlegacy/OptionsPane.class
Normal file
BIN
millennium-legacy/bin/milleniumlegacy/OptionsPane.class
Normal file
Binary file not shown.
BIN
millennium-legacy/bin/milleniumlegacy/Tile.class
Normal file
BIN
millennium-legacy/bin/milleniumlegacy/Tile.class
Normal file
Binary file not shown.
BIN
millennium-legacy/bin/milleniumlegacy/player.class
Normal file
BIN
millennium-legacy/bin/milleniumlegacy/player.class
Normal file
Binary file not shown.
BIN
millennium-legacy/resources/sprites/player.png
Normal file
BIN
millennium-legacy/resources/sprites/player.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 440 B |
BIN
millennium-legacy/resources/textures/grass.png
Normal file
BIN
millennium-legacy/resources/textures/grass.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 179 B |
16
millennium-legacy/src/map.txt
Normal file
16
millennium-legacy/src/map.txt
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
ggggggggggggggggggggggg
|
||||||
|
wwwwwwwwwwwwwwwwwwwwwww
|
||||||
|
ggggggggggggggggggggggg
|
||||||
|
wwwwwwwwwwwwwwwwwwwwwww
|
||||||
|
ggggggggggggggggggggggg
|
||||||
|
wwwwwwwwwwwwwwwwwwwwwww
|
||||||
|
ggggggggggggggggggggggg
|
||||||
|
wwwwwwwwwwwwwwwwwwwwwww
|
||||||
|
ggggggggggggggggggggggg
|
||||||
|
wwwwwwwwwwwwwwwwwwwwwww
|
||||||
|
ggggggggggggggggggggggg
|
||||||
|
wwwwwwwwwwwwwwwwwwwwwww
|
||||||
|
ggggggggggggggggggggggg
|
||||||
|
wwwwwwwwwwwwwwwwwwwwwww
|
||||||
|
ggggggggggggggggggggggg
|
||||||
|
wwwwwwwwwwwwwwwwwwwwwww
|
||||||
35
millennium-legacy/src/milleniumlegacy/Algorithm.java
Normal file
35
millennium-legacy/src/milleniumlegacy/Algorithm.java
Normal file
@ -0,0 +1,35 @@
|
|||||||
|
package milleniumlegacy;
|
||||||
|
|
||||||
|
|
||||||
|
public class Algorithm {
|
||||||
|
|
||||||
|
public static String research() {
|
||||||
|
String[] pSelect1 = Item.items.get(1); //1 = player input
|
||||||
|
String[] pSelect2 = Item.items.get(2); //2 = second player input
|
||||||
|
Object[] keyArray = Item.items.keySet().toArray();
|
||||||
|
String Num1 = pSelect1[0];
|
||||||
|
String Num2 = pSelect2[0];
|
||||||
|
String Name1 = pSelect1[1];
|
||||||
|
String Name2 = pSelect2[1];
|
||||||
|
String TP1 = pSelect1[2];
|
||||||
|
String TP2 = pSelect2[2];
|
||||||
|
for(int i = 1; i <= keyArray.length;i++) {
|
||||||
|
String[] Craftable = Item.items.get(i);
|
||||||
|
String Craft1 = Craftable[4];
|
||||||
|
String Craft2 = Craftable[5];
|
||||||
|
if ((Craft1.equals(Name1) || Craft2.equals(Name2)) &&
|
||||||
|
(Craft1.equals(Name2) || Craft2.equals(Name1))) {
|
||||||
|
String[] getNewItem = Item.items.get(i);
|
||||||
|
//TODO
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
int rand = (int)(Math.random() * (100));
|
||||||
|
int Prob = rand;
|
||||||
|
|
||||||
|
return Name2;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
52
millennium-legacy/src/milleniumlegacy/GUI.java
Normal file
52
millennium-legacy/src/milleniumlegacy/GUI.java
Normal file
@ -0,0 +1,52 @@
|
|||||||
|
package milleniumlegacy;
|
||||||
|
|
||||||
|
<<<<<<< HEAD
|
||||||
|
import java.awt.Component;
|
||||||
|
import java.awt.Graphics;
|
||||||
|
import java.util.HashMap;
|
||||||
|
|
||||||
|
import javax.imageio.ImageIO;
|
||||||
|
=======
|
||||||
|
>>>>>>> 357779b2c6cc94e69241d389a64fa3959453599f
|
||||||
|
import javax.swing.*;
|
||||||
|
|
||||||
|
public class GUI {
|
||||||
|
|
||||||
|
public static void main(String[] args) {
|
||||||
|
<<<<<<< HEAD
|
||||||
|
JFrame f = new JFrame("Millenium Legacy");
|
||||||
|
f.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
|
||||||
|
f.setContentPane(new JPanel() {
|
||||||
|
public void paintComponent(Graphics g) {
|
||||||
|
super.paintComponent(g);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
f.setResizable(false);
|
||||||
|
f.pack();
|
||||||
|
f.setSize(825, 625);
|
||||||
|
f.setVisible(true);
|
||||||
|
Algorithm.research();
|
||||||
|
=======
|
||||||
|
SwingUtilities.invokeLater(new Runnable() {
|
||||||
|
public void run() {
|
||||||
|
createAndShowGUI();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
public static void createAndShowGUI()
|
||||||
|
{
|
||||||
|
JFrame f = new JFrame("Millenium Legacy");
|
||||||
|
MainGame draw = new MainGame();
|
||||||
|
f.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
|
||||||
|
f.getContentPane().add(draw);
|
||||||
|
f.setResizable(false);
|
||||||
|
f.pack();
|
||||||
|
f.setSize(825, 625);
|
||||||
|
f.setVisible(true);
|
||||||
|
draw.start();
|
||||||
|
>>>>>>> 357779b2c6cc94e69241d389a64fa3959453599f
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
21
millennium-legacy/src/milleniumlegacy/ImageLoader.java
Normal file
21
millennium-legacy/src/milleniumlegacy/ImageLoader.java
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
package milleniumlegacy;
|
||||||
|
|
||||||
|
import java.awt.image.BufferedImage;
|
||||||
|
import java.io.IOException;
|
||||||
|
|
||||||
|
import javax.imageio.ImageIO;
|
||||||
|
|
||||||
|
public class ImageLoader
|
||||||
|
{
|
||||||
|
public BufferedImage loadImage (String path)
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
BufferedImage bi = ImageIO.read(getClass().getResourceAsStream(path));
|
||||||
|
return bi;
|
||||||
|
} catch (IOException e) {
|
||||||
|
System.out.println("Error loading Image");
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
16
millennium-legacy/src/milleniumlegacy/Item.java
Normal file
16
millennium-legacy/src/milleniumlegacy/Item.java
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
package milleniumlegacy;
|
||||||
|
import java.util.*;
|
||||||
|
|
||||||
|
public class Item {
|
||||||
|
|
||||||
|
public static final Map<Integer, String[]> items;
|
||||||
|
static
|
||||||
|
{
|
||||||
|
//Putting items
|
||||||
|
items = new HashMap<Integer, String[]>();
|
||||||
|
items.put(1, new String[] {"1","Dirt", "Universal"});
|
||||||
|
items.put(2, new String[] {"2","Water","Universal"});
|
||||||
|
items.put(3, new String[] {"3","Clay","Medieval", "99"});
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
58
millennium-legacy/src/milleniumlegacy/KeyManager.java
Normal file
58
millennium-legacy/src/milleniumlegacy/KeyManager.java
Normal file
@ -0,0 +1,58 @@
|
|||||||
|
package milleniumlegacy;
|
||||||
|
|
||||||
|
import java.awt.event.KeyEvent;
|
||||||
|
import java.awt.event.KeyListener;
|
||||||
|
|
||||||
|
public class KeyManager implements KeyListener
|
||||||
|
{
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void keyPressed(KeyEvent e)
|
||||||
|
{
|
||||||
|
if (e.getKeyCode() == KeyEvent.VK_W)
|
||||||
|
{
|
||||||
|
MainGame.up = true;
|
||||||
|
}
|
||||||
|
if (e.getKeyCode() == KeyEvent.VK_S)
|
||||||
|
{
|
||||||
|
MainGame.down = true;
|
||||||
|
}
|
||||||
|
if (e.getKeyCode() == KeyEvent.VK_A)
|
||||||
|
{
|
||||||
|
MainGame.left = true;
|
||||||
|
}
|
||||||
|
if (e.getKeyCode() == KeyEvent.VK_D)
|
||||||
|
{
|
||||||
|
MainGame.right = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void keyReleased(KeyEvent e)
|
||||||
|
{
|
||||||
|
if (e.getKeyCode() == KeyEvent.VK_W)
|
||||||
|
{
|
||||||
|
MainGame.up = false;
|
||||||
|
}
|
||||||
|
if (e.getKeyCode() == KeyEvent.VK_S)
|
||||||
|
{
|
||||||
|
MainGame.down = false;
|
||||||
|
}
|
||||||
|
if (e.getKeyCode() == KeyEvent.VK_A)
|
||||||
|
{
|
||||||
|
MainGame.left = false;
|
||||||
|
}
|
||||||
|
if (e.getKeyCode() == KeyEvent.VK_D)
|
||||||
|
{
|
||||||
|
MainGame.right = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void keyTyped(KeyEvent arg0) {
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
82
millennium-legacy/src/milleniumlegacy/MainGame.java
Normal file
82
millennium-legacy/src/milleniumlegacy/MainGame.java
Normal file
@ -0,0 +1,82 @@
|
|||||||
|
package milleniumlegacy;
|
||||||
|
|
||||||
|
import java.awt.Canvas;
|
||||||
|
import java.awt.Color;
|
||||||
|
import java.awt.Graphics;
|
||||||
|
import java.awt.Toolkit;
|
||||||
|
import java.awt.image.BufferStrategy;
|
||||||
|
import java.awt.image.BufferedImage;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
|
||||||
|
public class MainGame extends Canvas implements Runnable
|
||||||
|
{
|
||||||
|
private static final long serialVersionUID = -1902119798739765822L;
|
||||||
|
ImageLoader IL = new ImageLoader();
|
||||||
|
BufferedImage player = IL.loadImage("Untitled.png");
|
||||||
|
KeyManager km;
|
||||||
|
ArrayList<Tile> map = Map.readyMap();
|
||||||
|
Thread main;
|
||||||
|
public static boolean up, down, left, right, running;
|
||||||
|
int offsetx, offsety;
|
||||||
|
public void init()
|
||||||
|
{
|
||||||
|
km = new KeyManager();
|
||||||
|
this.addKeyListener(km);
|
||||||
|
}
|
||||||
|
public void paintComponent()
|
||||||
|
{
|
||||||
|
BufferStrategy bs = this.getBufferStrategy();
|
||||||
|
if (bs == null)
|
||||||
|
{
|
||||||
|
createBufferStrategy(3);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
Graphics g = bs.getDrawGraphics();
|
||||||
|
g.setColor(Color.blue);
|
||||||
|
g.fillRect(0, 0, Toolkit.getDefaultToolkit().getScreenSize().width, Toolkit.getDefaultToolkit().getScreenSize().height);
|
||||||
|
g.setColor( Color.BLACK );
|
||||||
|
for (Tile t : map)
|
||||||
|
{
|
||||||
|
t.Render(g, offsetx, offsety);
|
||||||
|
}
|
||||||
|
g.drawImage(player, 200,300, null);
|
||||||
|
g.dispose();
|
||||||
|
bs.show();
|
||||||
|
}
|
||||||
|
public void tick()
|
||||||
|
{
|
||||||
|
if (up)
|
||||||
|
{
|
||||||
|
offsety++;
|
||||||
|
}
|
||||||
|
if (down)
|
||||||
|
{
|
||||||
|
offsety--;
|
||||||
|
}
|
||||||
|
if (left)
|
||||||
|
{
|
||||||
|
offsetx++;
|
||||||
|
}
|
||||||
|
if (right)
|
||||||
|
{
|
||||||
|
offsetx--;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public void start()
|
||||||
|
{
|
||||||
|
main = new Thread(this);
|
||||||
|
main.start();
|
||||||
|
running = true;
|
||||||
|
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
init();
|
||||||
|
while (running)
|
||||||
|
{
|
||||||
|
paintComponent();
|
||||||
|
tick();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
26
millennium-legacy/src/milleniumlegacy/Map.java
Normal file
26
millennium-legacy/src/milleniumlegacy/Map.java
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
package milleniumlegacy;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
|
||||||
|
public class Map
|
||||||
|
{
|
||||||
|
static MapLoader ml = new MapLoader();
|
||||||
|
public static ArrayList<Tile> readyMap()
|
||||||
|
{
|
||||||
|
ArrayList<Tile> tiles = new ArrayList<Tile>();
|
||||||
|
char[][] map = ml.LoadMap("map.txt");
|
||||||
|
int countery = 0, counterx = 0;
|
||||||
|
for (char[] chararr : map)
|
||||||
|
{
|
||||||
|
countery++;
|
||||||
|
for (char c: chararr)
|
||||||
|
{
|
||||||
|
counterx++;
|
||||||
|
System.out.println(counterx);
|
||||||
|
tiles.add(new Tile(counterx, countery, c));
|
||||||
|
}
|
||||||
|
counterx = 0;
|
||||||
|
}
|
||||||
|
return tiles;
|
||||||
|
}
|
||||||
|
}
|
||||||
64
millennium-legacy/src/milleniumlegacy/MapLoader.java
Normal file
64
millennium-legacy/src/milleniumlegacy/MapLoader.java
Normal file
@ -0,0 +1,64 @@
|
|||||||
|
package milleniumlegacy;
|
||||||
|
|
||||||
|
import java.io.BufferedInputStream;
|
||||||
|
import java.io.BufferedReader;
|
||||||
|
import java.io.File;
|
||||||
|
import java.io.FileInputStream;
|
||||||
|
import java.io.FileReader;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.io.InputStream;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
|
||||||
|
public class MapLoader {
|
||||||
|
|
||||||
|
public char[][] LoadMap(String path) {
|
||||||
|
ArrayList<String> lines = new ArrayList<String>();
|
||||||
|
BufferedReader br;
|
||||||
|
File map = new File(path);
|
||||||
|
|
||||||
|
try {
|
||||||
|
FileReader fr = new FileReader(map);
|
||||||
|
br = new BufferedReader(fr);
|
||||||
|
String line;
|
||||||
|
while ((line = br.readLine()) != null)
|
||||||
|
{
|
||||||
|
lines.add(line);
|
||||||
|
}
|
||||||
|
char[][] maparr = new char[lines.size()][lines.get(0).toCharArray().length];
|
||||||
|
for (int y = 0; y <= lines.size() - 1; y++)
|
||||||
|
{
|
||||||
|
char[] chararr = lines.get(y).toCharArray();
|
||||||
|
for (int x = 0; x <= lines.get(0).toCharArray().length - 1; x++)
|
||||||
|
{
|
||||||
|
System.out.println("X: " + x + "Y: " + y);
|
||||||
|
maparr[y][x] = lines.get(y).toCharArray()[x];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
br.close();
|
||||||
|
return maparr;
|
||||||
|
} catch (IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
public static int countLines(String filename) throws IOException {
|
||||||
|
InputStream is = new BufferedInputStream(new FileInputStream(filename));
|
||||||
|
try {
|
||||||
|
byte[] c = new byte[1024];
|
||||||
|
int count = 0;
|
||||||
|
int readChars = 0;
|
||||||
|
boolean empty = true;
|
||||||
|
while ((readChars = is.read(c)) != -1) {
|
||||||
|
empty = false;
|
||||||
|
for (int i = 0; i < readChars; ++i) {
|
||||||
|
if (c[i] == '\n') {
|
||||||
|
++count;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return (count == 0 && !empty) ? 1 : count;
|
||||||
|
} finally {
|
||||||
|
is.close();
|
||||||
|
}
|
||||||
|
} // Thank you google
|
||||||
|
}
|
||||||
5
millennium-legacy/src/milleniumlegacy/OptionsPane.java
Normal file
5
millennium-legacy/src/milleniumlegacy/OptionsPane.java
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
package milleniumlegacy;
|
||||||
|
|
||||||
|
public class OptionsPane {
|
||||||
|
|
||||||
|
}
|
||||||
31
millennium-legacy/src/milleniumlegacy/Tile.java
Normal file
31
millennium-legacy/src/milleniumlegacy/Tile.java
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
package milleniumlegacy;
|
||||||
|
|
||||||
|
import java.awt.Color;
|
||||||
|
import java.awt.Graphics;
|
||||||
|
|
||||||
|
public class Tile
|
||||||
|
{
|
||||||
|
int x,y;
|
||||||
|
char terrain;
|
||||||
|
boolean up, down, left, right;
|
||||||
|
int offsetx;
|
||||||
|
int offsety;
|
||||||
|
public Tile(int x, int y, char terrain)
|
||||||
|
{
|
||||||
|
this.x = x;
|
||||||
|
this.y = y;
|
||||||
|
this.terrain = terrain;
|
||||||
|
}
|
||||||
|
public void Render(Graphics g, int offsetx, int offsety)
|
||||||
|
{
|
||||||
|
if (terrain == 'g')
|
||||||
|
{
|
||||||
|
g.setColor(Color.GREEN);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
g.setColor(Color.BLUE);
|
||||||
|
}
|
||||||
|
g.fillRect(x*16 + offsetx, y*16 + offsety, 16,16);
|
||||||
|
}
|
||||||
|
}
|
||||||
20
millennium-legacy/src/milleniumlegacy/player.java
Normal file
20
millennium-legacy/src/milleniumlegacy/player.java
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
package milleniumlegacy;
|
||||||
|
|
||||||
|
import java.awt.Graphics;
|
||||||
|
import java.awt.image.BufferedImage;
|
||||||
|
|
||||||
|
public class player
|
||||||
|
{
|
||||||
|
int x, y;
|
||||||
|
BufferedImage player;
|
||||||
|
public player(int x, int y, ImageLoader IL)
|
||||||
|
{
|
||||||
|
this.x = x;
|
||||||
|
this.y = y;
|
||||||
|
player = IL.loadImage("Untitled.png");
|
||||||
|
}
|
||||||
|
public void render(Graphics g)
|
||||||
|
{
|
||||||
|
g.drawImage(player, x, y, null);
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
x
Reference in New Issue
Block a user