/* built with Studio Sketchpad:
* https://sketchpad.cc
*
* observe the evolution of this sketch:
* https://studio.sketchpad.cc/sp/pad/view/ro.RYuNOWuPCcz/rev.8850
*
* authors:
* Kohmei Kadoya
*
*
*
*
* johann lee
* license (unless otherwise specified):
* creative commons attribution-share alike 3.0 license.
* https://creativecommons.org/licenses/by-sa/3.0/
*/
//This not the final verision, check back next Friday (8/7/2015) for better textures, a title screen, a better score sys12tem, more obsicles, sound, a boss, and much more!
//There was a issue where I couldent save more than 1000 edits on the older project, we will continue to develop on this new one.If you would like to see the older versions of the game click this link for the original sketch:http://studio.sketchpad.cc/sp/pad/view/ro.9XSCBB9ykPc32/rev.10903
//---------------LOOK AT THE TOP--------------------------
//Boat
/* @pjs preload="/static/uploaded_resources/p.18011/Snark-SunchaserHull-top-N.png"; */
//Circle
/* @pjs preload="/static/uploaded_resources/p.18011/4567853_f520.png"; */
//River
/* @pjs preload="/static/uploaded_resources/p.18011/River%20for%20game%20upgraded.png"; */
//River 2
/* @pjs preload="/static/uploaded_resources/p.18011/3aNqfl.gif"; */
//River 3
/* @pjs preload="/static/uploaded_resources/p.18011/gameBG1.png"; */
//River 3-0
/* @pjs preload="/static/uploaded_resources/p.18011/gameBG0.png"; */
//Rock
/* @pjs preload="/static/uploaded_resources/p.18011/Rock.png"; */
//Rock
/* @pjs preload="/static/uploaded_resources/p.18011/Rock2.png"; */
//Log
/* @pjs preload="/static/uploaded_resources/p.18011/Log.png"; */
//Log2
/* @pjs preload="/static/uploaded_resources/p.18011/Log2.png"; */
/* @pjs preload="/static/uploaded_resources/p.18011/Boat_Right2.png"; */
/* @pjs preload="/static/uploaded_resources/p.18011/Boat_Right1.png"; */
/* @pjs preload="/static/uploaded_resources/p.18011/Boat_Left2.png"; */
/* @pjs preload="/static/uploaded_resources/p.18011/Boat_Left1.png"; */
/* @pjs preload="/static/uploaded_resources/p.18011/Boat_Main.png"; */
/* @pjs preload="/static/uploaded_resources/p.18011/1Boat_Left1.png"; */
/* @pjs preload="/static/uploaded_resources/p.18011/1Boat_Left2.png"; */
/* @pjs preload="/static/uploaded_resources/p.18011/1Boat_Right1.png"; */
/* @pjs preload="/static/uploaded_resources/p.18011/1Boat_Right2.png"; */
/* @pjs preload="/static/uploaded_resources/p.18011/Rock%202.png"; */
/* @pjs preload="/static/uploaded_resources/p.18011/Titile%200-0.png"; */
/* @pjs preload="/static/uploaded_resources/p.18011/Titile%200-1.png"; */
/* @pjs preload="/static/uploaded_resources/p.18011/Titile%201-0.png"; */
/* @pjs preload="/static/uploaded_resources/p.18011/Titile%200-2.png"; */
/* @pjs preload="/static/uploaded_resources/p.18011/Titile%202-0.png"; */
/* @pjs preload="/static/uploaded_resources/p.18011/controllsAnimation.gif"; */
/* @pjs preload="/static/uploaded_resources/p.18011/Shop1.png"; */
/* @pjs preload="/static/uploaded_resources/p.18011/Shop4.png"; */
/* @pjs preload="/static/uploaded_resources/p.18011/Shop3.png"; */
/* @pjs preload="/static/uploaded_resources/p.18011/Shop2.png"; */
/* @pjs preload="/static/uploaded_resources/p.18011/Shop5.png"; */
/* @pjs preload="/static/uploaded_resources/p.18011/LogDown.png"; */
/* @pjs preload="/static/uploaded_resources/p.18011/LogDown2.png"; */
float a = 0; //angle of the boat
//int test = 0;
float x = 0; // xPos of the background
boolean pressed = false; //is any key pressed?
float xPos = 0; //YPOS!!!! of the boat
int side = 10; //length of the shore
int sideC = 1; //counter for shore
int xRock = 0; //x for Rock 1
float yRock = 0; //y for Rock 1
boolean rRock = true; // reset rock pos?
float xRock2 = 0; //x for Rock 1
float yRock2 = 0; //y for Rock 1
boolean rRock2 = true; // reset rock pos?
float speed = 2; //speed of boat, affects shore, water, and rocks
float speedMod = 0; //modifes speed
int lvSpeed = 0;
boolean gameOver = false;
boolean test = false;
boolean collision = false;
boolean collision2 = false;
boolean lCollision12 = false;
boolean lCollision13 = false;
boolean lCollision22 = false;
boolean lCollision23 = false;
boolean lCollision11 = false;
boolean lCollision21 = false;
boolean start = false;
int collisionCount = 3;
int currentTime = 0;
int perviousTime = 0;
int respawnTime = 0;
int deathTime = 0;
int titleTime = 0;
boolean invincible = false;
boolean title = true;
boolean collided = false;
int xShift = 0;
int yShift = 0;
int riverImg = 3;
int lv = 0;
boolean deathScreen = false;
float xLog = 0;
float yLog = 0;
boolean rLog = true;
float xLog2 = 0;
float yLog2 = 0;
boolean rLog2 = true;
int boatImg = 0;
int boatLength = 180;
int boatWidth = 90;
int titleImg = 0;
//int leftTimer = 0;
//int rightTimer = 0;
boolean first = true;
boolean shop = false;
int upgrade = 2;
int yLog22 = 0;
int yLog12 = 0;
int yLog23 = 0;
int yLog13 = 0;
//Load Images
//Boat
PImage img0 = loadImage("/static/uploaded_resources/p.18011/Snark-SunchaserHull-top-N.png");
//Circle
PImage img2 = loadImage("/static/uploaded_resources/p.18011/4567853_f520.png");
//River
PImage img3 = loadImage("/static/uploaded_resources/p.18011/River%20for%20game%20upgraded.png");
//River 2
PImage img4 = loadImage("/static/uploaded_resources/p.18011/3aNqfl.gif");
//River 3
PImage img5 = loadImage("/static/uploaded_resources/p.18011/gameBG1.png");
//Rock
PImage img6 = loadImage("/static/uploaded_resources/p.18011/Rock.png");
//Rock
PImage rock1 = loadImage("/static/uploaded_resources/p.18011/Rock2.png");
//rock2
PImage rock2 = loadImage("/static/uploaded_resources/p.18011/Rock%202.png");
//River 3-0
PImage img8 = loadImage("/static/uploaded_resources/p.18011/gameBG0.png");
//Log
PImage img9 = loadImage("/static/uploaded_resources/p.18011/Log.png");
//Log2
PImage img10 = loadImage("/static/uploaded_resources/p.18011/Log2.png");
PImage bMid = loadImage("/static/uploaded_resources/p.18011/Boat_Main.png");
PImage bL1 = loadImage("/static/uploaded_resources/p.18011/1Boat_Left1.png");
PImage bL2 = loadImage("/static/uploaded_resources/p.18011/1Boat_Left2.png");
PImage bR2 = loadImage("/static/uploaded_resources/p.18011/1Boat_Right2.png");
PImage bR1 = loadImage("/static/uploaded_resources/p.18011/1Boat_Right1.png");
PImage title00 = loadImage("/static/uploaded_resources/p.18011/Titile%200-0.png");
PImage title01 = loadImage("/static/uploaded_resources/p.18011/Titile%200-1.png");
PImage title10 = loadImage("/static/uploaded_resources/p.18011/Titile%201-0.png");
PImage title02 = loadImage("/static/uploaded_resources/p.18011/Titile%200-2.png");
PImage title20 = loadImage("/static/uploaded_resources/p.18011/Titile%202-0.png");
PImage controlls = loadImage("/static/uploaded_resources/p.18011/controllsAnimation.gif");
PImage shop5 = loadImage("/static/uploaded_resources/p.18011/Shop5.png");
PImage shop4 = loadImage("/static/uploaded_resources/p.18011/Shop4.png");
PImage shop3 = loadImage("/static/uploaded_resources/p.18011/Shop3.png");
PImage shop2 = loadImage("/static/uploaded_resources/p.18011/Shop2.png");
PImage shop1 = loadImage("/static/uploaded_resources/p.18011/Shop1.png");
PImage logOld = loadImage("/static/uploaded_resources/p.18011/LogDown.png");
PImage log = loadImage("/static/uploaded_resources/p.18011/LogDown2.png");
void setup(){
size(720, 360);
noStroke();
fill(255);
translate(width/2,height/2);
//console.log(a);
}
void draw() {
if(title){
if (shop){
if(upgrade==0){
imageMode(CORNER);
image(shop1,0,0);
}
if(upgrade==1){
imageMode(CORNER);
image(shop2,0,0);
}
if(upgrade==2){
imageMode(CORNER);
image(shop3,0,0);
}
if(upgrade==3){
imageMode(CORNER);
image(shop4,0,0);
}
if(upgrade==4){
imageMode(CORNER);
image(shop5,0,0);
}
}
if(!shop){
//console.log(mouseY);
if(mouseX>450&&mouseX<620&&mouseY>140&&mouseY<220&&!mousePressed){
imageMode(CORNER);
image(title10,0,0);
}
else if (mouseX>450&&mouseX<620&&mouseY>230&&mouseY<310&&!mousePressed){
imageMode(CORNER);
image(title01,0,0);
}
else if (mouseX>450&&mouseX<620&&mouseY>140&&mouseY<220&&mousePressed){
imageMode(CORNER);
image(title20,0,0);
respawnTime = currentTime;
x = 0;
title = false;
}
else if (mouseX>450&&mouseX<620&&mouseY>230&&mouseY<310&&mousePressed){
imageMode(CORNER);
image(title02,0,0);
shop = true;
}
else{
imageMode(CORNER);
image(title00,0,0);
}
respawnTime = currentTime;
titleTime = millis();
fill(255);
rectMode(CORNER);
//rect(0,0,720,360);
fill(0);
imageMode(CENTER);
image(controlls,width/2-200,height/2+70,160,160);
textAlign(CENTER, CENTER);
textSize(15);
text("Problems: Collision Broken, Top log image flipped, Respawn wont reset obstacles",width/2,height/2+160);
text("Controlls: UP/DOWN (Later there will be a picture that will show controlls, not text)",width/2,height/2-50);
//console.log(mouseClicked);
}
}
else{
translate(width/2,height/2);
textAlign(CENTER, CENTER);
textSize(22);
if(currentTime > deathTime+2000 && currentTime < deathTime+2200 && gameOver && !deathScreen){//Change 2nd currentTime to deathTime
fill(0,20);
rect(-width/2,-height/2,width/2, height/2);
fill(0,255);
text("Back to Main Menu",0,60);
text("Continue? (keeps current position/score)",0,100);
text("Respawn? (restart)", 0, 140);
text("Game Over",0,-80);
text("Your Score "+int((currentTime-respawnTime)/5000) ,-200,-120);
text("Mutiplier "+ lv, 0, -120);
text("You Get "+ int((currentTime-respawnTime)/5000)*lv + " Currency", 200, -120);
deathScreen = true;
}
//console.log(deathTime);
//console.log(currentTime);
currentTime = millis() - titleTime;
//console.log("running");
if(!gameOver){
//console.log(x);
background(0);
x = x + speed; //moving forwards
if(xPos < -height/2+17 || xPos > height/2-17 ){
speed = 1.5;
}
else{
speed = 3.0+speedMod+lvSpeed;
}
if(pressed){
//speedMod = -0.5;//drag for turn
}
else{
//speedMod = 0;
}
xPos = xPos + a/8; //vertical movement]
if(x<4999){
lvSpeed = 0;
lv = 1;
}
if(x>5000){
lvSpeed = 2;
lv = 2;
}
if(x>10000){
lvSpeed = 4;
lv = 3;
}
if(x>20000){
lvSpeed = 6;
lv = 4;
}
if(x>30000){
lvSpeed = 8;
lv = 5;
}
if(x>45000){
lvSpeed = 10;
lv = 6;
}
if(x>60000){
lvSpeed = 12;
lv = 7;
}
//River
if(riverImg == 1){
river();
}
if(riverImg == 2){
river2();
}
if(riverImg == 3){
river3();
}
//console.log(riverImg);
//Side (shore)
//shore();
//Rocks
if(rRock){//this is reseting the rock position
yRock = random(height/-2+50,height/2-50);
xRock = width/2+int(random(100,500));
rRock = false;
}
xRock = xRock - int(speed);
imageMode(CENTER);
image(rock1, xRock, yRock, 50, 40);
if(xRock < width/-2-random(20,300)){
rRock = true;
}
//Rock 2
if(rRock2){//this is reseting the rock position
yRock2 = random(height/-2+50,height/2-50);
xRock2 = width/2+random(20,400);
rRock2 = false;
}
xRock2 = xRock2 - speed;
image(rock2, xRock2, yRock2, 50, 40);
noTint();
if(xRock2 < width/-2-random(20,100)){
rRock2 = true;
}
if(rLog){//this is reseting the rock position
yLog = random(-100,-300);
xLog = (width/2)+random(100,300);
rLog = false;
}
yLog12 = int(yLog +90);
yLog13 = int(yLog +40);
xLog = xLog - speed;
imageMode(CENTER);
image(log, xLog, yLog, 40, 240);
if(xLog < width/-2-random(300,500)){
rLog = true;
}
if(rLog2){//this is reseting the rock position
yLog2 = random(100, 300);
xLog2 = (width/2)+random(300,800);
rLog2 = false;
}
yLog22 = int(yLog2-90);
yLog23 = int(yLog2-40);
xLog2 = xLog2 - speed;
imageMode(CENTER);
image(img10, xLog2, yLog2, 40, 240);
if(xLog2 < width/-2-random(0,300)){
rLog2 = true;
}
//Boat
//ellipse(0, 0, 220, 50);
if(xPos > height/2-45){
xPos=xPos-a/8;
a = a - 2;
}
if(xPos < -height/2+45){
xPos=xPos-a/8;
a = a + 2;
}
xShift = int(random(-3,3));
yShift = int(random(-3,3));
pushMatrix();
imageMode(CENTER);
rectMode(CORNERS);
if(invincible){
tint(255, int(random(0,255)));
}
else{
noTint();
}
translate(-100,xPos);
rotate(radians(a));
if(!collided){
if(boatImg == 0){
image(bMid,0,0,boatLength,boatWidth);
}
if(boatImg == -1){
image(bL1,0,0,boatLength,boatWidth);
}
if(boatImg == -2){
image(bL2,0,0,boatLength,boatWidth);
}
if(boatImg == 1){
image(bR1,0,0,boatLength,boatWidth);
}
if(boatImg == 2){
image(bR2,0,0,boatLength,boatWidth);
}
}
if(collided){
if(boatImg == 0){
image(bMid,0+xShift,0+yShift,boatLength,boatWidth);
}
if(boatImg == -1){
image(bL1,0+xShift,0+yShift,boatLength,boatWidth);
}
if(boatImg == -2){
image(bL2,0+xShift,0+yShift,boatLength,boatWidth);
}
if(boatImg == 1){
image(bR1,0+xShift,0+yShift,boatLength,boatWidth);
}
if(boatImg == 2){
image(bR2,0+xShift,0+yShift,boatLength,boatWidth);
}
}
fill(255,75);
noTint();
if(test){
rect(-70,xPos-5,70,xPos+5);//Hitbox befre fix
}
popMatrix();
if(test){
fill(255,0,0,75);
//rect(-78,xPos-5,78,xPos+5);//Real Hitbox
fill(0,0,255,70);
quad(-188,xPos-20-a,-12,xPos-20+a,-12,xPos+20+a,-188,xPos+20-a);//Traking hitbox
fill(0);
ellipseMode(CENTER);
ellipse(xRock,yRock,10,10);
ellipse(xRock2,yRock2,10,10);
ellipse(xLog,yLog,10,10);
ellipse(xLog2,yLog2,10,10);
fill(255);
ellipse(xLog,yLog12,10,10);
ellipse(xLog2,yLog22,10,10);
ellipse(xLog,yLog13,10,10);
ellipse(xLog2,yLog23,10,10);
//quad(-78,400,78,400,-78,450,78,450,
ellipseMode(CENTER);
//ellipse(0,xPos,156,156);//test
fill(0);
//ellipse(0,xPos,20,20);
}
//Collision
//console.log();
pointPolygon (4,[-188,-12,-12,-188],[xPos-20-a,xPos-20+a,xPos+20+a,xPos+20-a],xRock,yRock);
pointPolygon2 (4,[-188,-12,-12,-188],[xPos-20-a,xPos-20+a,xPos+20+a,xPos+20-a],xRock2,yRock2);
pointPolygon11 (4,[-188,-12,-12,-188],[xPos-20-a,xPos-20+a,xPos+20+a,xPos+20-a],xLog,yLog);
pointPolygon21 (4,[-188,-12,-12,-188],[xPos-20-a,xPos-20+a,xPos+20+a,xPos+20-a],xLog2,yLog2);
pointPolygon12 (4,[-188,-12,-12,-188],[xPos-20-a,xPos-20+a,xPos+20+a,xPos+20-a],xLog,yLog12);
pointPolygon22 (4,[-188,-12,-12,-188],[xPos-20-a,xPos-20+a,xPos+20+a,xPos+20-a],xLog2,yLog22);
pointPolygon13 (4,[-188,-12,-12,-188],[xPos-20-a,xPos-20+a,xPos+20+a,xPos+20-a],xLog,yLog13);
pointPolygon23 (4,[-188,-12,-12,-188],[xPos-20-a,xPos-20+a,xPos+20+a,xPos+20-a],xLog2,yLog23);
/* float[] vertX = new float[4];
vertX[0] = -88;
vertX[1] = 88;
vertX[2] = 88;
vertX[3] = -88;
float[] vertY = new float[4];
vertX[0] = xPos-25-a;
vertX[1] = xPos-25+a;
vertX[2] = xPos+25+a;
vertX[3] = xPos+25-a;
pointPolygon (4,vertX,vertY,xRock,yRock);
pointPolygon2 (4,vertX,vertY,xRock2,yRock2);*/
if(collision || collision2 ||lCollision11||lCollision12||lCollision13||lCollision21||lCollision22||lCollision23){
deathScreen = false;
collided = true;
speedMod = -1.5-lv;
if(!invincible){
if(collisionCount == 1){
deathTime = currentTime;
}
collisionCount = collisionCount - 1;
if(collisionCount > 0){
invincible = true;
perviousTime = currentTime;
collision = false;
collision2 = false;
lCollision11 = false;
lCollision12 = false;
lCollision13 = false;
lCollision21 = false;
lCollision22 = false;
lCollision23 = false;
}
else{
speedMod = 0;
collided = false;
}
}
}
else{
speedMod = 0;
collided = false;
}
}
if(invincible && currentTime > perviousTime+3000){
invincible = false;
}
if(collisionCount == 0){
gameOver = true;
fill(225);
}
fill(255);
text("Live(s) " + collisionCount, -width/2+80, -height/2+20);
text("Score " + int((currentTime-respawnTime)/5000), 0, -height/2+20);
text("Level (Score Mutiplier) " + lv, width/2-160, -height/2+20);
//console.log(currentTime);
//console.log(respawnTime);
//Internactions
//console.log(pressed);
if(!pressed && a < 0){
a = a + 0.2; //re-aline
}
if (!pressed && a > 0){
a = a -0.2; //re-aline
}
if(keyPressed && keyCode == DOWN && xPos < height/2-19 && a < 20 ){//Rotation Limit
a = a + 0.4;
pressed = true;
if(a>1){
boatImg = 2;
}
else{
boatImg = 1;
}
}
if(keyPressed && keyCode == UP && xPos > -height/2+19 && a > -20){//Rotation Limit
a = a - 0.4;
pressed = true;
if(a<-1){
boatImg = -2;
}
else{
boatImg = -1;
}
}
}
}
void keyPressed(){
//title = false;
if(key == 't'){
test = true;
}
if(key == 'u'){
test = false;
}
if(key == 'l'){
collisionCount = collisionCount + 1;
}
if(key == 'k'){
collisionCount = collisionCount - 1;
}
if(key == 'z'){
riverImg = 1;
}
if(key == 'x'){
riverImg = 2;
}
if(key == 'c'){
riverImg = 3;
}
if(key == 'v'){
x = 0;
}
if(keyCode == '1'){
upgrade=0;
}
if(keyCode == '2'){
upgrade=1;
}
if(key == '3'){
upgrade=2;
}
if(key == '4'){
upgrade=3;
}
if(key == '5'){
upgrade=4;
}
}
void mouseClicked() {
//title = false;
if(mouseX<560 && mouseX>160 && mouseY> 275 && mouseY < 300 && gameOver){
collisionCount = 4;
gameOver = false;
}
if(mouseX<460 && mouseX>260 && mouseY> 310 && mouseY < 335 && gameOver){
collisionCount = 3;
xPos = 0;
x = 0;
a = 0;
respawnTime = currentTime;
//rRock = ture;
//rRock2 = true;
//rLog = true;
//rLog2 = true;
xLog = xLog + 500;
xLog2 = xLog2 + 500;
xRock = xRock + 500;
xRock2 = xRock2 + 500;
gameOver = false;
}
if(mouseX<460 && mouseX>260 && mouseY> 240 && mouseY < 295 && gameOver){
title = true;
}
}
void keyReleased(){
pressed = false;
boatImg = 0;
}
boolean pointPolygon (int numVertices, float[] vertX, float[] vertY, float px, float py) {
if (!invincible){
for (int i=0, j=numVertices-1; i < numVertices; j = i++) {
if ( ((vertY[i]>py) != (vertY[j]>py)) && (px < (vertX[j]-vertX[i]) * (py-vertY[i]) / (vertY[j]-vertY[i]) + vertX[i]) ) {
collision = !collision;
}
}
return collision;
}
}
boolean pointPolygon2 (int numVertices, float[] vertX, float[] vertY, float px, float py) {
if (!invincible){
for (int i=0, j=numVertices-1; i < numVertices; j = i++) {
if ( ((vertY[i]>py) != (vertY[j]>py)) && (px < (vertX[j]-vertX[i]) * (py-vertY[i]) / (vertY[j]-vertY[i]) + vertX[i]) ) {
collision2 = !collision2;
}
}
return collision2;
}
}
boolean pointPolygon12 (int numVertices, float[] vertX, float[] vertY, float px, float py) {
if (!invincible){
for (int i=0, j=numVertices-1; i < numVertices; j = i++) {
if ( ((vertY[i]>py) != (vertY[j]>py)) && (px < (vertX[j]-vertX[i]) * (py-vertY[i]) / (vertY[j]-vertY[i]) + vertX[i]) ) {
lCollision12 = !lCollision12;
}
}
return lCollision12;
}
}
boolean pointPolygon13 (int numVertices, float[] vertX, float[] vertY, float px, float py) {
if (!invincible){
for (int i=0, j=numVertices-1; i < numVertices; j = i++) {
if ( ((vertY[i]>py) != (vertY[j]>py)) && (px < (vertX[j]-vertX[i]) * (py-vertY[i]) / (vertY[j]-vertY[i]) + vertX[i]) ) {
lCollision13 = !lCollision13;
}
}
return lCollision13;
}
}
boolean pointPolygon22 (int numVertices, float[] vertX, float[] vertY, float px, float py) {
if (!invincible){
for (int i=0, j=numVertices-1; i < numVertices; j = i++) {
if ( ((vertY[i]>py) != (vertY[j]>py)) && (px < (vertX[j]-vertX[i]) * (py-vertY[i]) / (vertY[j]-vertY[i]) + vertX[i]) ) {
lCollision22 = !lCollision22;
}
}
return lCollision22;
}
}
boolean pointPolygon23 (int numVertices, float[] vertX, float[] vertY, float px, float py) {
if (!invincible){
for (int i=0, j=numVertices-1; i < numVertices; j = i++) {
if ( ((vertY[i]>py) != (vertY[j]>py)) && (px < (vertX[j]-vertX[i]) * (py-vertY[i]) / (vertY[j]-vertY[i]) + vertX[i]) ) {
lCollision23 = !lCollision23;
}
}
return lCollision23;
}
}
boolean pointPolygon11 (int numVertices, float[] vertX, float[] vertY, float px, float py) {
if (!invincible){
for (int i=0, j=numVertices-1; i < numVertices; j = i++) {
if ( ((vertY[i]>py) != (vertY[j]>py)) && (px < (vertX[j]-vertX[i]) * (py-vertY[i]) / (vertY[j]-vertY[i]) + vertX[i]) ) {
lCollision11 = !lCollision11;
}
}
return lCollision11;
}
}
boolean pointPolygon21 (int numVertices, float[] vertX, float[] vertY, float px, float py) {
if (!invincible){
for (int i=0, j=numVertices-1; i < numVertices; j = i++) {
if ( ((vertY[i]>py) != (vertY[j]>py)) && (px < (vertX[j]-vertX[i]) * (py-vertY[i]) / (vertY[j]-vertY[i]) + vertX[i]) ) {
lCollision21 = !lCollision21;
}
}
return lCollision21;
}
}
void river(){
imageMode(CENTER);
image(img4, 0-x, 0, width, height);
image(img4, 0-x + width, 0, width, height);
image(img4, 0-x + width*2, 0, width, height);
image(img4, 0-x + width*3, 0, width, height);
image(img4, 0-x + width*4, 0, width, height);
image(img4, 0-x + width*5, 0, width, height);
image(img4, 0-x + width*6, 0, width, height);
image(img4, 0-x + width*7, 0, width, height);
image(img4, 0-x + width*8, 0, width, height);
image(img4, 0-x + width*9, 0, width, height);
image(img4, 0-x + width*10, 0, width, height);
image(img4, 0-x + width*11, 0, width, height);
image(img4, 0-x + width*12, 0, width, height);
image(img4, 0-x + width*13, 0, width, height);
image(img4, 0-x + width*14, 0, width, height);
image(img4, 0-x + width*15, 0, width, height);
image(img4, 0-x + width*16, 0, width, height);
}
void river2(){
imageMode(CENTER);
image(img3, 0-x, 0, 10000, height);
image(img3, 10000-x, 0, 10000, height);
image(img3, 20000-x, 0, 10000, height);
image(img3, 30000-x, 0, 10000, height);
}
void river3(){
imageMode(CENTER);
image(img8, 5000-x-width/2, 0, 10000, height);
image(img5, 15000-x-width/2, 0, 10000, height);
image(img5, 25000-x-width/2, 0, 10000, height);
image(img5, 35000-x-width/2, 0, 10000, height);
image(img5, 45000-x-width/2, 0, 10000, height);
image(img5, 55000-x-width/2, 0, 10000, height);
image(img5, 65000-x-width/2, 0, 10000, height);
image(img5, 75000-x-width/2, 0, 10000, height);
}
void shore(){
//rotate(radians(-a));
fill(0,255,0);
rectMode(CENTER);
rect(width/-2-x, height/-2,width,40);
rect(width/-2-x+width+10, height/-2,width,40);
rect(width/-2-x+width*2+20, height/-2,width,40);
rect(width/-2-x+width*3+30, height/-2,width,40);
rect(width/-2-x+width*4+30, height/-2,width,40);
rect(width/-2-x+width*5+30, height/-2,width,40);
rect(width/-2-x+width*6+30, height/-2,width,40);
rect(width/-2-x+width*7+30, height/-2,width,40);
rect(width/-2-x+width*8+30, height/-2,width,40);
}
//ISSUES!
//Cant change xPos to yPos -- Not too bad
//Sometimes the boat will stay at 1 speed after crashing into a rock
//Basically entire collsion is broken!
//Top log image flliped
//Convert to processing
//Fonts
//COLLISION!!!!
//SOLVED
//Weird glitch beeing stuck before edge - how did u fix?
//Hitbox not working - hit box is amazing gj
//3 lives, its only one now.
//Respawn Button
//Some kind of scoreing system
//Title Screen
//Score timer reset after title screen
//Current time dosent count up after gameOver so death screen wont come up
//First image position
//Respawn wont reset obstacles
//TODO Johan(Yohan?), do some of these
//Texture for everything(waiting for jing duo do finish, (Friday))
//Sound?
//Decide if its a motor boat for rowing boat
//Upgrade Boat
//Logs
//Water Dripple - After boat -- Give up
//Boss -- Give up
//Coins -- Give up
//Kohmei
//Johan (write what your working on here so I dont work on the same thing