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
94e27df8
Commit
94e27df8
authored
Jul 29, 2020
by
nargessalehi98
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add back and for movement.
parent
df5b7f99
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
6 deletions
+19
-6
GameState.java
src/GameState.java
+19
-6
No files found.
src/GameState.java
View file @
94e27df8
...
...
@@ -32,6 +32,7 @@ public class GameState {
private
boolean
one
=
false
;
private
boolean
two
=
false
;
private
boolean
three
=
false
;
private
int
step
=
0
;
public
GameState
(
int
num
)
{
...
...
@@ -78,30 +79,42 @@ public class GameState {
locX
=
mouseX
-
diam
/
2
;
}
if
(
step
>
2
)
step
=
0
;
if
(
keyUP
)
{
boolean
Permission
=
true
;
boolean
Permission
Down
=
true
;
for
(
Wall
wall
:
Controller
.
walls
)
{
if
(
wall
.
intersects
(
getBounds
(
locX
+
5
,
locY
+
5
)))
{
System
.
out
.
println
(
"4"
);
Permission
=
false
;
Permission
Down
=
false
;
break
;
}
}
if
(
Permission
)
if
(
PermissionDown
)
move
(+
5
);
if
(!
PermissionDown
&&
step
<
2
){
move
(+
5
);
step
++;
}
}
if
(
keyDOWN
)
{
boolean
Permission
=
true
;
boolean
Permission
Up
=
true
;
for
(
Wall
wall
:
Controller
.
walls
)
{
if
(
wall
.
intersects
(
getBounds
(
locX
+
5
,
locY
+
5
)))
{
System
.
out
.
println
(
"5"
);
Permission
=
false
;
Permission
Up
=
false
;
break
;
}
}
if
(
Permission
)
if
(
Permission
Up
)
move
(-
5
);
if
(!
PermissionUp
&&
step
<
2
)
{
move
(-
5
);
step
++;
System
.
out
.
println
(
step
);
}
}
...
...
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