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
2b3e1890
Commit
2b3e1890
authored
Jul 31, 2020
by
9831111
🙂
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix wall collision.
parent
d569ab0f
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
27 additions
and
12 deletions
+27
-12
GameState.java
src/GameState.java
+27
-12
No files found.
src/GameState.java
View file @
2b3e1890
...
@@ -128,41 +128,56 @@ public class GameState {
...
@@ -128,41 +128,56 @@ public class GameState {
if
(
verticalWallCollision
()
!=
null
)
{
if
(
verticalWallCollision
()
!=
null
)
{
if
(
verticalWallCollision
().
getX
()
>
locX
&&
px
>
0
)
{
if
(
verticalWallCollision
().
getX
()
>
locX
&&
px
>
0
)
{
if
((
rotateAmount
<=
90
&&
rotateAmount
>=
-
90
)
||
(
rotateAmount
<=
-
270
&&
rotateAmount
>
-
360
)
||
(
rotateAmount
>=
270
&&
rotateAmount
<
360
))
{
if
((
rotateAmount
<=
90
&&
rotateAmount
>=
-
90
)
||
(
rotateAmount
<=
-
270
&&
rotateAmount
>
-
360
)
||
(
rotateAmount
>=
270
&&
rotateAmount
<
360
))
{
System
.
out
.
println
(
"1"
);
return
false
;
return
false
;
}
else
return
true
;
}
else
return
true
;
}
}
if
(
verticalWallCollision
().
getX
()
<
locX
&&
px
<
0
)
{
if
(
verticalWallCollision
().
getX
()
<
locX
&&
px
<
0
)
{
if
((
rotateAmount
<=
90
&&
rotateAmount
>=
-
90
)
||
(
rotateAmount
<=
-
270
&&
rotateAmount
>
-
360
)
||
(
rotateAmount
>=
270
&&
rotateAmount
<
360
))
{
if
((
rotateAmount
<=
90
&&
rotateAmount
>=
-
90
)
||
(
rotateAmount
<=
-
270
&&
rotateAmount
>
-
360
)
||
(
rotateAmount
>=
270
&&
rotateAmount
<
360
))
{
System
.
out
.
println
(
"2"
);
return
false
;
return
false
;
}
else
return
true
;
}
else
return
true
;
}
}
if
(
verticalWallCollision
().
getX
()
>
locX
&&
px
<
0
)
{
if
(
verticalWallCollision
().
getX
()
>
locX
&&
px
<
0
)
{
if
((
rotateAmount
>=
90
&&
rotateAmount
<=
270
)
||
(
rotateAmount
<=
-
90
&&
rotateAmount
>=
-
270
))
{
if
((
rotateAmount
>=
90
&&
rotateAmount
<=
270
)
||
(
rotateAmount
<=
-
90
&&
rotateAmount
>=
-
270
))
{
System
.
out
.
println
(
"3"
);
return
false
;
return
false
;
}
else
return
true
;
}
else
return
true
;
}
}
if
(
verticalWallCollision
().
getX
()
<
locX
&&
px
>
0
)
{
if
(
verticalWallCollision
().
getX
()
<
locX
&&
px
>
0
)
{
if
((
rotateAmount
>=
90
||
rotateAmount
<=
270
)
||
(
rotateAmount
<=
-
90
&&
rotateAmount
>=
-
270
))
{
if
((
rotateAmount
>=
90
||
rotateAmount
<=
270
)
||
(
rotateAmount
<=
-
90
&&
rotateAmount
>=
-
270
))
{
System
.
out
.
println
(
"4"
);
return
false
;
return
false
;
}
else
return
true
;
}
else
return
true
;
}
}
}
}
if
(
horizontalWallCollision
()
!=
null
)
{
if
(
horizontalWallCollision
()
!=
null
)
{
if
(
horizontalWallCollision
().
getY
()
>
locY
&&
px
>
0
&&
((
rotateAmount
<=
180
&&
rotateAmount
>=
0
)
||
(
rotateAmount
<=
-
180
&&
rotateAmount
>
-
360
)))
if
(
horizontalWallCollision
().
getY
()
>
locY
&&
px
>
0
)
{
return
false
;
if
((
rotateAmount
<=
180
&&
rotateAmount
>=
0
)
||
(
rotateAmount
<=
-
180
&&
rotateAmount
>
-
360
))
{
if
(
horizontalWallCollision
().
getY
()
<
locY
&&
px
<
0
&&
((
rotateAmount
<=
180
&&
rotateAmount
>=
0
)
||
(
rotateAmount
<=
-
180
&&
rotateAmount
>
-
360
)))
System
.
out
.
println
(
"1"
);
return
false
;
return
false
;
if
(
horizontalWallCollision
().
getY
()
<
locY
&&
px
>
0
&&
((
rotateAmount
>=
-
180
&&
rotateAmount
<=
0
)
||
(
rotateAmount
>=
180
&&
rotateAmount
<
360
)))
}
else
return
true
;
return
false
;
}
if
(
horizontalWallCollision
().
getY
()
>
locY
&&
px
<
0
&&
((
rotateAmount
>=
-
180
&&
rotateAmount
<=
0
)
||
(
rotateAmount
>=
180
&&
rotateAmount
<
360
)))
if
(
horizontalWallCollision
().
getY
()
<
locY
&&
px
<
0
)
{
return
false
;
if
((
rotateAmount
<=
180
&&
rotateAmount
>=
0
)
||
(
rotateAmount
<=
-
180
&&
rotateAmount
>
-
360
))
{
System
.
out
.
println
(
"2"
);
return
false
;
}
else
return
true
;
}
if
(
horizontalWallCollision
().
getY
()
<
locY
&&
px
>
0
)
{
if
((
rotateAmount
>=
-
180
&&
rotateAmount
<=
0
)
||
(
rotateAmount
>=
180
&&
rotateAmount
<
360
))
{
System
.
out
.
println
(
"3"
);
return
false
;
}
else
return
true
;
}
if
(
horizontalWallCollision
().
getY
()
>
locY
&&
px
<
0
)
{
if
((
rotateAmount
>=
-
180
&&
rotateAmount
<=
0
)
||
(
rotateAmount
>=
180
&&
rotateAmount
<
360
))
{
System
.
out
.
println
(
"4"
);
return
false
;
}
else
return
true
;
}
}
}
return
true
;
return
true
;
...
...
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