Advertisement
Advertisement
|
[x]
Attachment Details
|
||
|
[x]
The Solution Rating System
|
||
|
With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.
Your Input Matters If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support. Thank you! |
||
1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: 29: 30: 31: 32: 33: 34: 35: 36: 37: 38: 39: 40: 41: 42: 43: 44: 45: 46: 47: 48: 49: 50: 51: 52: 53: 54: 55: 56: 57: 58: 59: 60: 61: 62: 63: 64: 65: 66: 67: 68: 69: 70: 71: 72: 73: 74: 75: 76: 77: 78: 79: 80: 81: 82: 83: 84: 85: 86: 87: 88: 89: 90: 91: 92: 93: 94: 95: 96: 97: 98: 99: 100: 101: 102: 103: 104: 105: 106: 107: 108: 109: 110: 111: 112: 113: 114: 115: |
//MovingTilesApp:
import java.awt.BorderLayout;
import java.awt.Container;
import javax.swing.JButton;
import javax.swing.JFrame;
public class MovingTilesApp extends JFrame {
private static final long serialVersionUID = -3054541431624115776L;
//SG_Board myBoard;
static MyEnhancedBoard myBoard;
public Container contentPane;
public MovingTilesApp() {
setTitle("Labyrinth");
setVisible( true ) ;
setSize(900,800); // Any size, reset it later.
contentPane = getContentPane();
contentPane.setLayout(new BorderLayout());
//Note This image is 640x480 pixels
// public SG_Board (String file_name, int buffer,
// int x0, int y0,
// int posnsWide, int posnsDown,
// int posnPixelsWide, int posnPixelsDown){
//myBoard = new MyEnhancedBoard("Blank.jpg",1,1,1,1,1,1);
myBoard = new MyEnhancedBoard("Blank.jpg",0,0,8,10,64,60);
//myBoard = new MyEnhancedBoard("Blank.jpg",0,0,10,10,64,60);
//myBoard = new MyEnhancedBoard("Blank.jpg",0,0,10,10,64,60);
myBoard.setNoOfTiles(5000); // Total number of tiles
//setTile(int tileId, int boardCoordX,int boardCoordY,String iconName)
PrintMap();
//According to the given NUMBER OF PLAYERS CREATE THE SAME Number OF CLIENTS:
int id=100;
for (int i=1; i<= LODServer.clients.size(); i++)
{
new Client();
myBoard.setTile(id++,2,2,"Images/Cool1.jpg");
}
contentPane.add("Center",myBoard);
//contentPane.add();
JButton goUpButton = new JButton("Up");
JButton goDownButton = new JButton("Down");
JButton goLeftButton = new JButton("Left");
JButton goRightButton = new JButton("Right");
goUpButton.addActionListener(myBoard);
goDownButton.addActionListener(myBoard);
goLeftButton.addActionListener(myBoard);
goRightButton.addActionListener(myBoard);
contentPane.add("West",goLeftButton);
contentPane.add("East",goRightButton);
contentPane.add("North",goUpButton);
contentPane.add("South", goDownButton);
myBoard.resize(770,575);
myBoard.show();
}
public static void main(String[] args) {
//MovingTilesApp myBoardGame =
new MovingTilesApp();
}
static LODServer m = new LODServer();
public void PrintMap()
{
int id = 2;
for(int a=0;a<m.mapHeight;a++)
{
for(int b=0;b<m.mapWidth;b++)
{
switch(m.map[a][b])
{
/*tileId,x,y, ImageFile*/
case LODServer.EMPTY : myBoard.setTile(id++,a,b,"Images/floor.jpg"); break;
case LODServer.HEALTH : myBoard.setTile(id++,a,b,"Images/health.jpg"); break;
case LODServer.LANTERN : myBoard.setTile(id++,a,b,"Images/lantern.jpg"); break;
case LODServer.SWORD : myBoard.setTile(id++,a,b,"Images/sword.jpg"); break;
case LODServer.ARMOUR : myBoard.setTile(id++,a,b,"Images/armour.jpg"); break;
case LODServer.EXIT : myBoard.setTile(id++,a,b,"Images/exit.jpg"); break;
case LODServer.WALL : myBoard.setTile(id++,a,b,"Images/wall.jpg"); break;
case LODServer.TREASURE : myBoard.setTile(id++,a,b,"Images/gold.jpg"); break;
}
if(m.map[a][b] > 0)
{
myBoard.setTile(id++,a,b,"Images/gold.jpg"); break;
}
}
}
}
}
|