First start of adding 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.
Binary file not shown.
Binary file not shown.
@@ -21,7 +21,7 @@ import java.util.TimerTask;
|
||||
|
||||
public class CanvasView extends View
|
||||
{
|
||||
//region variabelen
|
||||
// Variabelen
|
||||
Resources r;
|
||||
|
||||
// Sizes
|
||||
@@ -281,17 +281,28 @@ public class CanvasView extends View
|
||||
|
||||
Bitmap Font0, Font1, Font2, Font3, Font4, Font5, Font6, Font7, Font8, Font9;
|
||||
|
||||
|
||||
// Score.
|
||||
public int startLevel = 0;
|
||||
int level = 0;
|
||||
|
||||
int lines = 0;
|
||||
int score = 0;
|
||||
|
||||
// Game State.
|
||||
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;
|
||||
int GameState = GS_STOPPED;
|
||||
|
||||
// Add Settings.
|
||||
public boolean PayedVersion;
|
||||
|
||||
// Timer.
|
||||
TimerTask MoveEvent = new TimerTask() {
|
||||
@Override
|
||||
public void run() {
|
||||
@@ -312,8 +323,6 @@ public class CanvasView extends View
|
||||
|
||||
MediaPlayer mp;
|
||||
|
||||
//endregion variabelen
|
||||
|
||||
/// Init functions
|
||||
|
||||
public CanvasView(Context context)
|
||||
@@ -368,6 +377,8 @@ public class CanvasView extends View
|
||||
|
||||
GamePlaying = true;
|
||||
|
||||
GameState = GS_PLAYING;
|
||||
|
||||
handler.removeCallbacksAndMessages(null);
|
||||
handler.postDelayed(runnable, 100);
|
||||
}
|
||||
@@ -595,6 +606,8 @@ public class CanvasView extends View
|
||||
{
|
||||
mp.pause();
|
||||
GamePlaying = false;
|
||||
|
||||
GameState = GS_PAUSED;
|
||||
}
|
||||
|
||||
public void onResume()
|
||||
@@ -1231,12 +1244,13 @@ public class CanvasView extends View
|
||||
{
|
||||
if (moveX >= 28 && moveX <= 55 && moveY >= 143 && moveY <= 155) // Menu
|
||||
{
|
||||
if (GamePlaying)
|
||||
if (GameState == GS_PLAYING)
|
||||
onPause();
|
||||
else
|
||||
{
|
||||
mp.start();
|
||||
GamePlaying = true;
|
||||
GameState = GS_PLAYING;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1244,7 +1258,7 @@ public class CanvasView extends View
|
||||
|
||||
if (!goingDown)
|
||||
{
|
||||
if (GamePlaying)
|
||||
if (GameState == GS_PLAYING)
|
||||
{
|
||||
if (!GameOver)
|
||||
{
|
||||
@@ -1311,7 +1325,7 @@ public class CanvasView extends View
|
||||
/// Game Logic
|
||||
private void GoDown()
|
||||
{
|
||||
if (GamePlaying)
|
||||
if (GameState == GS_PLAYING)
|
||||
{
|
||||
if (!GameOver)
|
||||
{
|
||||
@@ -1337,6 +1351,9 @@ public class CanvasView extends View
|
||||
// GameOver
|
||||
GameOver = true;
|
||||
GamePlaying = false;
|
||||
|
||||
GameState = GS_GAMEOVER ;
|
||||
|
||||
mp.stop();
|
||||
this.postInvalidate();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user