Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
J
JTankTrouble
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
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
9831111
JTankTrouble
Commits
a737b010
Commit
a737b010
authored
Aug 03, 2020
by
nargessalehi98
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add alive field.
parent
3c1f24f1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
21 deletions
+16
-21
Tank.java
src/Tank.java
+16
-21
No files found.
src/Tank.java
View file @
a737b010
import
javax.imageio.ImageIO
;
import
javax.imageio.ImageIO
;
import
java.awt.*
;
import
java.awt.image.BufferedImage
;
import
java.awt.image.BufferedImage
;
import
java.io.File
;
import
java.io.File
;
import
java.io.IOException
;
import
java.io.IOException
;
...
@@ -10,28 +9,24 @@ public class Tank {
...
@@ -10,28 +9,24 @@ public class Tank {
int
y
;
int
y
;
double
rotateAmount
;
double
rotateAmount
;
BufferedImage
icon
;
BufferedImage
icon
;
Bullet
s
bullets
;
Bullet
bullet
;
GameState
state
;
GameState
state
;
boolean
alive
;
String
prize
;
String
prize
;
int
Health
;
int
Health
;
public
String
getPrize
()
{
public
Tank
(
String
path
,
int
x
,
int
y
,
double
rotateAmount
)
{
return
prize
;
}
public
void
setPrize
(
String
prize
)
{
this
.
prize
=
prize
;
}
public
Tank
(
String
path
)
{
Health
=
100
;
Health
=
100
;
try
{
try
{
icon
=
ImageIO
.
read
(
new
File
(
path
));
icon
=
ImageIO
.
read
(
new
File
(
path
));
}
catch
(
IOException
e
)
{
}
catch
(
IOException
e
)
{
System
.
out
.
println
(
"File not found "
);
System
.
out
.
println
(
"File not found "
);
}
}
alive
=
true
;
this
.
x
=
x
;
this
.
y
=
y
;
this
.
rotateAmount
=
rotateAmount
;
bullets
=
new
Bullets
();
}
}
public
BufferedImage
getIcon
()
{
public
BufferedImage
getIcon
()
{
...
@@ -50,14 +45,6 @@ public class Tank {
...
@@ -50,14 +45,6 @@ public class Tank {
return
state
;
return
state
;
}
}
public
double
getRotateAmount
()
{
return
rotateAmount
;
}
public
Bullets
getBullets
()
{
return
bullets
;
}
public
int
getHealth
()
{
public
int
getHealth
()
{
return
Health
;
return
Health
;
}
}
...
@@ -65,4 +52,12 @@ public class Tank {
...
@@ -65,4 +52,12 @@ public class Tank {
public
void
setHealth
(
int
healthDamage
)
{
public
void
setHealth
(
int
healthDamage
)
{
Health
=
Health
-
healthDamage
;
Health
=
Health
-
healthDamage
;
}
}
}
public
String
getPrize
()
{
return
prize
;
}
public
void
setPrize
(
String
prize
)
{
this
.
prize
=
prize
;
}
}
\ No newline at end of file
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