intergration GameStage Pipeline

This commit is contained in:
Administrator
2014-02-18 10:39:07 +01:00
parent 1a34673859
commit e01836e91c
6 changed files with 65 additions and 60 deletions
BIN
View File
Binary file not shown.
BIN
View File
Binary file not shown.
Binary file not shown.
BIN
View File
Binary file not shown.
+65 -60
View File
@@ -292,11 +292,11 @@ public class CanvasView extends View
boolean GamePlaying = false;
boolean GameOver = false;
final int GS_STOPPED = 0;
final int GS_LOADING = 1;
final int GS_PLAYING = 2;
final int GS_GAMEOVER = 3;
final int GS_PAUSED = 4;
final int GS_STOPPED = 0;
final int GS_LOADING = 1;
final int GS_PLAYING = 2;
final int GS_GAMEOVER = 3;
final int GS_PAUSED = 4;
int GameState = GS_STOPPED;
// Add Settings.
@@ -1242,7 +1242,7 @@ public class CanvasView extends View
{
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)
onPause();
@@ -1260,63 +1260,68 @@ public class CanvasView extends View
{
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
{
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();
}
}
MoveBlockDown();
}
this.postInvalidate();
}
}
}