Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
B
Battleships2
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
joseph.dive
Battleships2
Commits
6d3ffb15
Unverified
Commit
6d3ffb15
authored
Jun 05, 2019
by
Ragnat0skr
Committed by
GitHub
Jun 05, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add files via upload
parent
4a54f26d
Changes
3
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
410 additions
and
0 deletions
+410
-0
Main.java
Main.java
+363
-0
Sea.java
Sea.java
+12
-0
Ships.java
Ships.java
+35
-0
No files found.
Main.java
0 → 100644
View file @
6d3ffb15
This diff is collapsed.
Click to expand it.
Sea.java
0 → 100644
View file @
6d3ffb15
import
javafx.scene.shape.Rectangle
;
public
class
Sea
extends
Rectangle
{
int
x
;
// Each sea tile has 2 main propeties, x and y placements
int
y
;
// Other propeties will be determined in main using javafx
public
Sea
(){
}
}
Ships.java
0 → 100644
View file @
6d3ffb15
public
class
Ships
extends
Main
{
public
int
shipType
;
// Set up variables
public
int
shipHp
;
public
boolean
shipIsVertical
=
true
;
// True for vertical, false for horizontal
// SHIP TYPES
// 1 does not exist
// 2 = Patrol boat, size 2
// 3 = Destroyer, size 3
// 4 = Battleship, size 4
// 5 = Aircraft carrier, size 5
//boolean shipIsVertical = true;
public
Ships
(
int
shipType
,
boolean
shipIsVertical
)
{
this
.
shipType
=
shipType
;
// Sets unique variable for each ship
this
.
shipIsVertical
=
shipIsVertical
;
shipHp
=
shipType
;
// Hp based on type
}
public
void
shipIsHit
()
{
int
shipHp
=
shipType
;
shipHp
=
shipHp
-
1
;
}
public
boolean
shipIsNotSunk
()
// Changed from shipSunk
{
return
shipHp
>=
0
;
// Fires if ship Hp reaches 0 (or below somehow)
}
}
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