Skip to content

Commit

Permalink
Fixed control pad accuracy
Browse files Browse the repository at this point in the history
Fixed control pad accuracy
  • Loading branch information
lschmid83 committed Nov 2, 2023
1 parent 7265746 commit f5cc7a7
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 9 deletions.
17 changes: 17 additions & 0 deletions SpaceWar-Android/.idea/deploymentTargetDropDown.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -668,11 +668,11 @@ public void setTouchControls(float x, float y, boolean pressed) {
x = (float)(x / w * 400.0);
y = (float)(y / h * 240.0);

//Log.i("Controls", "x="+x + " y=" + y);
Log.i("Controls", "x="+x + " y=" + y);

//up
x1 = 28;
x2 = 74;
x1 = 36;
x2 = 68;
y1 = 134;
y2 = 176;
if (x >= x1 && x <= x2 && y > y1 && y <= y2) {
Expand All @@ -687,8 +687,8 @@ public void setTouchControls(float x, float y, boolean pressed) {
}

//down
x1 = 28;
x2 = 74;
x1 = 36;
x2 = 68;
y1 = 196;
y2 = 240;
if (x >= x1 && x < x2 && y > y1 && y <= y2) {
Expand All @@ -705,8 +705,8 @@ public void setTouchControls(float x, float y, boolean pressed) {
//left
x1 = 0;
x2 = 41;
y1 = 163;
y2 = 207;
y1 = 168;
y2 = 201;
if (x >= x1 && x <= x2 && y >= y1 && y <= y2) {
if (Settings.State.equals("game") && !Settings.Paused
&& mPlayer != null) {
Expand All @@ -721,8 +721,8 @@ public void setTouchControls(float x, float y, boolean pressed) {
//right
x1 = 62;
x2 = 100;
y1 = 163;
y2 = 207;
y1 = 168;
y2 = 201;
if (x >= x1 && x <= x2 && y > y1 && y < y2) {
if (Settings.State.equals("game") && !Settings.Paused
&& mPlayer != null) {
Expand Down

0 comments on commit f5cc7a7

Please sign in to comment.