Alguém tem o jogo Batalha Naval feito em java?
Se alguém tiver poderia postaro codigo fonte aqui, por favor. Não precisa ser muito complexo, apenas uma implementação simples.
Como criar um(tutorial):
http://www.programmersheaven.com/articles/userarticles/mark/tut3/tut3_3.htm
E o código do tutorial:
[code]import java.awt.;
import javax.swing.;
public class BattleshipApp extends JFrame
{
// instance variables
private Board redBoard;
private Board blueBoard;
private FriendlyPlayer friendlyPlayer;
private EnemyPlayer enemyPlayer;
/**
* Entry point for code execution.
*/
public static void main(String[] args) {
new BattleshipApp();
}
/**
* Constructor for objects of class BattleshipApp
*/
public BattleshipApp()
{
this.setSize(600, 500);
this.show();
}
/**
* Draws the game window.
*/
public void paint(Graphics gfx) {
this.drawTitleScreen();
}
/**
* Draws the 'Welcome to Battleship' screen.
*/
private void drawTitleScreen() {
// Get an object representing the area within the window borders.
Container clientArea = this.getContentPane();
// Get the Graphics object associated with the client area.
Graphics gfx = clientArea.getGraphics();
// Get the size of the client area.
int width = clientArea.getWidth();
int height = clientArea.getHeight();
gfx.setColor(Color.black);
gfx.fillRect(0, 0, width, height);
gfx.setColor(Color.green);
gfx.drawString("BATTLESHIP", 260, 225);
gfx.setColor(Color.gray);
gfx.drawString("(click mouse to continue)", 228, 275);
}
}
[/code]