code day done
2
millennium-legacy/.classpath
Executable file → Normal file
@ -1,6 +1,6 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<classpath>
|
<classpath>
|
||||||
<classpathentry kind="src" path="src"/>
|
<classpathentry kind="src" path="src"/>
|
||||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7"/>
|
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>
|
||||||
<classpathentry kind="output" path="bin"/>
|
<classpathentry kind="output" path="bin"/>
|
||||||
</classpath>
|
</classpath>
|
||||||
|
|||||||
2
millennium-legacy/.project
Executable file → Normal file
@ -1,6 +1,6 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<projectDescription>
|
<projectDescription>
|
||||||
<name>millennium-legacy</name>
|
<name>EYSnotBroken</name>
|
||||||
<comment></comment>
|
<comment></comment>
|
||||||
<projects>
|
<projects>
|
||||||
</projects>
|
</projects>
|
||||||
|
|||||||
6
millennium-legacy/.settings/org.eclipse.jdt.core.prefs
Executable file → Normal file
@ -1,11 +1,11 @@
|
|||||||
eclipse.preferences.version=1
|
eclipse.preferences.version=1
|
||||||
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
|
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
|
||||||
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7
|
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
|
||||||
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
|
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
|
||||||
org.eclipse.jdt.core.compiler.compliance=1.7
|
org.eclipse.jdt.core.compiler.compliance=1.8
|
||||||
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
|
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
|
||||||
org.eclipse.jdt.core.compiler.debug.localVariable=generate
|
org.eclipse.jdt.core.compiler.debug.localVariable=generate
|
||||||
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
|
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
|
||||||
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
|
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
|
||||||
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
|
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
|
||||||
org.eclipse.jdt.core.compiler.source=1.7
|
org.eclipse.jdt.core.compiler.source=1.8
|
||||||
|
|||||||
0
millennium-legacy/README.md
Executable file → Normal file
BIN
millennium-legacy/WorldGenerator.exe
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
Executable file → Normal file
BIN
millennium-legacy/bin/milleniumlegacy/Animation.class
Normal file
BIN
millennium-legacy/bin/milleniumlegacy/Button.class
Normal file
BIN
millennium-legacy/bin/milleniumlegacy/ClanHandler.class
Normal file
BIN
millennium-legacy/bin/milleniumlegacy/GUI$1.class
Executable file → Normal file
BIN
millennium-legacy/bin/milleniumlegacy/GUI.class
Executable file → Normal file
BIN
millennium-legacy/bin/milleniumlegacy/ImageHandler.class
Normal file
BIN
millennium-legacy/bin/milleniumlegacy/ImageLoader.class
Executable file → Normal file
BIN
millennium-legacy/bin/milleniumlegacy/Inventory.class
Normal file
BIN
millennium-legacy/bin/milleniumlegacy/Item.class
Executable file → Normal file
BIN
millennium-legacy/bin/milleniumlegacy/KeyManager.class
Executable file → Normal file
BIN
millennium-legacy/bin/milleniumlegacy/MapLoader.class
Executable file → Normal file
BIN
millennium-legacy/bin/milleniumlegacy/MouseManager.class
Normal file
BIN
millennium-legacy/bin/milleniumlegacy/OptionsPane.class
Executable file → Normal file
BIN
millennium-legacy/bin/milleniumlegacy/Research.class
Normal file
BIN
millennium-legacy/bin/milleniumlegacy/SolidTile.class
Normal file
100
millennium-legacy/milleniumWorld.txt
Normal file
@ -0,0 +1,100 @@
|
|||||||
|
---------------------g-------------------------------------------------------------------------www--
|
||||||
|
---------------------rr-----------------------------------------------------------------------wwwww-
|
||||||
|
--------------------rrr---------------------www-----------------------------------------------wwwww-
|
||||||
|
--------------------rr---------------------wwwww----------rr----------------------------------wwwww-
|
||||||
|
--------------------gr---------------------wwwww----------rr-----------------------------------www--
|
||||||
|
-------------------------------------------wwwww---------grr----------------------------------------
|
||||||
|
--------------------------------------------wwwcc---------------------------------------------------
|
||||||
|
-----------------------------------------------c----------------------------------------------------
|
||||||
|
----------------------------------------------------------------------------------------------------
|
||||||
|
----------------------------------------------------------------------------------------------------
|
||||||
|
----------------------------------------------------------------------------------------------------
|
||||||
|
----------------------------------------------------------------------------------------------------
|
||||||
|
--------------------------------------------c-------------------------------------------------------
|
||||||
|
-------------------------------------------ccwww----------------------------------------------------
|
||||||
|
--------------------------------------------wwwww---------------------------------------------------
|
||||||
|
--------------------------------------------wwwww---------------------------------------------------
|
||||||
|
--------------------------------------------wwwww---------------------------------------------------
|
||||||
|
---------------------------------------------www----------------------------------------------------
|
||||||
|
----------------------------------------------------------------------------------------------------
|
||||||
|
-----rr---------------------------------------------------------------------------------------------
|
||||||
|
-------r--------------------------------------------------------------------------------------------
|
||||||
|
----------------------------------------------------------------------------------------------------
|
||||||
|
----------------------------------------------------------------------------------------c-www-------
|
||||||
|
---------------------------------------------------------------------------------------ccwwwww------
|
||||||
|
----------------------------------------------------------------------------------------cwwwww------
|
||||||
|
-----------------------------------------------------------------------------------------wwwww------
|
||||||
|
------------------------------------------------------------------------------------------www-------
|
||||||
|
---------------------------------------------g------------------------------------------------------
|
||||||
|
---------------------------------------------rr----------www----------------------------------------
|
||||||
|
----------------------------------------------rr--------wwwwwc--------------www---------------------
|
||||||
|
--------------------------------------------grr---------wwwwwcc------------wwwww--------------------
|
||||||
|
--------------------------------------------------------wwwwwc------------cwwwww--------------------
|
||||||
|
---------------------------------------------------------www-------------ccwwwww--------------------
|
||||||
|
--------------------------------------------------------------------------c-www---------------------
|
||||||
|
----------------------------------------------------------------------------------------------------
|
||||||
|
------------------------------------------------------------------------g---------------------------
|
||||||
|
------------------------------------------------------------------------rr--------------------------
|
||||||
|
-----------------------------------------------------------------------rrg--------------------------
|
||||||
|
-----------------------------------------------------------------------grr--------------------------
|
||||||
|
---------------------------------------------rg-----------------------------------------------------
|
||||||
|
-------------------------------------------grrr-----------------------------------------------------
|
||||||
|
-------------------------------------------grr------------------------------------------------------
|
||||||
|
----------------------------------------------------------------------------------------------------
|
||||||
|
----------------------------------------------------------------------------------------------------
|
||||||
|
------------------------------------------------------------------------------rrrg------------------
|
||||||
|
-------------------------------------------------------r----------------------rrg-------------------
|
||||||
|
-----------------------------------------------------grrr---------------------grr-------------------
|
||||||
|
-------------------------------------------rr--------grrrg------------------------------------------
|
||||||
|
-------------------------------------------rr----------g--------------------------------------------
|
||||||
|
rr-----------------------------------------rr-------------------------------------------------------
|
||||||
|
rrr----------www------------------------------------------------------------------------------------
|
||||||
|
-rg---------wwwww-----------------------------------------------------------------------------------
|
||||||
|
-g---------cwwwww-----------------------------------------------------------------------------------
|
||||||
|
----------ccwwwww-----------------------------------------------------------------------------------
|
||||||
|
-----------ccwww------------------------------------------------------------------------------------
|
||||||
|
------------c---------------------------------------------------------------------------------------
|
||||||
|
----------------------------------------------------------------------------------------------------
|
||||||
|
----------------------------------------------------------------------------------------------------
|
||||||
|
----------rrr---------------------------------------------------------------------------------------
|
||||||
|
----------rrr------------------rrr------------------------------------------------------------------
|
||||||
|
----------rrr-----------------wrrrw-----------------------------------------------------------------
|
||||||
|
------------g-----------------wwrrw-----------------------------------------------------------------
|
||||||
|
------------------------------wwwww-----------------------------------------------------------------
|
||||||
|
-------------------------------www------------------------------------------------------------------
|
||||||
|
----------------------------------------------------------------------------------------------------
|
||||||
|
----------------------------------------------------------------------------------------------------
|
||||||
|
---------------------------------------------------c------------------------------------------------
|
||||||
|
------------------------------------------------wwwcc-----------------------------------------------
|
||||||
|
-----------------------------------------------wwwwwc-----------------------------------------------
|
||||||
|
-----------------------------------------------wwwwwcc----------------------------------------------
|
||||||
|
-----------------------------------------------wwwwwc-----------------------------------------------
|
||||||
|
------------------------------------------------www-------------------------------------------------
|
||||||
|
----------------------------------------------------------------------------------------------------
|
||||||
|
----------------------------------------------------------------------------------------------------
|
||||||
|
----------------------------------------------------------------------------------------------------
|
||||||
|
----------------------------------------------------------------------------------------------------
|
||||||
|
----------------------------------------------------------------------------------------------------
|
||||||
|
----------------------------------------------------------------------------------------------------
|
||||||
|
----------------------------------------------------------------------------------------------------
|
||||||
|
----------------------------------------------------------------------------------------------------
|
||||||
|
----------------------------------------------------------------------------------------------------
|
||||||
|
------------------c----------------------------c-------------------c--------------------------------
|
||||||
|
-----------------gcg---------g------g---------ccc-----------------ccc-------g--g----c---------------
|
||||||
|
----gwwwww-----wwwww----gwwwww----gwwwww-----wwwww-----wwwwwg---gwwwww-----wwwww---ccwwwww-----wwwww
|
||||||
|
wwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwww
|
||||||
|
wwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwww
|
||||||
|
wwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwww
|
||||||
|
wwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwww
|
||||||
|
wwwwwg----wwwwwg-gggwwwww-----wwwwwcc---wwwww-----wwwww----gwwwww-g---wwwwwg----wwwww-----wwwwwg----
|
||||||
|
-----------------------------------c-----------------------ccg--------------------------------------
|
||||||
|
------------------------------------------------------------c---------------------------------------
|
||||||
|
----------------------------------------------------------------------------------------------------
|
||||||
|
----------------------------------------------------------------------------------------------------
|
||||||
|
----------------------------------------------------------------------------------------------------
|
||||||
|
----------------------------------------------------------------------------------------------------
|
||||||
|
----------------------------------------------------------------------------------------------------
|
||||||
|
----------------------------------------------------------------------------------------------------
|
||||||
|
-----------------------------------rr---------------------------------------------------------------
|
||||||
|
-----------------------------------grr--------------------------------------------------------------
|
||||||
|
-----------------------------------rrr--------------------------------------------------------------
|
||||||
BIN
millennium-legacy/resources/gui/hotbar.png
Normal file
|
After Width: | Height: | Size: 350 B |
BIN
millennium-legacy/resources/gui/research.png
Normal file
|
After Width: | Height: | Size: 4.1 KiB |
BIN
millennium-legacy/resources/sprites/arsenic.png
Normal file
|
After Width: | Height: | Size: 417 B |
BIN
millennium-legacy/resources/sprites/city.png
Normal file
|
After Width: | Height: | Size: 678 B |
BIN
millennium-legacy/resources/sprites/clay.png
Normal file
|
After Width: | Height: | Size: 444 B |
BIN
millennium-legacy/resources/sprites/dirt.png
Normal file
|
After Width: | Height: | Size: 696 B |
BIN
millennium-legacy/resources/sprites/electricity.png
Normal file
|
After Width: | Height: | Size: 369 B |
BIN
millennium-legacy/resources/sprites/fire.png
Normal file
|
After Width: | Height: | Size: 771 B |
BIN
millennium-legacy/resources/sprites/flower.png
Normal file
|
After Width: | Height: | Size: 618 B |
BIN
millennium-legacy/resources/sprites/food.png
Normal file
|
After Width: | Height: | Size: 585 B |
BIN
millennium-legacy/resources/sprites/fridge.png
Normal file
|
After Width: | Height: | Size: 492 B |
BIN
millennium-legacy/resources/sprites/garden.png
Normal file
|
After Width: | Height: | Size: 756 B |
BIN
millennium-legacy/resources/sprites/house.png
Normal file
|
After Width: | Height: | Size: 609 B |
BIN
millennium-legacy/resources/sprites/ice.png
Normal file
|
After Width: | Height: | Size: 486 B |
BIN
millennium-legacy/resources/sprites/iron.png
Normal file
|
After Width: | Height: | Size: 624 B |
BIN
millennium-legacy/resources/sprites/metal.png
Normal file
|
After Width: | Height: | Size: 624 B |
BIN
millennium-legacy/resources/sprites/plant.png
Normal file
|
After Width: | Height: | Size: 714 B |
BIN
millennium-legacy/resources/sprites/plastic.png
Normal file
|
After Width: | Height: | Size: 384 B |
0
millennium-legacy/resources/sprites/player.png
Executable file → Normal file
|
Before Width: | Height: | Size: 440 B After Width: | Height: | Size: 440 B |
BIN
millennium-legacy/resources/sprites/quantumcomputer.png
Normal file
|
After Width: | Height: | Size: 402 B |
BIN
millennium-legacy/resources/sprites/suburb.png
Normal file
|
After Width: | Height: | Size: 609 B |
BIN
millennium-legacy/resources/sprites/sugar.png
Normal file
|
After Width: | Height: | Size: 519 B |
BIN
millennium-legacy/resources/sprites/supercomputer.png
Normal file
|
After Width: | Height: | Size: 387 B |
BIN
millennium-legacy/resources/sprites/timemachine.png
Normal file
|
After Width: | Height: | Size: 825 B |
BIN
millennium-legacy/resources/sprites/water.png
Normal file
|
After Width: | Height: | Size: 555 B |
BIN
millennium-legacy/resources/textures/Water0.png
Normal file
|
After Width: | Height: | Size: 2.0 KiB |
BIN
millennium-legacy/resources/textures/Water1.png
Normal file
|
After Width: | Height: | Size: 1.9 KiB |
BIN
millennium-legacy/resources/textures/Water2.png
Normal file
|
After Width: | Height: | Size: 1.9 KiB |
BIN
millennium-legacy/resources/textures/Water3.png
Normal file
|
After Width: | Height: | Size: 1.9 KiB |
BIN
millennium-legacy/resources/textures/Water4.png
Normal file
|
After Width: | Height: | Size: 1.9 KiB |
BIN
millennium-legacy/resources/textures/Water5.png
Normal file
|
After Width: | Height: | Size: 2.0 KiB |
BIN
millennium-legacy/resources/textures/Water6.png
Normal file
|
After Width: | Height: | Size: 2.1 KiB |
BIN
millennium-legacy/resources/textures/Water7.png
Normal file
|
After Width: | Height: | Size: 2.0 KiB |
BIN
millennium-legacy/resources/textures/Water8.png
Normal file
|
After Width: | Height: | Size: 2.0 KiB |
BIN
millennium-legacy/resources/textures/Water9.png
Normal file
|
After Width: | Height: | Size: 2.0 KiB |
|
Before Width: | Height: | Size: 1.7 KiB After Width: | Height: | Size: 1.2 KiB |
BIN
millennium-legacy/resources/textures/grass.png
Executable file → Normal file
|
Before Width: | Height: | Size: 179 B After Width: | Height: | Size: 1.5 KiB |
BIN
millennium-legacy/resources/textures/gravel.png
Normal file
|
After Width: | Height: | Size: 6.1 KiB |
BIN
millennium-legacy/resources/textures/rock.png
Normal file
|
After Width: | Height: | Size: 2.0 KiB |
BIN
millennium-legacy/resources/textures/water.gif
Normal file
|
After Width: | Height: | Size: 18 KiB |
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
|
||||||
75
millennium-legacy/src/milleniumlegacy/Algorithm.java
Executable file → Normal file
@ -1,35 +1,60 @@
|
|||||||
package milleniumlegacy;
|
package milleniumlegacy;
|
||||||
|
|
||||||
|
public class Algorithm
|
||||||
|
{
|
||||||
|
|
||||||
public class Algorithm {
|
public static void research(int pSelect1, int pSelect2)
|
||||||
|
{
|
||||||
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();
|
Object[] keyArray = Item.items.keySet().toArray();
|
||||||
String Num1 = pSelect1[0];
|
for (int i = 1; i <= keyArray.length; i++)
|
||||||
String Num2 = pSelect2[0];
|
{
|
||||||
String Name1 = pSelect1[1];
|
String[] Craftable = (String[])Item.items.get(i);
|
||||||
String Name2 = pSelect2[1];
|
int Craft1int = Integer.parseInt(Craftable[4]);
|
||||||
String TP1 = pSelect1[2];
|
int Craft2int = Integer.parseInt(Craftable[6]);
|
||||||
String TP2 = pSelect2[2];
|
int rand = (int) (Math.random() * (100));
|
||||||
for(int i = 1; i <= keyArray.length;i++) {
|
int Prob = rand;
|
||||||
String[] Craftable = Item.items.get(i);
|
if ((Craft1int == pSelect1 || Craft1int == pSelect2) &&
|
||||||
String Craft1 = Craftable[4];
|
(Craft2int == pSelect1 || Craft2int == pSelect2))
|
||||||
String Craft2 = Craftable[5];
|
{
|
||||||
/*if ((Craft1.equals(Name1) || Craft2.equals(Name2)) &&
|
String[] requisite = (String[]) Item.items.get(i);
|
||||||
(Craft1.equals(Name2) || Craft2.equals(Name1))) {
|
int current1 = Inventory.inventory.get(pSelect1);
|
||||||
String[] getNewItem = Item.items.get(i);
|
int current2 = Inventory.inventory.get(pSelect2);
|
||||||
//TODO
|
int requisite1 = Integer.parseInt(requisite[3]);
|
||||||
|
int requisite2 = Integer.parseInt(requisite[5]);
|
||||||
|
if ((current1 >= requisite1 && current2 >= requisite2) )
|
||||||
|
{
|
||||||
|
if ((current1 -= requisite1) <= 0)
|
||||||
|
{
|
||||||
|
Inventory.inventory.remove(pSelect1);
|
||||||
|
Research.squareOffset+=2;
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
Inventory.inventory.put(pSelect1, current1 -= requisite1);
|
||||||
|
}
|
||||||
|
if ((current2 -= requisite2) <= 0)
|
||||||
|
{
|
||||||
|
Inventory.inventory.remove(pSelect2);
|
||||||
|
Research.squareOffset+=2;
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
Inventory.inventory.put(pSelect2, current2 -= requisite2);
|
||||||
|
}
|
||||||
|
int craftability = Integer.parseInt(requisite[2]);
|
||||||
|
if (Prob <= craftability)
|
||||||
|
{
|
||||||
|
int outputnum = Integer.parseInt(requisite[7]);
|
||||||
|
Inventory.addItem(i, outputnum);
|
||||||
|
break;
|
||||||
|
} else {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
}*/
|
}
|
||||||
}
|
}
|
||||||
int rand = (int)(Math.random() * (100));
|
|
||||||
int Prob = rand;
|
|
||||||
|
|
||||||
return Name2;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
32
millennium-legacy/src/milleniumlegacy/Animation.java
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
package milleniumlegacy;
|
||||||
|
|
||||||
|
import java.awt.image.BufferedImage;
|
||||||
|
|
||||||
|
public class Animation
|
||||||
|
{
|
||||||
|
BufferedImage[] imagearray;
|
||||||
|
int[] time;
|
||||||
|
int counter;
|
||||||
|
public Animation(BufferedImage[] imagearray, int[] time)
|
||||||
|
{
|
||||||
|
this.imagearray = imagearray;
|
||||||
|
this.time = time;
|
||||||
|
}
|
||||||
|
public Animation(BufferedImage[] imagearray)
|
||||||
|
{
|
||||||
|
this.imagearray = imagearray;
|
||||||
|
}
|
||||||
|
public BufferedImage animate()
|
||||||
|
{
|
||||||
|
if (counter < imagearray.length - 1)
|
||||||
|
{
|
||||||
|
counter++;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
counter = 0;
|
||||||
|
}
|
||||||
|
BufferedImage temp = imagearray[counter];
|
||||||
|
return temp;
|
||||||
|
}
|
||||||
|
}
|
||||||
61
millennium-legacy/src/milleniumlegacy/Button.java
Normal file
@ -0,0 +1,61 @@
|
|||||||
|
package milleniumlegacy;
|
||||||
|
|
||||||
|
import java.awt.Color;
|
||||||
|
import java.awt.Graphics;
|
||||||
|
import java.awt.Rectangle;
|
||||||
|
|
||||||
|
public class Button
|
||||||
|
{
|
||||||
|
int x,y,width,height,ButtonID;
|
||||||
|
public boolean selected1;
|
||||||
|
public Button(int x, int y, int width, int height, int ButtonID)
|
||||||
|
{
|
||||||
|
this.x = x;
|
||||||
|
this.y = y;
|
||||||
|
this.width = width;
|
||||||
|
this.height = height;
|
||||||
|
this.ButtonID = ButtonID;
|
||||||
|
}
|
||||||
|
public Rectangle getBounds()
|
||||||
|
{
|
||||||
|
return new Rectangle(x,y,width,height);
|
||||||
|
}
|
||||||
|
public void clicked(Rectangle MouseRectangle)
|
||||||
|
{
|
||||||
|
if (MouseRectangle.intersects(this.getBounds()))
|
||||||
|
{
|
||||||
|
if (!Research.selected1)
|
||||||
|
{
|
||||||
|
if (Inventory.inventory.size() >= ButtonID)
|
||||||
|
{
|
||||||
|
Research.selectionOne(Inventory.getIdFromButton(ButtonID));
|
||||||
|
selected1 =true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (Research.selected1)
|
||||||
|
{
|
||||||
|
if (Inventory.inventory.size() >= ButtonID)
|
||||||
|
{
|
||||||
|
Research.selectionTwo(Inventory.getIdFromButton(ButtonID));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
public void ResearchButton(Rectangle MouseRect)
|
||||||
|
{
|
||||||
|
if (MouseRect.intersects(this.getBounds()))
|
||||||
|
{
|
||||||
|
if (Research.selected1 && Research.selected2)
|
||||||
|
{
|
||||||
|
Algorithm.research(Research.selection1, Research.selection2);
|
||||||
|
Research.reset();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public void render(Graphics g)
|
||||||
|
{
|
||||||
|
g.setColor(Color.GRAY);
|
||||||
|
g.fillRect(x,y,width,height);
|
||||||
|
}
|
||||||
|
}
|
||||||
5
millennium-legacy/src/milleniumlegacy/ClanHandler.java
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
package milleniumlegacy;
|
||||||
|
|
||||||
|
public class ClanHandler {
|
||||||
|
|
||||||
|
}
|
||||||
24
millennium-legacy/src/milleniumlegacy/GUI.java
Executable file → Normal file
@ -1,19 +1,23 @@
|
|||||||
package milleniumlegacy;
|
package milleniumlegacy;
|
||||||
|
|
||||||
|
|
||||||
import java.awt.Component;
|
import java.io.IOException;
|
||||||
import java.awt.Graphics;
|
|
||||||
import java.util.HashMap;
|
|
||||||
|
|
||||||
import javax.imageio.ImageIO;
|
import javax.swing.JFrame;
|
||||||
import javax.swing.*;
|
import javax.swing.SwingUtilities;
|
||||||
|
import javax.swing.WindowConstants;
|
||||||
|
|
||||||
public class GUI {
|
public class GUI {
|
||||||
|
public static JFrame f;
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
|
try
|
||||||
Algorithm.research();
|
{
|
||||||
|
Process process = new ProcessBuilder("WorldGenerator.exe","","").start();
|
||||||
|
}
|
||||||
|
catch (IOException e)
|
||||||
|
{
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
SwingUtilities.invokeLater(new Runnable() {
|
SwingUtilities.invokeLater(new Runnable() {
|
||||||
public void run() {
|
public void run() {
|
||||||
createAndShowGUI();
|
createAndShowGUI();
|
||||||
@ -23,7 +27,7 @@ public class GUI {
|
|||||||
}
|
}
|
||||||
public static void createAndShowGUI()
|
public static void createAndShowGUI()
|
||||||
{
|
{
|
||||||
JFrame f = new JFrame("Millenium Legacy");
|
f = new JFrame("Millenium Legacy");
|
||||||
MainGame draw = new MainGame();
|
MainGame draw = new MainGame();
|
||||||
f.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
|
f.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
|
||||||
f.getContentPane().add(draw);
|
f.getContentPane().add(draw);
|
||||||
|
|||||||
62
millennium-legacy/src/milleniumlegacy/ImageHandler.java
Normal file
@ -0,0 +1,62 @@
|
|||||||
|
package milleniumlegacy;
|
||||||
|
|
||||||
|
import java.awt.image.BufferedImage;
|
||||||
|
|
||||||
|
public class ImageHandler
|
||||||
|
{
|
||||||
|
static ImageLoader IL = new ImageLoader();
|
||||||
|
static BufferedImage[] imageArray = {
|
||||||
|
IL.loadImage("resources/sprites/dirt.png"),
|
||||||
|
IL.loadImage("resources/sprites/water.png"),
|
||||||
|
IL.loadImage("resources/sprites/clay.png"),
|
||||||
|
IL.loadImage("resources/textures/gravel.png"),
|
||||||
|
IL.loadImage("resources/textures/rock.png"),
|
||||||
|
IL.loadImage("resources/sprites/plant.png"),
|
||||||
|
IL.loadImage("resources/sprites/iron.png"),
|
||||||
|
IL.loadImage("resources/sprites/fire.png"),
|
||||||
|
IL.loadImage("resources/sprites/fridge.png"),
|
||||||
|
IL.loadImage("resources/sprites/ice.png"),
|
||||||
|
IL.loadImage("resources/sprites/fire.png"),
|
||||||
|
IL.loadImage("resources/sprites/flower.png"),
|
||||||
|
IL.loadImage("resources/sprites/garden.png"),
|
||||||
|
IL.loadImage("resources/sprites/metal.png"),
|
||||||
|
IL.loadImage("resources/sprites/plastic.png"),
|
||||||
|
IL.loadImage("resources/sprites/sugar.png"),
|
||||||
|
IL.loadImage("resources/sprites/arsenic.png"),
|
||||||
|
IL.loadImage("resources/sprites/food.png"),
|
||||||
|
IL.loadImage("resources/sprites/house.png"),
|
||||||
|
IL.loadImage("resources/sprites/suburb.png"),
|
||||||
|
IL.loadImage("resources/sprites/city.png"),
|
||||||
|
IL.loadImage("resources/sprites/garden.png"),
|
||||||
|
IL.loadImage("resources/sprites/electricity.png"),
|
||||||
|
IL.loadImage("resources/sprites/supercomputer.png"),
|
||||||
|
IL.loadImage("resources/sprites/supercomputer.png"),
|
||||||
|
IL.loadImage("resources/sprites/quantumcomputer.png"),
|
||||||
|
IL.loadImage("resources/sprites/timemachine.png")
|
||||||
|
|
||||||
|
};
|
||||||
|
static BufferedImage[] waterArray = {
|
||||||
|
IL.loadImage("resources/textures/water0.png"),
|
||||||
|
IL.loadImage("resources/textures/water1.png"),
|
||||||
|
IL.loadImage("resources/textures/water2.png"),
|
||||||
|
IL.loadImage("resources/textures/water3.png"),
|
||||||
|
IL.loadImage("resources/textures/water4.png"),
|
||||||
|
IL.loadImage("resources/textures/water5.png"),
|
||||||
|
IL.loadImage("resources/textures/water6.png"),
|
||||||
|
IL.loadImage("resources/textures/water7.png"),
|
||||||
|
IL.loadImage("resources/textures/water8.png"),
|
||||||
|
IL.loadImage("resources/textures/water9.png")
|
||||||
|
};
|
||||||
|
public static BufferedImage Grass = IL.loadImage("resources/textures/grass.png");
|
||||||
|
public static BufferedImage Gravel = IL.loadImage("resources/textures/gravel.png");
|
||||||
|
public static BufferedImage Rock = IL.loadImage("resources/textures/rock.png");
|
||||||
|
public static BufferedImage Clay = IL.loadImage("resources/textures/clay.png");
|
||||||
|
public static BufferedImage Water = IL.loadImage("resources/textures/water.gif");
|
||||||
|
public static BufferedImage Hotbar = IL.loadImage("resources/gui/hotbar.png");
|
||||||
|
public static BufferedImage researchMenu = IL.loadImage("resources/gui/research.png");
|
||||||
|
|
||||||
|
public static BufferedImage getImage(int num)
|
||||||
|
{
|
||||||
|
return imageArray[num];
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -11,7 +11,7 @@ public class ImageLoader
|
|||||||
public BufferedImage loadImage (String path)
|
public BufferedImage loadImage (String path)
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
BufferedImage bi = ImageIO.read(new FileInputStream("resources/sprites/player.png"));
|
BufferedImage bi = ImageIO.read(new FileInputStream(path));
|
||||||
return bi;
|
return bi;
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
System.out.println("Error loading Image");
|
System.out.println("Error loading Image");
|
||||||
|
|||||||
@ -1,16 +1,89 @@
|
|||||||
package milleniumlegacy;
|
package milleniumlegacy;
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.awt.Color;
|
||||||
|
import java.awt.Graphics;
|
||||||
|
import java.util.Hashtable;
|
||||||
|
|
||||||
|
|
||||||
public class Inventory {
|
public class Inventory {
|
||||||
public static final HashMap<Integer, String[]> items;
|
|
||||||
|
public static final Hashtable<Integer, Integer> inventory;
|
||||||
|
public static boolean shouldRender = true;
|
||||||
static
|
static
|
||||||
{
|
{
|
||||||
//Putting items
|
//Putting items
|
||||||
items = new HashMap<Integer, String[]>();
|
inventory = new Hashtable<Integer, Integer>();
|
||||||
items.put(1, new String[] {"1","Dirt", "Universal",null,null,null});
|
}
|
||||||
items.put(2, new String[] {"2","Water","Universal",null,null,null});
|
public static void addItem(int id, int amount)
|
||||||
items.put(3, new String[] {"3","Clay","Medieval", "99","Dirt","Water"});
|
{
|
||||||
|
if (inventory.containsKey(id))
|
||||||
|
{
|
||||||
|
int current = inventory.get(id);
|
||||||
|
if (current <= 998)
|
||||||
|
{
|
||||||
|
inventory.put(id, current+=1);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
inventory.put(id, 999);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
inventory.put(id, amount);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public static int getIdFromButton(int Button)
|
||||||
|
{
|
||||||
|
int counter = 0;
|
||||||
|
if (inventory.size() >= Button)
|
||||||
|
{
|
||||||
|
for (int i = 0; i <= 100; i++)
|
||||||
|
{
|
||||||
|
if (inventory.containsKey(i))
|
||||||
|
{
|
||||||
|
counter++;
|
||||||
|
if (counter == Button)
|
||||||
|
{
|
||||||
|
return i;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return Button;
|
||||||
|
|
||||||
|
}
|
||||||
|
public static void render(Graphics g)
|
||||||
|
{
|
||||||
|
if (shouldRender)
|
||||||
|
{
|
||||||
|
g.drawImage(ImageHandler.Hotbar, 180, 548, 464, 48, null);
|
||||||
|
int offset = 0;
|
||||||
|
for (int i = 0; i <= 100; i++)
|
||||||
|
{
|
||||||
|
if (inventory.containsKey(i))
|
||||||
|
{
|
||||||
|
g.drawImage(ImageHandler.getImage(i - 1), 188 + offset, 556, 32, 32, null);
|
||||||
|
g.setColor(Color.cyan);
|
||||||
|
if (inventory.get(i) > 99)
|
||||||
|
{
|
||||||
|
g.drawString("" + inventory.get(i), 188+offset + 4, 564);
|
||||||
|
}
|
||||||
|
else if (inventory.get(i) > 9)
|
||||||
|
{
|
||||||
|
g.drawString("" + inventory.get(i), 188+offset + 8, 564);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
g.drawString("" + inventory.get(i), 188+offset + 12, 564);
|
||||||
|
}
|
||||||
|
offset += (41 + 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
30
millennium-legacy/src/milleniumlegacy/Item.java
Executable file → Normal file
@ -8,9 +8,33 @@ public class Item {
|
|||||||
{
|
{
|
||||||
//Putting items
|
//Putting items
|
||||||
items = new HashMap<Integer, String[]>();
|
items = new HashMap<Integer, String[]>();
|
||||||
items.put(1, new String[] {"1","Dirt", "Universal",null,null,null});
|
items.put(1, new String[] {"1","Dirt","0","0","0","0","0","0"});
|
||||||
items.put(2, new String[] {"2","Water","Universal",null,null,null});
|
items.put(2, new String[] {"2","Water","0","0","0","0","0","0"});
|
||||||
items.put(3, new String[] {"3","Clay","Medieval", "99","Dirt","Water"});
|
items.put(3, new String[] {"3","Clay", "99","1","1","1","2","1"});
|
||||||
|
items.put(4, new String[] {"4","Gravel", "0","0","0","0","0","0"});
|
||||||
|
items.put(5, new String[] {"5","Rock", "0","0","0","0","0","0"});
|
||||||
|
items.put(6, new String[] {"6","Plant", "90","1","1","1","4","1"});
|
||||||
|
items.put(7, new String[] {"7","Iron", "70","1","3","3","2","1"});
|
||||||
|
items.put(8, new String[] {"8","Fire", "90","1","6","2","2","1"});
|
||||||
|
items.put(9, new String[] {"9","Fridge", "50","3","8","1","7","1"});
|
||||||
|
items.put(10, new String[] {"10","Ice", "70","4","5","5","8","1"});
|
||||||
|
items.put(11, new String[] {"11","Furnace", "60","3","10","2","6","1"});
|
||||||
|
items.put(12, new String[] {"12","Flower", "80","3","7","1","6","1"});
|
||||||
|
items.put(13, new String[] {"13","Garden", "75","12","12","10","3","1"});
|
||||||
|
items.put(14, new String[] {"14","Metal", "70","4","13","1","20","50"});
|
||||||
|
items.put(15, new String[] {"15","Plastic", "60","3","14","5","2","1"});
|
||||||
|
items.put(16, new String[] {"16","Sugar", "90","2","15","7","5","10"});
|
||||||
|
items.put(17, new String[] {"17","Arsenic", "80","3","16","6","3","1"});
|
||||||
|
items.put(18, new String[] {"18","Food", "90","1","17","6","22","10"});
|
||||||
|
items.put(19, new String[] {"19","House", "90","3","10","4","8","1"});
|
||||||
|
items.put(20, new String[] {"20","Suburb", "65","30","19","3","13","1"});
|
||||||
|
items.put(21, new String[] {"21","City", "75","1","20","20","19","1"});
|
||||||
|
items.put(22, new String[] {"22","Farm", "100","5","13","25","6","1"});
|
||||||
|
items.put(23, new String[] {"23","Electricity", "90","32","18","2","7","20"});
|
||||||
|
items.put(24, new String[] {"24","Computer", "85","60","23","3","10","1"});
|
||||||
|
items.put(25, new String[] {"25","Super Computer", "90","100","24","10","21","1"});
|
||||||
|
items.put(26, new String[] {"26","Quantum Computer", "90","10","25","4","11","1"});
|
||||||
|
items.put(27, new String[] {"27","Time Machine", "30","20","26","45","8","1"});
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -27,7 +27,19 @@ public class KeyManager implements KeyListener
|
|||||||
}
|
}
|
||||||
if (e.getKeyCode() == KeyEvent.VK_SPACE)
|
if (e.getKeyCode() == KeyEvent.VK_SPACE)
|
||||||
{
|
{
|
||||||
|
MainGame.getPlayer().Add();
|
||||||
|
}
|
||||||
|
if (e.getKeyCode() == KeyEvent.VK_R){
|
||||||
|
if (Research.shouldRender)
|
||||||
|
{
|
||||||
|
Research.shouldRender = false;
|
||||||
|
Inventory.shouldRender = true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Research.shouldRender = true;
|
||||||
|
Inventory.shouldRender = false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -5,24 +5,28 @@ import java.awt.Color;
|
|||||||
import java.awt.Graphics;
|
import java.awt.Graphics;
|
||||||
import java.awt.Toolkit;
|
import java.awt.Toolkit;
|
||||||
import java.awt.image.BufferStrategy;
|
import java.awt.image.BufferStrategy;
|
||||||
import java.awt.image.BufferedImage;
|
|
||||||
import java.util.ArrayList;
|
|
||||||
|
|
||||||
public class MainGame extends Canvas implements Runnable
|
public class MainGame extends Canvas implements Runnable
|
||||||
{
|
{
|
||||||
private static final long serialVersionUID = -1902119798739765822L;
|
private static final long serialVersionUID = -1902119798739765822L;
|
||||||
ImageLoader IL = new ImageLoader();
|
public static Tile[][] map = Map.readyMap();
|
||||||
KeyManager km;
|
|
||||||
player ply = new player(375, 300, IL);
|
|
||||||
ArrayList<Tile> map = Map.readyMap();
|
|
||||||
Thread main;
|
|
||||||
public static boolean up, down, left, right, running;
|
public static boolean up, down, left, right, running;
|
||||||
public static int offsetx, offsety;
|
public static int offsetx = 50 * -48, offsety = 50 * -48, speed = 10;;
|
||||||
|
static ImageLoader IL = new ImageLoader();
|
||||||
|
static player ply = new player(375, 300, IL);
|
||||||
|
KeyManager km;
|
||||||
|
MouseManager mm;
|
||||||
|
|
||||||
|
Thread main;
|
||||||
|
Research re = new Research();
|
||||||
|
|
||||||
|
|
||||||
public void init()
|
public void init()
|
||||||
{
|
{
|
||||||
km = new KeyManager();
|
km = new KeyManager();
|
||||||
this.addKeyListener(km);
|
this.addKeyListener(km);
|
||||||
|
mm = new MouseManager();
|
||||||
|
this.addMouseListener(mm);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void render()
|
public void render()
|
||||||
@ -38,32 +42,46 @@ public class MainGame extends Canvas implements Runnable
|
|||||||
g.fillRect(0, 0, Toolkit.getDefaultToolkit().getScreenSize().width,
|
g.fillRect(0, 0, Toolkit.getDefaultToolkit().getScreenSize().width,
|
||||||
Toolkit.getDefaultToolkit().getScreenSize().height);
|
Toolkit.getDefaultToolkit().getScreenSize().height);
|
||||||
g.setColor(Color.BLACK);
|
g.setColor(Color.BLACK);
|
||||||
for (Tile t : map)
|
for (Tile[] ta : map)
|
||||||
{
|
{
|
||||||
t.Render(g, offsetx, offsety);
|
for (Tile t : ta)
|
||||||
|
{
|
||||||
|
t.Render(g, offsetx, offsety);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
ply.render(g);
|
ply.render(g);
|
||||||
|
Inventory.render(g);
|
||||||
|
re.render(g);
|
||||||
g.dispose();
|
g.dispose();
|
||||||
bs.show();
|
bs.show();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void tick()
|
public void tick()
|
||||||
{
|
{
|
||||||
if (up)
|
ply.tick();
|
||||||
|
if (up && offsety <= 0)
|
||||||
{
|
{
|
||||||
offsety += 3;
|
offsety += speed;
|
||||||
}
|
}
|
||||||
if (down)
|
if (down && offsety >= 86*-48)
|
||||||
{
|
{
|
||||||
offsety -= 3;
|
offsety -= speed;
|
||||||
}
|
}
|
||||||
if (left)
|
if (left && offsetx <= 0)
|
||||||
{
|
{
|
||||||
offsetx += 3;
|
offsetx += speed;
|
||||||
}
|
}
|
||||||
if (right)
|
if (right && offsetx >= 81*-48)
|
||||||
{
|
{
|
||||||
offsetx -= 3;
|
offsetx -= speed;
|
||||||
|
}
|
||||||
|
if (ply.getTile() != "1")
|
||||||
|
{
|
||||||
|
speed = 5;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
speed = 10;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -103,8 +121,6 @@ public class MainGame extends Canvas implements Runnable
|
|||||||
if (System.currentTimeMillis() - timer > 1000)
|
if (System.currentTimeMillis() - timer > 1000)
|
||||||
{
|
{
|
||||||
timer += 1000;
|
timer += 1000;
|
||||||
System.out.println(updates + " Ticks, Fps " + frames);
|
|
||||||
ply.getPosition();
|
|
||||||
updates = 0;
|
updates = 0;
|
||||||
frames = 0;
|
frames = 0;
|
||||||
}
|
}
|
||||||
@ -112,4 +128,9 @@ public class MainGame extends Canvas implements Runnable
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static player getPlayer()
|
||||||
|
{
|
||||||
|
return ply;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -4,23 +4,27 @@ import java.util.ArrayList;
|
|||||||
|
|
||||||
public class Map
|
public class Map
|
||||||
{
|
{
|
||||||
|
static ImageLoader IL = MainGame.IL;
|
||||||
|
|
||||||
static MapLoader ml = new MapLoader();
|
static MapLoader ml = new MapLoader();
|
||||||
public static ArrayList<Tile> readyMap()
|
public static Tile[][] readyMap()
|
||||||
{
|
{
|
||||||
ArrayList<Tile> tiles = new ArrayList<Tile>();
|
Tile[][] mappp;
|
||||||
char[][] map = ml.LoadMap("resources/maps/map.txt");
|
ArrayList<ArrayList<Tile>> tilesy = new ArrayList<ArrayList<Tile>>();
|
||||||
|
ArrayList<Tile> tilesx = new ArrayList<Tile>();
|
||||||
|
char[][] map = ml.LoadMap("milleniumWorld.txt");
|
||||||
|
mappp = new Tile[map.length][map[0].length];
|
||||||
int countery = 0, counterx = 0;
|
int countery = 0, counterx = 0;
|
||||||
for (char[] chararr : map)
|
for (char[] chararr : map)
|
||||||
{
|
{
|
||||||
countery++;
|
|
||||||
for (char c: chararr)
|
for (char c: chararr)
|
||||||
{
|
{
|
||||||
|
mappp[counterx][countery] = new Tile(counterx, countery, c, IL);
|
||||||
counterx++;
|
counterx++;
|
||||||
System.out.println(counterx);
|
|
||||||
tiles.add(new Tile(counterx, countery, c));
|
|
||||||
}
|
}
|
||||||
|
countery++;
|
||||||
counterx = 0;
|
counterx = 0;
|
||||||
}
|
}
|
||||||
return tiles;
|
return mappp;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
2
millennium-legacy/src/milleniumlegacy/MapLoader.java
Executable file → Normal file
@ -27,10 +27,8 @@ public class MapLoader {
|
|||||||
char[][] maparr = new char[lines.size()][lines.get(0).toCharArray().length];
|
char[][] maparr = new char[lines.size()][lines.get(0).toCharArray().length];
|
||||||
for (int y = 0; y <= lines.size() - 1; y++)
|
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++)
|
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];
|
maparr[y][x] = lines.get(y).toCharArray()[x];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
56
millennium-legacy/src/milleniumlegacy/MouseManager.java
Normal file
@ -0,0 +1,56 @@
|
|||||||
|
package milleniumlegacy;
|
||||||
|
|
||||||
|
import java.awt.Rectangle;
|
||||||
|
import java.awt.event.MouseEvent;
|
||||||
|
import java.awt.event.MouseListener;
|
||||||
|
|
||||||
|
public class MouseManager implements MouseListener
|
||||||
|
{
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void mouseClicked(MouseEvent e)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void mouseEntered(MouseEvent e)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void mouseExited(MouseEvent e)
|
||||||
|
{
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void mousePressed(MouseEvent e)
|
||||||
|
{
|
||||||
|
Research.button.clicked(new Rectangle(e.getX(),e.getY(),1,1));
|
||||||
|
Research.button2.clicked(new Rectangle(e.getX(),e.getY(),1,1));
|
||||||
|
Research.button3.clicked(new Rectangle(e.getX(),e.getY(),1,1));
|
||||||
|
Research.button4.clicked(new Rectangle(e.getX(),e.getY(),1,1));
|
||||||
|
Research.button5.clicked(new Rectangle(e.getX(),e.getY(),1,1));
|
||||||
|
Research.button6.clicked(new Rectangle(e.getX(),e.getY(),1,1));
|
||||||
|
Research.button7.clicked(new Rectangle(e.getX(),e.getY(),1,1));
|
||||||
|
Research.button8.clicked(new Rectangle(e.getX(),e.getY(),1,1));
|
||||||
|
Research.button9.clicked(new Rectangle(e.getX(),e.getY(),1,1));
|
||||||
|
Research.button10.clicked(new Rectangle(e.getX(),e.getY(),1,1));
|
||||||
|
Research.rb.ResearchButton(new Rectangle(e.getX(),e.getY(),1,1));
|
||||||
|
if (Research.selected1 && !Research.button.getBounds().intersects(new Rectangle(e.getX(),e.getY(),1,1)) && !Research.button3.getBounds().intersects(new Rectangle(e.getX(),e.getY(),1,1)) && !Research.button4.getBounds().intersects(new Rectangle(e.getX(),e.getY(),1,1)) && !Research.button5.getBounds().intersects(new Rectangle(e.getX(),e.getY(),1,1)) && !Research.button6.getBounds().intersects(new Rectangle(e.getX(),e.getY(),1,1)) && !Research.button7.getBounds().intersects(new Rectangle(e.getX(),e.getY(),1,1)) && !Research.button8.getBounds().intersects(new Rectangle(e.getX(),e.getY(),1,1)) && !Research.button9.getBounds().intersects(new Rectangle(e.getX(),e.getY(),1,1)) && !Research.button2.getBounds().intersects(new Rectangle(e.getX(),e.getY(),1,1)) && !Research.button10.getBounds().intersects(new Rectangle(e.getX(),e.getY(),1,1)) )
|
||||||
|
{
|
||||||
|
Research.reset();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void mouseReleased(MouseEvent e)
|
||||||
|
{
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
0
millennium-legacy/src/milleniumlegacy/OptionsPane.java
Executable file → Normal file
91
millennium-legacy/src/milleniumlegacy/Research.java
Normal file
@ -0,0 +1,91 @@
|
|||||||
|
package milleniumlegacy;
|
||||||
|
|
||||||
|
import java.awt.Color;
|
||||||
|
import java.awt.Graphics;
|
||||||
|
|
||||||
|
public class Research
|
||||||
|
{
|
||||||
|
public static boolean shouldRender, selected1, selected2;
|
||||||
|
static int x = 80;
|
||||||
|
public static int squareOffset = 1;
|
||||||
|
static int selection1;
|
||||||
|
static int selection2;
|
||||||
|
String update = "";
|
||||||
|
static String SelectOne = "";
|
||||||
|
static String SelectTwo = "";
|
||||||
|
public static Button button = new Button(x,433,48,48, 1);
|
||||||
|
public static Button button2 = new Button(x += 69,433,48,48, 2);
|
||||||
|
public static Button button3 = new Button(x += 69,433,48,48, 3);
|
||||||
|
public static Button button4 = new Button(x += 70,433,48,48, 4);
|
||||||
|
public static Button button5 = new Button(x += 70,433,48,48, 5);
|
||||||
|
public static Button button6 = new Button(x += 70,433,48,48, 6);
|
||||||
|
public static Button button7 = new Button(x += 69,433,48,48, 7);
|
||||||
|
public static Button button8 = new Button(x += 69,433,48,48, 8);
|
||||||
|
public static Button button9 = new Button(x += 69,433,48,48, 9);
|
||||||
|
public static Button button10 = new Button(x += 70,433,48,48, 10);
|
||||||
|
public static Button rb = new Button(75, 120, 260,260, 11);
|
||||||
|
public void render(Graphics g)
|
||||||
|
{
|
||||||
|
if (shouldRender)
|
||||||
|
{
|
||||||
|
g.drawImage(ImageHandler.researchMenu, 25, 25, 775, 500, null);
|
||||||
|
int offset = 0;
|
||||||
|
button.render(g);
|
||||||
|
button2.render(g);
|
||||||
|
button3.render(g);
|
||||||
|
button4.render(g);
|
||||||
|
button5.render(g);
|
||||||
|
button6.render(g);
|
||||||
|
button7.render(g);
|
||||||
|
button8.render(g);
|
||||||
|
button9.render(g);
|
||||||
|
button10.render(g);
|
||||||
|
rb.render(g);
|
||||||
|
for (int i = 0; i <= 100; i++)
|
||||||
|
{
|
||||||
|
|
||||||
|
if (Inventory.inventory.containsKey(i))
|
||||||
|
{
|
||||||
|
g.drawImage(ImageHandler.getImage(i - 1), 80 + offset, 433, 48, 48, null);
|
||||||
|
g.setColor(Color.WHITE);
|
||||||
|
g.drawString("Amount: " + Inventory.inventory.get(i), 80 + offset, 430);
|
||||||
|
if (offset == 0)
|
||||||
|
{
|
||||||
|
offset += 68;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
offset+=70;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
g.setColor(Color.WHITE);
|
||||||
|
g.drawString(SelectOne, 385, 180);
|
||||||
|
g.drawString(SelectTwo, 385, 300);
|
||||||
|
g.drawString("Research", 100,200);
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public static void selectionOne(int id)
|
||||||
|
{
|
||||||
|
selection1 = id;
|
||||||
|
selected1 = true;
|
||||||
|
SelectOne =Item.items.get(id)[1];
|
||||||
|
System.out.println(id);
|
||||||
|
}
|
||||||
|
public static void selectionTwo(int id)
|
||||||
|
{
|
||||||
|
selection2 = id;
|
||||||
|
selected2 = true;
|
||||||
|
SelectTwo =Item.items.get(id)[1];
|
||||||
|
//Algorithm.research(selection1, selection2);
|
||||||
|
}
|
||||||
|
public static void reset()
|
||||||
|
{
|
||||||
|
selected2 = false;
|
||||||
|
selected1 = false;
|
||||||
|
SelectTwo = "";
|
||||||
|
SelectOne = "";
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
20
millennium-legacy/src/milleniumlegacy/SolidTile.java
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
package milleniumlegacy;
|
||||||
|
|
||||||
|
import java.awt.Rectangle;
|
||||||
|
|
||||||
|
public class SolidTile extends Tile
|
||||||
|
{
|
||||||
|
int x, y;
|
||||||
|
public SolidTile(int x, int y, char terrain, ImageLoader IL )
|
||||||
|
{
|
||||||
|
super(x, y, terrain, IL);
|
||||||
|
this.x = x;
|
||||||
|
this.y = y;
|
||||||
|
}
|
||||||
|
public Rectangle getBounds()
|
||||||
|
{
|
||||||
|
return new Rectangle(x * 42, y * 42, 42,42);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@ -2,6 +2,7 @@ package milleniumlegacy;
|
|||||||
|
|
||||||
import java.awt.Color;
|
import java.awt.Color;
|
||||||
import java.awt.Graphics;
|
import java.awt.Graphics;
|
||||||
|
import java.awt.image.BufferedImage;
|
||||||
|
|
||||||
public class Tile
|
public class Tile
|
||||||
{
|
{
|
||||||
@ -10,33 +11,55 @@ public class Tile
|
|||||||
boolean up, down, left, right;
|
boolean up, down, left, right;
|
||||||
int offsetx;
|
int offsetx;
|
||||||
int offsety;
|
int offsety;
|
||||||
public Tile(int x, int y, char terrain)
|
BufferedImage TileImage;
|
||||||
|
String name;
|
||||||
|
Animation waterAnimation = new Animation(ImageHandler.waterArray);
|
||||||
|
public Tile(int x, int y, char terrain, ImageLoader IL)
|
||||||
{
|
{
|
||||||
this.x = x;
|
this.x = x;
|
||||||
this.y = y;
|
this.y = y;
|
||||||
this.terrain = terrain;
|
this.terrain = terrain;
|
||||||
|
switch(terrain)
|
||||||
|
{
|
||||||
|
case '-':
|
||||||
|
this.name="1";
|
||||||
|
TileImage = ImageHandler.Grass;
|
||||||
|
break;
|
||||||
|
case 'w':
|
||||||
|
this.name="2"; //get water
|
||||||
|
TileImage = ImageHandler.Water;
|
||||||
|
break;
|
||||||
|
case 'r':
|
||||||
|
this.name="5";
|
||||||
|
TileImage = ImageHandler.Rock;
|
||||||
|
break;
|
||||||
|
case 'g':
|
||||||
|
this.name="4";
|
||||||
|
TileImage = ImageHandler.Gravel;
|
||||||
|
break;
|
||||||
|
case 'c':
|
||||||
|
this.name="3";
|
||||||
|
TileImage = ImageHandler.Clay;
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
public void Render(Graphics g, int offsetx, int offsety)
|
public void Render(Graphics g, int offsetx, int offsety)
|
||||||
{
|
{
|
||||||
if (terrain == 'd')
|
if (name.equals("2"))
|
||||||
|
{
|
||||||
|
g.drawImage(waterAnimation.animate(), x*48 + offsetx- 48, y*48 + offsety - 48, 48,48, null);
|
||||||
|
}
|
||||||
|
else if (TileImage != null)
|
||||||
{
|
{
|
||||||
g.setColor(Color.GREEN);
|
g.drawImage(TileImage, x*48 + offsetx- 48, y*48 + offsety - 48, 48,48, null);
|
||||||
}
|
|
||||||
else if (terrain == 'r')
|
|
||||||
{
|
|
||||||
g.setColor(Color.DARK_GRAY);
|
|
||||||
}
|
|
||||||
else if (terrain == 'c')
|
|
||||||
{
|
|
||||||
g.setColor(Color.gray);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
g.setColor(Color.blue);
|
g.setColor(Color.blue);
|
||||||
|
g.drawRect(x*48 + offsetx - 48, y*48 + offsety - 48, 48,48);
|
||||||
}
|
}
|
||||||
g.fillRect(x*32 + offsetx - 32, y*32 + offsety - 32, 32,32);
|
|
||||||
String draw = "x" + x + "y" + y;
|
String draw = "x" + x + "y" + y;
|
||||||
g.setColor(Color.black);
|
g.setColor(Color.white);
|
||||||
g.drawString(draw, x*32 + offsetx - 32, y*32 + 8 + offsety - 32);
|
//g.drawString(draw, x*48 + offsetx - 48, y*48 + 8 + offsety - 48);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,6 +1,7 @@
|
|||||||
package milleniumlegacy;
|
package milleniumlegacy;
|
||||||
|
|
||||||
import java.awt.Graphics;
|
import java.awt.Graphics;
|
||||||
|
import java.awt.Rectangle;
|
||||||
import java.awt.image.BufferedImage;
|
import java.awt.image.BufferedImage;
|
||||||
|
|
||||||
public class player
|
public class player
|
||||||
@ -8,24 +9,35 @@ public class player
|
|||||||
int x, y;
|
int x, y;
|
||||||
int drawx, drawy;
|
int drawx, drawy;
|
||||||
BufferedImage player;
|
BufferedImage player;
|
||||||
|
Rectangle bounds;
|
||||||
public player(int x, int y, ImageLoader IL)
|
public player(int x, int y, ImageLoader IL)
|
||||||
{
|
{
|
||||||
this.drawx = x;
|
this.drawx = x;
|
||||||
this.drawy = y;
|
this.drawy = y;
|
||||||
player = IL.loadImage("../resources/sprites/player.png");
|
player = IL.loadImage("resources/sprites/player.png");
|
||||||
}
|
}
|
||||||
public void tick()
|
public void tick()
|
||||||
{
|
{
|
||||||
|
x = ((MainGame.offsetx * -1)+ drawx);
|
||||||
|
y = ((MainGame.offsety * -1) + drawy);
|
||||||
|
bounds = new Rectangle(x - 27,y - 27, 54,54);
|
||||||
}
|
}
|
||||||
public void render(Graphics g)
|
public void render(Graphics g)
|
||||||
{
|
{
|
||||||
g.drawImage(player, drawx, drawy, null);
|
g.drawImage(player, drawx, drawy, null);
|
||||||
}
|
}
|
||||||
public void getPosition()
|
public String getTile()
|
||||||
{
|
{
|
||||||
int x = ((MainGame.offsetx * -1)+ drawx + 16) / 32 + 1;
|
int x = ((MainGame.offsetx * -1)+ drawx + 16) / 48 + 1;
|
||||||
int y = ((MainGame.offsety * -1) + drawy + 16) / 32 + 1;
|
int y = ((MainGame.offsety * -1) + drawy + 16) / 48 + 1;
|
||||||
System.out.println("X: " + x + "Y: " + y);
|
return MainGame.map[x][y].name;
|
||||||
|
}
|
||||||
|
public String Add()
|
||||||
|
{
|
||||||
|
int x = ((MainGame.offsetx * -1)+ drawx + 16) / 48 + 1;
|
||||||
|
int y = ((MainGame.offsety * -1) + drawy + 16) / 48 + 1;
|
||||||
|
Inventory.addItem(Integer.parseInt(MainGame.map[x][y].name), 1);
|
||||||
|
System.out.println(Inventory.inventory);
|
||||||
|
return MainGame.map[x][y].name;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||