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
4 years ago
by
nargessalehi98
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add alive field.
parent
3c1f24f1
master
No related merge requests found
Show 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
java.awt.*
;
import
java.awt.image.BufferedImage
;
import
java.io.File
;
import
java.io.IOException
;
...
...
@@ -10,28 +9,24 @@ public class Tank {
int
y
;
double
rotateAmount
;
BufferedImage
icon
;
Bullet
s
bullets
;
Bullet
bullet
;
GameState
state
;
boolean
alive
;
String
prize
;
int
Health
;
public
String
getPrize
()
{
return
prize
;
}
public
void
setPrize
(
String
prize
)
{
this
.
prize
=
prize
;
}
public
Tank
(
String
path
)
{
public
Tank
(
String
path
,
int
x
,
int
y
,
double
rotateAmount
)
{
Health
=
100
;
try
{
icon
=
ImageIO
.
read
(
new
File
(
path
));
}
catch
(
IOException
e
)
{
System
.
out
.
println
(
"File not found "
);
}
alive
=
true
;
this
.
x
=
x
;
this
.
y
=
y
;
this
.
rotateAmount
=
rotateAmount
;
bullets
=
new
Bullets
();
}
public
BufferedImage
getIcon
()
{
...
...
@@ -50,14 +45,6 @@ public class Tank {
return
state
;
}
public
double
getRotateAmount
()
{
return
rotateAmount
;
}
public
Bullets
getBullets
()
{
return
bullets
;
}
public
int
getHealth
()
{
return
Health
;
}
...
...
@@ -65,4 +52,12 @@ public class Tank {
public
void
setHealth
(
int
healthDamage
)
{
Health
=
Health
-
healthDamage
;
}
public
String
getPrize
()
{
return
prize
;
}
public
void
setPrize
(
String
prize
)
{
this
.
prize
=
prize
;
}
}
\ No newline at end of file
This diff is collapsed.
Click to expand it.
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