I'm trying to use the measured height and add it too my if statement so that when 'blueY' touches the bottom of the screen it results in game over. Not sure if error is in getting the height or if it is with the if statement.
My if statement is as follows:
if (blueY >= height) {
// Game Over
timer.cancel();
timer = null;
Intent intent = new Intent(getApplicationContext(), Results.class);
intent.putExtra("SCORE", score);
startActivity(intent);
}
and in onCreate:
DisplayMetrics displayMetrics = new DisplayMetrics();
getWindowManager().getDefaultDisplay().getMetrics(displayMetrics);
height = mFrame.getMeasuredHeight() - startLabel.getMeasuredHeight() ;
// I have also tried this :height = displayMetrics.heightPixels;
width = displayMetrics.widthPixels;
I am very new to Java so sorry if this sound dumb.