intergration GameStage Pipeline
This commit is contained in:
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -292,11 +292,11 @@ public class CanvasView extends View
|
|||||||
boolean GamePlaying = false;
|
boolean GamePlaying = false;
|
||||||
boolean GameOver = false;
|
boolean GameOver = false;
|
||||||
|
|
||||||
final int GS_STOPPED = 0;
|
final int GS_STOPPED = 0;
|
||||||
final int GS_LOADING = 1;
|
final int GS_LOADING = 1;
|
||||||
final int GS_PLAYING = 2;
|
final int GS_PLAYING = 2;
|
||||||
final int GS_GAMEOVER = 3;
|
final int GS_GAMEOVER = 3;
|
||||||
final int GS_PAUSED = 4;
|
final int GS_PAUSED = 4;
|
||||||
int GameState = GS_STOPPED;
|
int GameState = GS_STOPPED;
|
||||||
|
|
||||||
// Add Settings.
|
// Add Settings.
|
||||||
@@ -1242,7 +1242,7 @@ public class CanvasView extends View
|
|||||||
{
|
{
|
||||||
if (!GameOver)
|
if (!GameOver)
|
||||||
{
|
{
|
||||||
if (moveX >= 28 && moveX <= 55 && moveY >= 143 && moveY <= 155) // Menu
|
if (moveX >= 28 && moveX <= 55 && moveY >= 143 && moveY <= 155) // Start
|
||||||
{
|
{
|
||||||
if (GameState == GS_PLAYING)
|
if (GameState == GS_PLAYING)
|
||||||
onPause();
|
onPause();
|
||||||
@@ -1260,63 +1260,68 @@ public class CanvasView extends View
|
|||||||
{
|
{
|
||||||
if (GameState == GS_PLAYING)
|
if (GameState == GS_PLAYING)
|
||||||
{
|
{
|
||||||
if (!GameOver)
|
InputsGamePlaying(x, y, Released);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void InputsGamePlaying(float x, float y, boolean Released)
|
||||||
|
{
|
||||||
|
int moveX = (int)((x / Width) * 90);
|
||||||
|
int moveY = (int)((y / Height) * 160);
|
||||||
|
|
||||||
|
if (!Released)
|
||||||
|
{
|
||||||
|
if (moveX >= 1 && moveX <= 11 && moveY >= 122 && moveY <= 133) // Left
|
||||||
|
{
|
||||||
|
if(CanBlockGoLeft())
|
||||||
{
|
{
|
||||||
if (!Released)
|
MoveBlockLeft();
|
||||||
|
this.postInvalidate();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (moveX >= 55 && moveX <= 70 && moveY >= 122 && moveY <= 137) // Rotate Left
|
||||||
|
{
|
||||||
|
RotateBlockLeft();
|
||||||
|
this.postInvalidate();
|
||||||
|
}
|
||||||
|
else if (moveX >= 74 && moveX <= 88 && moveY >= 115 && moveY <= 137) // Rotate Right
|
||||||
|
{
|
||||||
|
RotateBlockRight();
|
||||||
|
this.postInvalidate();
|
||||||
|
}
|
||||||
|
else if (moveX >= 21 && moveX <= 33 && moveY >= 122 && moveY <= 133) // Right
|
||||||
|
{
|
||||||
|
if(CanBlockGoRight())
|
||||||
|
{
|
||||||
|
MoveBlockRight();
|
||||||
|
this.postInvalidate();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (moveX >= 11 && moveX <= 21 && moveY >= 133 && moveY <= 144) // Down
|
||||||
|
{
|
||||||
|
if (!Released)
|
||||||
|
{
|
||||||
|
// Soft Drop
|
||||||
|
if (CanBlockGoDown())
|
||||||
|
{
|
||||||
|
MoveBlockDown();
|
||||||
|
this.postInvalidate();
|
||||||
|
}
|
||||||
|
OldInputTime = (int)System.currentTimeMillis();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
int CurrentTime = (int)System.currentTimeMillis();
|
||||||
|
if ((CurrentTime - OldInputTime) >= 250)
|
||||||
|
{
|
||||||
|
// Hard Drop
|
||||||
|
while (CanBlockGoDown())
|
||||||
{
|
{
|
||||||
if (moveX >= 1 && moveX <= 11 && moveY >= 122 && moveY <= 133) // Left
|
MoveBlockDown();
|
||||||
{
|
|
||||||
if(CanBlockGoLeft())
|
|
||||||
{
|
|
||||||
MoveBlockLeft();
|
|
||||||
this.postInvalidate();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (moveX >= 55 && moveX <= 70 && moveY >= 122 && moveY <= 137) // Rotate Left
|
|
||||||
{
|
|
||||||
RotateBlockLeft();
|
|
||||||
this.postInvalidate();
|
|
||||||
}
|
|
||||||
else if (moveX >= 74 && moveX <= 88 && moveY >= 115 && moveY <= 137) // Rotate Right
|
|
||||||
{
|
|
||||||
RotateBlockRight();
|
|
||||||
this.postInvalidate();
|
|
||||||
}
|
|
||||||
else if (moveX >= 21 && moveX <= 33 && moveY >= 122 && moveY <= 133) // Right
|
|
||||||
{
|
|
||||||
if(CanBlockGoRight())
|
|
||||||
{
|
|
||||||
MoveBlockRight();
|
|
||||||
this.postInvalidate();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (moveX >= 11 && moveX <= 21 && moveY >= 133 && moveY <= 144) // Down
|
|
||||||
{
|
|
||||||
if (!Released)
|
|
||||||
{
|
|
||||||
// Soft Drop
|
|
||||||
if (CanBlockGoDown())
|
|
||||||
{
|
|
||||||
MoveBlockDown();
|
|
||||||
this.postInvalidate();
|
|
||||||
}
|
|
||||||
OldInputTime = (int)System.currentTimeMillis();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
int CurrentTime = (int)System.currentTimeMillis();
|
|
||||||
if ((CurrentTime - OldInputTime) >= 250)
|
|
||||||
{
|
|
||||||
// Hard Drop
|
|
||||||
while (CanBlockGoDown())
|
|
||||||
{
|
|
||||||
MoveBlockDown();
|
|
||||||
}
|
|
||||||
this.postInvalidate();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
this.postInvalidate();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user