Skip to content

Commit

Permalink
Stable Release
Browse files Browse the repository at this point in the history
  • Loading branch information
Gabriel Grimberg committed Feb 7, 2017
1 parent 1406adb commit 48fb6ab
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 19 deletions.
16 changes: 6 additions & 10 deletions JetScape/JetScape.pde
Original file line number Diff line number Diff line change
Expand Up @@ -70,10 +70,10 @@ boolean[] keys = new boolean[PRESSED];
/*
- Images -
*/
//Player sprite.
//Player Image.
PImage playerChar;

//Jetpack sprite.
//Jetpack Image
PImage jetpackImg;

//Repeating background.
Expand Down Expand Up @@ -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;
Expand All @@ -116,7 +115,6 @@ int score;
int highScore = 0;
int recentScore = 0;


//Level counter
int level = 1;

Expand All @@ -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);
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -401,6 +396,7 @@ public void backtoMain()
}
}

/* Method to calculate the highscore */
public void highScore()
{
if(gameState == 2)
Expand Down
8 changes: 4 additions & 4 deletions JetScape/KeyControl.pde
Original file line number Diff line number Diff line change
@@ -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()
Expand Down
10 changes: 5 additions & 5 deletions JetScape/MovingBackground.pde
Original file line number Diff line number Diff line change
Expand Up @@ -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.
}
}

Expand Down
2 changes: 2 additions & 0 deletions JetScape/Player.pde
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit 48fb6ab

Please sign in to comment.