Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
S
Star Wars Game
Project
Project
Details
Activity
Releases
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
Benjamin LEROUX
Star Wars Game
Commits
4714b764
Commit
4714b764
authored
Mar 05, 2021
by
Benjamin LEROUX
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
last COMMIT
parent
035fb89e
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
1 addition
and
5 deletions
+1
-5
MainActivity.java
app/src/main/java/com/imtm1/starwarsgame/MainActivity.java
+1
-5
No files found.
app/src/main/java/com/imtm1/starwarsgame/MainActivity.java
View file @
4714b764
...
@@ -291,8 +291,8 @@ public class MainActivity extends AppCompatActivity implements SensorEventListen
...
@@ -291,8 +291,8 @@ public class MainActivity extends AppCompatActivity implements SensorEventListen
boolean
sontEnCollision
(
ImageView
firstView
,
ImageView
secondView
)
{
boolean
sontEnCollision
(
ImageView
firstView
,
ImageView
secondView
)
{
int
[]
firstPosition
=
new
int
[
2
];
int
[]
firstPosition
=
new
int
[
2
];
int
[]
secondPosition
=
new
int
[
2
];
int
[]
secondPosition
=
new
int
[
2
];
firstView
.
getLocationOnScreen
(
firstPosition
);
firstView
.
getLocationOnScreen
(
firstPosition
);
secondView
.
getLocationOnScreen
(
secondPosition
);
secondView
.
getLocationOnScreen
(
secondPosition
);
...
@@ -301,10 +301,6 @@ public class MainActivity extends AppCompatActivity implements SensorEventListen
...
@@ -301,10 +301,6 @@ public class MainActivity extends AppCompatActivity implements SensorEventListen
Rect
rectSecondView
=
new
Rect
(
secondPosition
[
0
],
secondPosition
[
1
],
Rect
rectSecondView
=
new
Rect
(
secondPosition
[
0
],
secondPosition
[
1
],
secondPosition
[
0
]
+
secondView
.
getMeasuredWidth
(),
secondPosition
[
1
]
+
secondView
.
getMeasuredHeight
());
secondPosition
[
0
]
+
secondView
.
getMeasuredWidth
(),
secondPosition
[
1
]
+
secondView
.
getMeasuredHeight
());
float
x_inter
=
Math
.
max
(
0
,
Math
.
min
(
rectFirstView
.
right
,
rectSecondView
.
right
)
-
Math
.
max
(
rectFirstView
.
left
,
rectSecondView
.
left
));
float
y_inter
=
Math
.
max
(
0
,
Math
.
min
(
rectFirstView
.
bottom
,
rectSecondView
.
bottom
)
-
Math
.
max
(
rectFirstView
.
top
,
rectSecondView
.
top
));
float
aireInter
=
x_inter
*
y_inter
;
return
(
rectFirstView
.
intersect
(
rectSecondView
));
return
(
rectFirstView
.
intersect
(
rectSecondView
));
}
}
}
}
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