Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
B
battleships
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
patrick.gustard-sm
battleships
Commits
39774848
Commit
39774848
authored
Aug 09, 2019
by
patrick.gustard-sm
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update Board.java
parent
a4943fa3
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
16 deletions
+16
-16
Board.java
src/battleship/Board.java
+16
-16
No files found.
src/battleship/Board.java
View file @
39774848
...
@@ -38,8 +38,8 @@ Cell cell = new Cell(x,y);
...
@@ -38,8 +38,8 @@ Cell cell = new Cell(x,y);
cell
.
setOnMouseClicked
(
handler
);
cell
.
setOnMouseClicked
(
handler
);
row
.
getChildren
().
add
(
cell
);
row
.
getChildren
().
add
(
cell
);
cell
.
isShot
=
false
;
//
cell.isShot = false;
cell
.
isShotEnemy
=
false
;
//
cell.isShotEnemy = false;
}
}
...
@@ -60,9 +60,9 @@ public int xAxis;
...
@@ -60,9 +60,9 @@ public int xAxis;
public
int
yAxis
;
public
int
yAxis
;
public
boolean
isShotEnemy
=
false
;
//
public boolean isShotEnemy = false;
public
boolean
isShot
=
false
;
//
public boolean isShot = false;
public
boolean
isShip
=
false
;
public
boolean
isShip
=
false
;
...
@@ -92,10 +92,10 @@ if (isShip == true) {
...
@@ -92,10 +92,10 @@ if (isShip == true) {
//if cell contains a ship
//if cell contains a ship
setFill
(
Color
.
ORANGE
);
setFill
(
Color
.
ORANGE
);
if
(
isShot
=
true
)
{
//
if (isShot = true) {
shoot
();
//
shoot();
}
//
}
isShot
=
true
;
//
isShot= true;
Main
.
HealthEnemy
--;
Main
.
HealthEnemy
--;
System
.
out
.
println
(
"Enemy Health is "
+
Main
.
HealthEnemy
);
System
.
out
.
println
(
"Enemy Health is "
+
Main
.
HealthEnemy
);
if
(
Main
.
HealthEnemy
<
1
)
{
if
(
Main
.
HealthEnemy
<
1
)
{
...
@@ -113,11 +113,11 @@ enemyTurn();
...
@@ -113,11 +113,11 @@ enemyTurn();
setFill
(
Color
.
BLUE
);
setFill
(
Color
.
BLUE
);
//Orange shows a hit, whereas Blue represents a miss
//Orange shows a hit, whereas Blue represents a miss
if
(
isShot
=
true
)
{
//
if (isShot = true) {
shoot
();
//
shoot();
}
//
}
isShot
=
true
;
//
isShot = true;
enemyTurn
();
//
enemyTurn();
}
}
...
@@ -312,9 +312,9 @@ enemyTarget = Main.BoardPlayer.getCell(ComputerX, ComputerY); //Sets the compute
...
@@ -312,9 +312,9 @@ enemyTarget = Main.BoardPlayer.getCell(ComputerX, ComputerY); //Sets the compute
if
(
enemyTarget
.
isShip
)
{
if
(
enemyTarget
.
isShip
)
{
enemyTarget
.
setFill
(
Color
.
ORANGE
);
enemyTarget
.
setFill
(
Color
.
ORANGE
);
if
(
Cell
.
isShotEnemy
=
true
)
{
//
if (Cell.isShotEnemy = true) {
enemyTurn
();
//
enemyTurn();
}
//
}
Main
.
HealthPlayer
--;
Main
.
HealthPlayer
--;
System
.
out
.
println
(
"Player Health is "
+
Main
.
HealthPlayer
);
System
.
out
.
println
(
"Player Health is "
+
Main
.
HealthPlayer
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment