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
2133eef4
Commit
2133eef4
authored
Jul 24, 2020
by
nargessalehi98
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add fixed map
parent
096e9cb2
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
14 deletions
+5
-14
GameFrame.java
src/GameFrame.java
+5
-14
No files found.
src/GameFrame.java
View file @
2133eef4
...
...
@@ -146,7 +146,7 @@ public class GameFrame extends JFrame {
// g2d.drawImage(image1,state.locX,state.locY,null);
g2d
.
setColor
(
Color
.
black
);
g2d
.
drawImage
(
rotate
(
image1
,
state
.
rotateAmount
),
state
.
locX
,
state
.
locY
,
null
);
File
accounts
=
new
File
(
"map
4
.txt"
);
File
accounts
=
new
File
(
"map
2
.txt"
);
setName
(
g2d
,
"narges"
,
"sara"
,
"bardia"
);
...
...
@@ -155,25 +155,21 @@ public class GameFrame extends JFrame {
int
currentX
=
30
;
int
currentY
=
60
;
setMap
(
g2d
,
new
File
(
"map.txt"
));
setMap
(
g2d
,
new
File
(
"map.txt"
));
while
(
scanner
.
hasNext
())
{
char
[]
chars
=
scanner
.
next
().
toCharArray
();
for
(
int
k
=
0
;
k
<
chars
.
length
;
k
++)
{
if
(
lineCounter
%
2
==
0
)
{
if
(
k
%
2
==
0
)
{
if
(
chars
[
k
]
==
'1'
)
if
(
chars
[
k
]
==
'1'
&&
k
-
1
>=
1
&&
k
+
1
<
chars
.
length
&&
chars
[
k
+
1
]==
'1'
&&
chars
[
k
-
1
]==
'1'
)
g2d
.
fillRect
(
currentX
,
currentY
,
5
,
5
);
currentX
+=
5
;
}
else
{
if
(
chars
[
k
]
==
'1'
)
g2d
.
fillRect
(
currentX
,
currentY
,
50
,
5
);
currentX
+=
50
;
}
}
if
(
lineCounter
%
2
!=
0
)
{
...
...
@@ -181,12 +177,8 @@ public class GameFrame extends JFrame {
if
(
chars
[
k
]
==
'1'
)
g2d
.
fillRect
(
currentX
,
currentY
,
5
,
50
);
currentX
+=
5
;
}
else
{
// if (chars[k] == '1') {
// g2d.setColor(Color.white);
// //g2d.fillRect(currentX, currentY, 50, 50);
// g2d.setColor(Color.black);
// }
currentX
+=
50
;
}
}
...
...
@@ -195,7 +187,6 @@ public class GameFrame extends JFrame {
if
(
lineCounter
%
2
==
0
)
currentY
+=
5
;
else
currentY
+=
50
;
lineCounter
++;
}
}
catch
(
Exception
ee
)
{
ee
.
printStackTrace
();
...
...
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