From 48fb6ab3ec3e15987eb19fa8b3c2157599333e5b Mon Sep 17 00:00:00 2001 From: Gabriel Grimberg Date: Tue, 7 Feb 2017 20:28:20 +0000 Subject: [PATCH] Stable Release --- JetScape/JetScape.pde | 16 ++++++---------- JetScape/KeyControl.pde | 8 ++++---- JetScape/MovingBackground.pde | 10 +++++----- JetScape/Player.pde | 2 ++ 4 files changed, 17 insertions(+), 19 deletions(-) diff --git a/JetScape/JetScape.pde b/JetScape/JetScape.pde index 863f357..c64c302 100644 --- a/JetScape/JetScape.pde +++ b/JetScape/JetScape.pde @@ -70,10 +70,10 @@ boolean[] keys = new boolean[PRESSED]; /* - Images - */ -//Player sprite. +//Player Image. PImage playerChar; -//Jetpack sprite. +//Jetpack Image PImage jetpackImg; //Repeating background. @@ -106,7 +106,6 @@ float gravity = 5; int gameState = 0; //Speed variables. -float speed = 3; float speedBg = 4; //Background speed. float speedc = 4; //Coin Speed. float speedDanger = 4; @@ -116,7 +115,6 @@ int score; int highScore = 0; int recentScore = 0; - //Level counter int level = 1; @@ -125,11 +123,8 @@ int phaseCheck = 0; public void setup() { - //Size of screen. - size(1200,600,P2D); - - //frameRate(120); - + size(1200,600,P2D); //Size of screen. + /* Creating new Objects for MenuButtons */ StartGame = new MenuButtons(width / 2, 250, 50, 5); EndGame = new MenuButtons(width / 2, 450, 50, 5); @@ -249,7 +244,7 @@ public void hClicked() String lines[] = loadStrings("help.txt"); //Loading up the file. stroke(255); //White outline for the words. - //Not in a loop duo to position problems. + //Not in a loop due to position problems. textDisplay(lines[0], TextForm.Big, 375, 50); textDisplay(lines[1], TextForm.Normal, 475, 150); textDisplay(lines[2], TextForm.Normal, 350, 200); @@ -401,6 +396,7 @@ public void backtoMain() } } +/* Method to calculate the highscore */ public void highScore() { if(gameState == 2) diff --git a/JetScape/KeyControl.pde b/JetScape/KeyControl.pde index bb02700..31a43b6 100644 --- a/JetScape/KeyControl.pde +++ b/JetScape/KeyControl.pde @@ -1,9 +1,9 @@ public void mousePressed() { - quitClicked(); - startClicked(); - hClicked(); - highClicked(); + quitClicked(); //Quit button. + startClicked(); //Start button. + hClicked(); //Help button. + highClicked(); //Highscore button } public void mouseReleased() diff --git a/JetScape/MovingBackground.pde b/JetScape/MovingBackground.pde index 6655f25..23ca461 100644 --- a/JetScape/MovingBackground.pde +++ b/JetScape/MovingBackground.pde @@ -4,18 +4,18 @@ private class MovingBackground private void mvBack() { //Background scrolling. - for(int i = 0; i < repeatBg.length; i++) + for(int i = 0; i < repeatBg.length; i++) //Lenght of background. { image(background[i],repeatBg[i],0); repeatBg[i] = repeatBg[i] - speedBg; - if(repeatBg[i] + width <= 0) + if(repeatBg[i] + width <= 0) //Making the background go back to the start. { - repeatBg[i] = width -= SPEEDCHANGE; - speedBg += SPEEDCHANGE; + repeatBg[i] = width -= SPEEDCHANGE; //Then moving it to the left until it hits 0. + speedBg += SPEEDCHANGE; //Changing the speed for the background. speedc += SPEEDCHANGE; //Changing the speed for coins. speedDanger += SPEEDCHANGE; //Changing the speed for Danger. - level++; + level++; //Incrementing the leve every time a background gets completed. } } diff --git a/JetScape/Player.pde b/JetScape/Player.pde index 0c8053b..a63f606 100644 --- a/JetScape/Player.pde +++ b/JetScape/Player.pde @@ -19,11 +19,13 @@ public class Player extends MainObjects noStroke(); fill(0,0,255); + //Making sure the player does not go off the bottom of the screen. if(yPos + h <= height - blockHeight * 0.5f) { yPos = yPos + gravity; } + //Making sure the player does not go off the top of the screen. if(keyCheck(space) && yPos >= 70) { yPos = yPos - playerSpeed * 3f; //How fast the player goes up.