import processing.core.*; 
import processing.data.*; 
import processing.event.*; 
import processing.opengl.*; 

import ddf.minim.*; 

import java.util.HashMap; 
import java.util.ArrayList; 
import java.io.File; 
import java.io.BufferedReader; 
import java.io.PrintWriter; 
import java.io.InputStream; 
import java.io.OutputStream; 
import java.io.IOException; 

public class Cyclops_v1o5 extends PApplet {

// CYCLOPS v 1.5 
// Programmed by Kevin De Keyser 1997-2012
// Dedicated to my best friend Lucas Schenck
// Music by Lucas Schenck
// COPYRIGHT 2011-2012 (c) COPYRIGHT by Kevas Dark Entertainment
// NEW STUFF 1.2
// added highscore slot
// Caps Lock fixed
// one of several key problems fixed
// BUGS TO FIX
// Boss double shoot
// 1839 line

  int ccc=0;
Minim minim;
AudioPlayer song;
AudioPlayer smenu;
PImage a;
PImage optio;
PImage ex;
PImage btree;
PImage bbg;
PImage i1;
PImage hel;
PImage hel2;
PImage missile;
int sa;
boolean[] full;
int akap=0;
int win=0;
int px=80;
int psx=80;
int spointes;
missile miss;
boolean moveright;
int wheelturn=0;
int bhighscore;
int hx;
int hy;
boolean cre=true;
boolean cre1=false;
boolean stillalive;
 int highscore;
int highscoreP;
int timer;
int wheelturnb;
int heartlesscounter;
int hturn;
String Le1;
String Highs;
PFont hello;
PFont hellosmall;
PFont levelfont;
PFont font;
boolean[] keys;
heart h1;
heart h2;
heart h3;
int mouseState=0;
int game=0;
 boolean wormbossdead;
int xRotate;
int fbX;
  int fbY;
  boolean stop=false;
boolean i=false;
boolean hitable=false;
  boolean upgo=true;
  boolean harpyx=true;
  boolean hitablew;
boolean harpyy=true;
boolean smarttears=false;
int hsX;
float hsY;
int count=0;
boolean fail=false;
boolean sdf=false;
int x=80;
int y=80;
boolean makak;
int pointes=0;
boolean why=true;
int pointes2=0;
boolean ended;
boolean coatenabled=false;
float rand=random(0,10);
int xs=80;
boolean helix=false;
int coatdur=0;
boolean jobo=false;
boolean earsenabled=false;
int ys=500;
int ax=0;
boolean hell=false;
int ax2=0;
boolean touch2=false;
boolean afa=true;
int xtears;
int ytears;
boolean ellipsemake=false;
boolean ellipsemake2=false;
boolean ellipsemake3=false;
boolean ellipsemake4=false;
boolean ellipsemake5=false;
boolean ellipsemake6=false;
boolean ellipsemake7=false;
boolean ellipsemake8=false;
boolean ellipsemake9=false;
boolean ellipsemake10=false;
 
 

boolean bongo=false;
boolean bongo2=false;
boolean bongo3=false;
boolean bongo4=false;
boolean bongo5=false;
boolean bongo6=false;
boolean bongo7=false;
boolean bongo8=false;
boolean bongo9=false;
boolean bongo10=false;
boolean scaleoption=false;
boolean scaleexit=false;
boolean waitfornow=false;
boolean musicon=true;
boolean helidisplay;
float r1;
float r2;
float r3;
float r4;
float r5;
float r6;
float r7;
float r8;
float r9;
float r10;
float r11;
float r12;
int ca=0;
int cb=0;
boolean gag=true;
int cc=255;
int gravity2 = 4;
int gravity = 4;
boolean mankind=false;
boolean touch =false;
String ghj="Move A    D";
cyclope cyclope1;
cyclopecon cyclope2;
shot shot1;
plattform platt1;
plattform platt2;
plattform platt3;
plattform platt4;
plattform platt5;
plattform platt6;
plattform platt7;
plattform platt8;
plattform platt9;
plattform platt10;
plattform platt11;
plattform platt12;
plattform platt13;
plattform platt14;
plattform platt15;
plattform platt16;
plattform platt17;
plattform platt18;
plattform platt19;
plattform platt20;
plattform platt21;
plattform platt22;
plattform platt23;
plattform platt24;
plattform platt25;
plattform platt26;
plattform platt27;
plattform platt28;
plattform platt29;
plattform platt30;
spikeplatt sp1;
spikeplatt sp2;
spikeplatt sp3;
spikeplatt sp4;
spikeplatt sp5;
spikeplatt sp6;
spikeplatt sp7;
spikeplatt sp8;
spikeplatt sp9;
spikeplatt sp10;
spikeplatt sp11;
spikeplatt sp12;
spikeplatt sp13;
spikeplatt sp14;
spikeplatt sp15;
spikeplatt sp16;
jplattform jplatt1;
jplattform jplatt2;
jplattform jplatt3;
jplattform jplatt4;
jplattform jplatt5;
jplattform jplatt6;
jplattform jplatt7;
jplattform jplatt8;
splattform s1;
textform text1;
textform text2;
textform text3;
textform text4;

item ears;
item coat;
item chilli;
harpy harpy1;
harpy harpy2;
wormboss boss1;
int beachcount;
boolean treshoot=false;
public void reset()
{ended=false;
treshoot=false;
  timer=0;
  psx=80;
  px=80;
  sdf=false;
  wheelturnb=0;
  scaleoption=false;
 mouseState=0;
game=0;
beachcount=0;
cre=true;
cre1=false;
  heartlesscounter=2;
stop=false;
akap=0;
i=false;
hitable=false;
upgo=true;
harpyx=true;
harpyy=true;
smarttears=false;
count=0;

fail=false;
sdf=false;
x=80;
pointes=0;
why=true;
pointes2=0;
y=80;
coatenabled=false;
rand=random(0,10);
xs=80;
helix=false;
coatdur=0;
jobo=false;
earsenabled=false;
ys=500;
ax=0;
hell=false;
ax2=0;
touch2=false;
afa=true;
ellipsemake=false;
ellipsemake2=false;
ellipsemake3=false;
ellipsemake4=false;
ellipsemake5=false;
ellipsemake6=false;
ellipsemake7=false;
ellipsemake8=false;
ellipsemake9=false;
ellipsemake10=false;
 
 

bongo=false;
bongo2=false;
bongo3=false;
bongo4=false;
bongo5=false;
bongo6=false;
bongo7=false;
bongo8=false;
bongo9=false;
bongo10=false;
makak=true;
hx=400;
hy=450;
ca=0;
cb=0;
gag=true;
cc=255;
gravity2 = 4;
gravity = 4;
mankind=false;
touch =false;
ghj="Move A    D";
helidisplay=false;
hturn=0;
sa=0;
  ccc=0;
}
public void setup()
{keys=new boolean[2];
noCursor();
miss=new missile(hy);
minim = new Minim(this);
a=loadImage("2.png");
optio=loadImage("options.png");
ex=loadImage("back.png");
btree=loadImage("beachtree.png");
bbg=loadImage("beachbg.png");
i1=loadImage("intro1.png");
hel=loadImage("Rover.png");
hel2=loadImage("Helicopter.png");
missile=loadImage("Missile.png");
song = minim.loadFile("song.mp3");
smenu = minim.loadFile("Menu.MP3");

imageMode(CENTER);

  textAlign(CENTER);


reset();
ellipseMode(CENTER);
h1=new heart(30,20,1);
h2=new heart(60,20,2);
h3=new heart(90,20,3);
hello = loadFont("18thCentury-44.vlw");
hellosmall=createFont("Times-Roman-12.vlw",12);
levelfont=loadFont("HandMeDownS-BRK--15.vlw");
font=loadFont("comicsansms-20.vlw");
 String[] Highl =loadStrings("xXx.txt");
    String high3=join(Highl," ");
 highscore=Integer.parseInt(high3);
 String[] lol =loadStrings("Xxxx.txt");
    String winna=join(lol," ");
 win=Integer.parseInt(winna);
 String[] wut = loadStrings("XxXxX.txt");
 String jaaa = join(wut," ");
 bhighscore=Integer.parseInt(jaaa);
full=new boolean[3];
cyclope1 = new cyclope();
cyclope2 = new cyclopecon();
pointes=0;
 
 
 
 
 

 for(int ui=0;ui<3;ui++)
 {
 full[ui]=true;
 }


 }
 
 
 
 
 
 
public void draw()
{
  if(game==0){
intro();
}
else if(game==1)
{
 
 menu();
 if(musicon==true){
smenu.play();}
}
  else if(game==2){
    smenu.pause();
  if(cre==true){
 crea1();
 cre=false;
 }
 if(musicon==true){
 song.play();}
if(song.position()>song.length()-1001)
{
song.rewind();
}

 draw1();}
 if(game==3){
 setting();
 }
 if(game==1||game==3)
 {if(smenu.position()>smenu.length()-1001)
 {
 smenu.rewind();
 smenu.play();
 }
 }
if(game==4)
{
if(cre1==false){
  smenu.pause();
beachcrea();
if(musicon==true){
 song.play();}
cre1=true;
}
else{
  
if(song.position()>song.length()-1001)
{
song.rewind();
}
beachdraw();
}}
if(mouseX>4&&mouseY>6)
{image(a,mouseX,mouseY);}

}
 

 
class cyclopecon
{
  public void display(){
    if(x<xs+20&&x>xs-20&&y<ys+20&&y>ys-20)
    {
    touch=true;
    touch2=true;
    }
  stroke(0);
fill(0xff4BDCFF);
ellipseMode(CENTER);
ellipse(xs,ys,30,28);
fill(0xffFAFF08);
ellipse(xs,ys+5,7,5);
beginShape ();
stroke(0xffF07272);
fill(255,0,0);
curveVertex(xs-10,ys-5);
curveVertex(xs-10,ys-5);
curveVertex(xs-5,ys-7);
curveVertex(xs,ys-10);
curveVertex(xs+3,ys-13);
curveVertex(xs+10,ys-5);
curveVertex(xs+10,ys-5);
endShape(CLOSE);
if (mouseX>xs+10)
  
  {stroke(0);
 
fill(0xff4BDCFF);
ellipseMode(CENTER);
ellipse(xs,ys,28,30);
fill(0xffFAFF08);
ellipse(xs+9,ys+5,5,7);
beginShape();
stroke(0xffF07272);
fill(255,0,0);
curveVertex(xs+10,ys-5);
curveVertex(xs+10,ys-5);
curveVertex(xs+5,ys-10);
curveVertex(xs+2,ys-1);
curveVertex(xs+5,ys-10);
 
endShape(CLOSE);
}
if(mouseX<xs-10)
{
   
fill(0xff4BDCFF);
stroke(0);
ellipseMode(CENTER);
ellipse(xs,ys,28,30);
fill(0xffFAFF08);
ellipse(xs-9,ys+5,5,7);
beginShape();
stroke(0xffF07272);
fill(255,0,0);
curveVertex(xs-10,ys-5);
curveVertex(xs-10,ys-5);
curveVertex(xs-5,ys-10);
curveVertex(xs-2,ys-1);
curveVertex(xs-5,ys-10);
 
endShape(CLOSE);
}
 
 
  }
   
 
 
 
  public void movement2()
{if(hell==false)
{
    if(touch2==true)
  {
    if(ax2<6)
    {
    ys=ys+12;
    }
    else if(ax2>2&&ax2<10)
    {
    ys=ys+10;
    }
    else if(ax2>4&&ax2<14)
    {
    ys=ys+8;
    }
    else if(ax2>6&&ax2<20)
    {
    ys=ys+7;
    }
   
  else if(ax2==20)
  {
    ys=ys+6;
  
  }
  else if(ax2>20&&ax2<26)
  {ys=ys+4;}
  else if(ax2==26)
  {
   touch2=false;
   ax2=0;
  }
  if(ax2<26)
  {
  ax2++;
  }}
 
  ys=ys-gravity2;
   
   
  }}}

//538 lines
 
 
 public void beachdraw()
{stroke(0);

if(beachcount==2100)
{
stop=true;
}
  background(ca,cb,cc);
  
 if(gag==true){
ca++;
cb++;
cc--;
if(ca==255)
{gag=false;}}
else if(gag==false)
{
cc++;
cb--;
ca--;
if(ca==0)
{
gag=true;
}
}
image(bbg,250,375);


 if(mankind==false){
cyclope1.display();
cyclope1.movement();
if(sdf==false){
 if(mousePressed&&ended==false)
{cyclope2.display();
cyclope2.movement2();
sdf=true;
 
}
 
 
}}
if(sdf==true)
{
cyclope2.display();
cyclope2.movement2();
sdf=true;
}
if(treshoot==true){
shot1.display();}
platt1.display();
platt2.display();
platt3.display();
platt4.display();
platt5.display();
platt6.display();
platt7.display();
platt8.display();
platt9.display();
platt10.display();
platt11.display();
platt12.display();
platt13.display();
platt14.display();
platt15.display();
platt16.display();
platt17.display();
platt18.display();
platt19.display();
platt20.display();
platt21.display();
platt22.display();
platt23.display();
platt24.display();
platt25.display();
platt26.display();
platt27.display();
platt28.display();
platt29.display();
 
platt1.reaction();
platt2.reaction();
platt3.reaction();
platt4.reaction();
platt5.reaction();
platt6.reaction();
platt7.reaction();
platt8.reaction();
platt9.reaction();
platt10.reaction();
platt11.reaction();
platt12.reaction();
platt13.reaction();
platt14.reaction();
platt15.reaction();
platt16.reaction();
platt17.reaction();
platt18.reaction();
platt19.reaction();
platt20.reaction();
platt21.reaction();
platt22.reaction();
platt23.reaction();
platt24.reaction();
platt25.reaction();
platt26.reaction();
platt27.reaction();
platt28.reaction();
platt29.reaction();


sp1.display();
sp2.display();
sp3.display();
sp4.display();
sp5.display();
sp6.display();
sp7.display();
sp8.display();
sp9.display();
jplatt1.display();
jplatt1.reaction();
jplatt2.display();
jplatt2.reaction();
jplatt3.display();
jplatt3.reaction();
jplatt4.display();
jplatt4.reaction();
if(stop==true)
{heli();
helidisplay=true;
}
 if(beachcount>800)
 {
   hitable=true;
 harpy1.display();
 harpy1.reaction();
 harpy2.display();
 harpy2.reaction();

 }
 if(sdf==false){
  stillalive=false;
h1.display();
h2.display();
h3.display();}
 if(rand<3.3333f)
{
ears.ears();}
if(rand>3.3333f&&rand<6.66666f)
{
coat.transparentcoat();}
if(rand>6.66666f)
{
chilli.redtears();
}

 beachcount++;
 
 if(y>600&&sdf==false)
  {
  GameOver();
  }
  if(sdf==true&&y>600&&ys<0)
{

 multiGameOver();
 }
 if(jobo==true) {multiGameOver();}
}
public void beachcrea()
{
  
platt1 = new plattform(170,200,3,0xff9B4949);
platt2 = new plattform(800,400,4,0xff9B4949);
platt3 = new plattform(1000,300,5,0xff9B4949);
platt4 = new plattform(2000,300,4,0xff9B4949);
platt5 = new plattform(1800,300,4,0xff9B4949);
platt6 = new plattform(900,250,3,0xff9B4949);
platt7 = new plattform(1200,400,2,0xff9B4949);
platt8 = new plattform(1000,300,3,0xff9B4949);
platt9 = new plattform(4000,300,4,0xff9B4949);
platt10 = new plattform(2700,450,4,0xff9B4949);
platt11 = new plattform(800,400,2,0xff9B4949);
platt12 = new plattform(3500,350,5,0xff9B4949);
platt13 = new plattform(1900,300,2,0xff9B4949);
platt14 = new plattform(3200,350,3,0xff9B4949);
platt15 = new plattform(3800,450,3,0xff9B4949);
platt16 = new plattform(4000,350,3,0xff9B4949);
platt17 = new plattform(4200,250,3,0xff9B4949);
platt18 = new plattform(4400,150,3,0xff9B4949);
platt19 = new plattform(4600,250,3,0xff9B4949);
platt20 = new plattform(4800,350,3,0xff9B4949);
platt21 = new plattform(5000,450,3,0xff9B4949);
platt22 = new plattform(3400,300,3,0xff9B4949);
platt23 = new plattform(6800,350,4,0xff9B4949);
platt24 = new plattform(7000,300,4,0xff9B4949);
platt25 = new plattform(10000,325,5,0xff9B4949);
platt26 = new plattform(5600,300,3,0xff9B4949);
platt27 = new plattform(5900,325,3,0xff9B4949);
platt28 = new plattform(7000,300,4,0xff9B4949);
platt29 = new plattform(8300,270,4,0xff9B4949);
jplatt3 = new jplattform(4300,400,2);
jplatt4 = new jplattform(4600,400,2);




text1 = new textform(3400,340,"Saveplattform",0,3);
ears = new item(1,3,3200,330);
coat = new item(2,3,3200,330);
chilli=new item(3,3,3200,330);
harpy1=new harpy(400,200,false);
harpy2=new harpy(350,300,false);
jplatt1 = new jplattform(2400,400,3);
jplatt2 = new jplattform(3600,400,3);
sp1= new spikeplatt(1500,400,false,3);
sp2= new spikeplatt(1800,150,true,3);
sp3= new spikeplatt(2500,450,false,4);
sp4= new spikeplatt(3000,150,true,3);
sp5= new spikeplatt(4000,150,true,3);
sp6= new spikeplatt(4200,100,true,3);
sp7= new spikeplatt(4400,0,true,3);
sp8= new spikeplatt(4600,100,true,3);
sp9= new spikeplatt(4800,150,true,3);


x=80;
y=80;

beachdraw();
}

class harpy
{boolean harpydead;
  int haX;
  float haY;
harpy(int curhaX,float curhaY,boolean curharpydead)
{
haX=curhaX;
haY=curhaY;
hsX=curhaX;
hsY=curhaY;
harpydead=curharpydead;
}
public void display()
{if(harpydead==false)
{
  fill(0xffA70204);
beginShape();
curveVertex(haX,haY+10);
curveVertex(haX,haY+10);
curveVertex(haX+8,haY+12);
curveVertex(haX+9,haY+16);
curveVertex(haX+9,haY+16);
endShape(CLOSE);
beginShape();
curveVertex(haX,haY+10);
curveVertex(haX,haY+10);
curveVertex(haX-8,haY+12);
curveVertex(haX-9,haY+16);
curveVertex(haX-9,haY+16);
endShape(CLOSE);
  
if(x>haX)
{
fill(0,455,0);
ellipse(haX,haY,20,25);
fill(0xffF00524);
ellipse(haX+5,haY-5,5,5);
beginShape();
curveVertex(haX+4,haY+10);
curveVertex(haX+4,haY+10);
curveVertex(haX+12,haY+12);
curveVertex(haX+13,haY+16);
curveVertex(haX+13,haY+16);
endShape(CLOSE);

beginShape();
fill(100);
curveVertex(haX-5,haY);
curveVertex(haX-5,haY);
curveVertex(haX-8,haY+7);
curveVertex(haX-13,haY+9);
curveVertex(haX-15,haY+7);
curveVertex(haX-13,haY+5);
curveVertex(haX-19,haY-5);
curveVertex(haX-19,haY-5);
endShape(CLOSE);
line(haX-15,haY+7,haX-5,haY);
}
else
{ fill(0,455,0);
ellipse(haX,haY,20,25);
fill(0xffF00524);
ellipse(haX-5,haY-5,5,5);
beginShape();
curveVertex(haX-4,haY+10);
curveVertex(haX-4,haY+10);
curveVertex(haX-12,haY+12);
curveVertex(haX-13,haY+16);
curveVertex(haX-13,haY+16);
endShape(CLOSE);

fill(100);
beginShape();
curveVertex(haX+5,haY);
curveVertex(haX+5,haY);
curveVertex(haX+8,haY+7);
curveVertex(haX+13,haY+9);
curveVertex(haX+15,haY+7);
curveVertex(haX+13,haY+5);
curveVertex(haX+19,haY-5);
curveVertex(haX+19,haY-5);
endShape(CLOSE);
line(haX+15,haY+7,haX+5,haY);

}
}
}
public void reaction()
{
  if(harpydead==false){
if(x<haX+20&&x>haX-20&&y<haY+20&&y>haY-20)
{
  y=600;
ellipsemake10=false;
}
if(xs<haX+20&&xs>haX-20&&ys<haY+20&&ys>haY-20)
{
ys=-600;
}
if(haX==hsX-30||haX==hsX-31)
{
harpyx=true;
}
else if(haX==hsX+36||haX==hsX+37)
{
harpyx=false;
}
if(haY==hsY-36||haY==hsY-37)
{
harpyy=true;
}
else if(haY==hsY+30||haY==hsY+31)
{
harpyy=false;
}
if(harpyx==true)
{
haX=haX+2;
}
if(harpyx==false){
haX=haX-2;
}
if(harpyy==true)
{
haY=haY+2;
}
if(harpyy==false)
{
haY=haY-2;
}
if(hitable==true&&xtears>haX-20&&xtears<haX+20&&ytears<haY+20&&ytears>haY-20)

{
harpydead=true;
pointes=pointes+200;
}
}}
}
class wormboss{
  
 
  int wormlive;
wormboss(int curfbX, int curfbY,boolean curwormbossdead,int curwormlive)
{
fbX=curfbX;
fbY=curfbY;
wormbossdead=curwormbossdead;
wormlive=curwormlive;
}
public void display()
{ if(wormbossdead==false)
{
textFont(hellosmall);
fill(0xff157608);
text("Wormboss "+wormlive+"/50",fbX-20,fbY-70);
stroke(0);
  if(hitablew==true&&xtears>fbX-50&&xtears<fbX+50&&ytears<fbY+50&&ytears>fbY-50)
  {if(smarttears==true)
  {
  wormlive=wormlive-14;
  }
  else{
  wormlive=wormlive-10;}
  ellipsemake10=false;
  xtears=0;
  
  }
  if(wormlive<1)
  {
  wormbossdead=true;
  hitablew=false;
  pointes=pointes+1000;
  }
  if(hitablew==true&&x>fbX-50&&x<fbX+50&&y<fbY+50&&y>fbY-50)
  {
    y=600;
  
  }
  if(xs>fbX-50&&xs<fbX+50&&ys<fbY+50&&ys>fbY-50)
  {
    ys=-600;

  }
  fill(0,255,0);
   ellipse(fbX,fbY,60,60);
if(x<fbX)
{
fbX=fbX-1;
}
else if(x>fbX)
{
fbX=fbX+1;
}
if(y<fbY)
{
fbY=fbY-1;
}
else if(y>fbY)
{
fbY=fbY+1;
}
if(y<fbY&&x<fbX+20&&x>fbX-20)
{
 xRotate=180;
}
else if(y>fbY&&x<fbX+20&&x>fbX-20)
{
 xRotate=0;
    
}
else if(x<fbX&&y<fbY+20&&y>fbY-20)
{xRotate=90;
}
else if(x>fbX&&y<fbY+20&&y>fbY-20)
{ xRotate=270;
}
else if(x<fbX&&y<fbY+20)
{
xRotate=135;
}
else if(x<fbX&&y>fbY+20)
{
xRotate=45;
}
else if(x>fbX&&y<fbY-20)
{
xRotate=225;
}
else if(x>fbX&&y>fbY+20)
{
xRotate=315;
}

  pushMatrix();
translate(fbX,fbY);
rotate( radians(xRotate) );
 beginShape();
 fill(150);
 curveVertex(-20,+30);
 
  curveVertex(-20,25);
  curveVertex(-25,50);
    curveVertex(-20,70);
curveVertex(-10,75);
     curveVertex(-7,70);
        curveVertex(-10,65);
        curveVertex(-7,60);
         curveVertex(-10,55);
         curveVertex(-7,50);
         curveVertex(-10,45);
         curveVertex(-7,40);
         curveVertex(-10,35);
         curveVertex(-7,30);
          curveVertex(-7,30);
    endShape(CLOSE);
    beginShape();
     curveVertex(20,30);
 
  curveVertex(20,25);
  curveVertex(25,50);
    curveVertex(20,70);
curveVertex(10,75);
     curveVertex(7,70);
        curveVertex(10,65);
        curveVertex(7,60);
         curveVertex(10,55);
         curveVertex(7,50);
         curveVertex(10,45);
         curveVertex(7,40);
         curveVertex(10,35);
         curveVertex(7,30);
          curveVertex(7,30);
    endShape(CLOSE);
popMatrix();
}
}}
public void heli()
{

if(helidisplay==true)
{
noStroke();
pushMatrix();
translate(hx-125,hy-125);
scale(0.5f);
if(x>hx)
{scale(-1);}
beginShape();
pushMatrix();
translate(250,250);
rotate(radians(hturn));
image(hel,0,0);
popMatrix();

stroke(1);
image(hel2,275,280);
endShape();
popMatrix();
hturn+=3;
if(hturn==360)
{
hturn=0;
}
if(x<hx&&hx<400)
{
hx++;
}
if(x>hx&&hx>100)
{
hx--;
}

if(ccc==501){ccc=0;}
miss.display();
ccc++;
}
hy=500-y;

}
class missile {
  boolean o=false;
float mix=450, miy, sav, sav2, sav3;
missile(float cy){
 miy=cy;

}
  
  public void display()
  {
    if(ccc==500)
    {mix=450;
  miy=hy;
o=false;}
    pushMatrix();
translate(mix,miy);
scale(-0.5f);
if(o==false){
rotate(radians(atan2(y- miy, x-mix)*50));}
else{
rotate(radians(sav3));
}
  image(missile,0,0);
  popMatrix();
  if(mix>x+50&&o==false){
mix = mix+cos(radians(atan2(y- miy, x-mix)*50))*6 ;
miy = miy+sin(radians(atan2(y - miy, x - mix)*50));
sav=cos(radians(atan2(y- miy, x-mix)*50))*6;
sav2=sin(radians(atan2(y - miy, x - mix)*50)) *2;
sav3=atan2(y- miy, x-mix)*50;
}
else{mix=mix+sav;
o=true;
miy=miy+sav2;}


}}
//line 269
public void multiGameOver()
{jobo=true;
background(0);
mankind=true;
fill(255);
textFont(hello);
text("Game Over",200,100);
hell=true;
x=150;
y=150;
cyclope1.display();
xs=150;
ys=250;
cyclope2.display();
fill(255);
text("  =  "+pointes,x+50,y);
text("  =  "+pointes2,xs+50,ys);
if(mousePressed)
{if(musicon==true){
  song.rewind();
song.pause();
smenu.rewind();}
game=1;
rectMode(CORNER);

  setup();


}
}


public void GameOver()
{jobo=false;
textFont(hello);
  background(0);
  if(akap>1)
{
stillalive=false;
}
else{stillalive=true;}
if(stillalive==true)
{
full[heartlesscounter]=false;
heartlesscounter--;
y=20;
akap++;
pointes-=400;
if(pointes<0)
{pointes=0;}
if(x<0)
{x=80;}
draw();
}else{
  if(pointes>highscore)
{
  if(game==2){
highsc();
highscore=pointes;}
else if(game==4)
{bhighsc();
bhighscore=pointes;
}
}
background(0);
if(pointes<0)
{pointes=0;}
 fill(255);
if(wormbossdead==true)
{
text("WIN",width/2,200);
if(win<1)
{
win=1;
manage1();
}}
else{
  
text("Game Over",width/2,200);}
if(game==2){
text("Highscore: "+highscore,width/2,300);}
else if(game==4)
{text("Highscore: "+bhighscore,width/2,300);}
text("Points: "+pointes,width/2,350);
text("klick to continue",width/2,450);
ended=true;
if(mousePressed)
{if(musicon==true){
  song.rewind();
song.pause();
smenu.rewind();}
game=1;
rectMode(CORNER);

  setup();

}
}}
class heart{
  int heax;
  int heay;
  int heartnumber;
heart(int curheax,int curheay, int curheartnumber)
{
heax=curheax;
heay=curheay;
heartnumber=curheartnumber-1;

}
public void display()
{beginShape();
noFill();
if(full[heartnumber]==true){
fill(255,0,0);}
curveVertex(heax,heay-5);
curveVertex(heax,heay-5);
curveVertex(heax-5,heay-10);
curveVertex(heax-10,heay-10);
curveVertex(heax-12,heay);
curveVertex(heax,heay+15);
curveVertex(heax,heay+15);
endShape();
beginShape();
curveVertex(heax,heay-5);
curveVertex(heax,heay-5);
curveVertex(heax+5,heay-10);
curveVertex(heax+10,heay-10);
curveVertex(heax+12,heay);
curveVertex(heax,heay+15);
curveVertex(heax,heay+15);
endShape();
if(full[heartnumber]==true)
{
stillalive=true;
}
}
}
public void keyPressed()
{
if(key=='a'||keyCode==LEFT||key=='A')
{
keys[0]=true;
}

if(key=='d'||keyCode==RIGHT||key=='D')
{
keys[1]=true;
}
}


public void keyReleased()
{
  if(key=='r'||key=='R')
  {
  GameOver();
  }
  if(key==CODED){
  if(keyCode==ESC)
  {
  exit();
  }}
if(key=='a'||keyCode==LEFT||key=='A')
{
keys[0]=false;
}
if(key=='d'||keyCode==RIGHT||key=='D')
{
keys[1]=false;
}



if(key==' ')
  {

shot1=new shot(PApplet.parseInt(x),PApplet.parseInt(y));
treshoot=true;
}
}

public void mouseReleased()
{ 
  if(mouseX<405&&mouseX>315&&mouseY<325&&mouseY>215&&game==1&&win>0)
  {
  
  game=4;
  }
  if(mouseX<500&&mouseX>440&&mouseY<500&&mouseY>440&&game==3)
 {
 game=1;
 waitfornow=true;
 }
 if(mouseX<250&&mouseX>200&&mouseY<225&&mouseY>185&&game==3)
{
musicon=true;
song.rewind();
smenu.rewind();
smenu.play();

}
 if(mouseX<375&&mouseX>325&&mouseY<225&&mouseY>185&&game==3){
 musicon=false;
 song.pause();
 smenu.pause();
 }
  if(mouseX<500&&mouseX>450&&mouseY<500&&mouseY>450&&game==1&&waitfornow==false)
{game=3;

}
 if(mouseX<50&&mouseX>0&&mouseY<500&&mouseY>450&&game==1)
 {
 smenu.pause();
 song.pause();
 exit();}

  if(mouseX<275&&mouseX>160&&mouseY<260&&mouseY>150&&mouseState==1&&game==1)
  {game=2;
mouseState=2;
}
  if(mouseState==0)
{
game=1;
mouseState=1;
}
waitfornow=false;

}
public void crea1(){
  text1 = new textform(300,50,ghj,0,1);
text2 = new textform(900,320,"Wait...",0,1);
  
  r1=(random(150,350));
platt1 = new plattform(170,200,2,0xff109B8E);
r2=(random(150,350));
platt2 = new plattform(300,r2,1,0xff109B8E);
r2=(random(150,350));
platt3 = new plattform(400,r2,1,0xff109B8E);
r4=(random(150,350));
platt4 = new plattform(1000,r4,3,0xff109B8E);
r5=(random(150,350));
platt5 = new plattform(1800,r5,2,0xff109B8E);
r6=(random(150,350));
platt6 = new plattform(900,r6,1,0xff109B8E);
r7=(random(150,350));
platt7 = new plattform(1400,r7,4,0xff109B8E);
r8=(random(150,350));
platt8 = new plattform(1200,r8,2,0xff109B8E);
r9=(random(150,350));
platt9 = new plattform(1800,r9,4,0xff109B8E);
r10=(random(150,350));
platt10 = new plattform(2000,r10,2,0xff109B8E);
r11=(random(150,350));
platt11 = new plattform(3000,r11,3,0xff109B8E);
r12=(random(250,350));
sp1= new spikeplatt(2300,r12,false,2);
r1=(random(150,350));
platt12 = new plattform(1300,r1,1,0xff109B8E);
r1=(random(150,350));
platt13 = new plattform(3300,r1,3,0xff109B8E);
r1=(random(250,350));
platt14 = new plattform(2800,r1,2,0xff109B8E);
r1=(random(50,150));
sp2 = new spikeplatt(2700,r1,true,2);
r1=(random(150,350));
platt15 = new plattform(3700,r1,3,0xff109B8E);
r1=(random(210,350));
platt16 = new plattform(1700,r1,1,0xff109B8E);
text3 = new textform(1600,r1+30,"Moving Plattforms..",0,1);
jplatt1 = new jplattform(1900,400,1);
r1=(random(150,350));
platt17 = new plattform(2100,r1,1,0xff109B8E);
jplatt2 = new jplattform(2300,200,1);
r1=(random(250,400));
platt18 = new plattform(6500,r1,2,0xff109B8E);
r1=(random(400,500));
sp3=new spikeplatt(5800,r1,false,3);
r1=(random(250,350));
platt19 = new plattform(2600,r1,1,0xff109B8E);
text4=new textform(2550,r1+30,"WTF?!? Enemies",0,1);
r1=(random(250,400));
platt20 = new plattform(2900,r1,1,0xff109B8E);
jplatt3=new jplattform(3200,300,1);
r1=(random(250,400));
platt21= new plattform(5900,r1,2,0xff109B8E);
sp4=new spikeplatt(3400,500,false,1);
r1=(random(250,400));
platt22=new plattform(3600,r1,1,0xff109B8E);
r1=(random(250,400));
platt23=new plattform(3800,r1,1,0xff109B8E);
jplatt4=new jplattform(4000,300,1);
jplatt5=new jplattform(4200,250,1);
sp5=new spikeplatt(4100,450,false,1);
sp6=new spikeplatt(4200,450,false,1);
sp7=new spikeplatt(4300,450,false,1);
sp8=new spikeplatt(4400,450,false,1);
sp9=new spikeplatt(4500,450,false,1);
sp10=new spikeplatt(4600,450,false,1);
sp11=new spikeplatt(4100,30,true,1);
sp12=new spikeplatt(4200,30,true,1);
sp13=new spikeplatt(4300,30,true,1);
sp14=new spikeplatt(4400,30,true,1);
sp15=new spikeplatt(4500,30,true,1);
sp16=new spikeplatt(4600,30,true,1);
jplatt6=new jplattform(4500,300,1);
jplatt7=new jplattform(5100,300,1);
jplatt8=new jplattform(5400,200,1);
r1=(random(250,400));
platt24=new plattform(4700,r1,1,0xff109B8E);
r1=(random(250,400));
platt25=new plattform(4900,r1,1,0xff109B8E);
harpy1=new harpy(300,200,false);
harpy2=new harpy(400,300,false);
boss1=new wormboss(450,200,false,50);
ears = new item(1,2,2000,r10-20);
coat = new item(2,2,2000,r10-20);
chilli=new item(3,2,2000,r10-20);
x=80;
y=80;
}
 
public void draw1(){

   background(ca,cb,cc);
   rectMode(CENTER);
   if(treshoot==true){
shot1.display();}
fill(0);
noStroke();
rect(50,450,50,100);
rect(100,470,50,70);
rect(200,450,50,100);
rect(250,440,70,130);
rect(300,480,30,40);
rect(450,470,70,100);
stroke(0xff5F040B);
fill(255,255,0);
rect(55,440,10,10);
rect(105,465,10,10);
rect(255,410,10,10);
rect(305,475,10,10);
rect(445,445,10,10);
 
stroke(0);
   if(gag==true){
ca++;
cb++;
cc--;
if(ca==255)
{gag=false;}}
else if(gag==false)
{
cc++;
cb--;
ca--;
if(ca==0)
{
gag=true;
}
}

 if(mankind==false){
cyclope1.display();
cyclope1.movement();
if(sdf==false){
 if(mousePressed&&ended==false)
{cyclope2.display();
cyclope2.movement2();
sdf=true;
 
}
 
 
}}
if(sdf==true)
{
cyclope2.display();
cyclope2.movement2();

}
 
 
platt1.display();
platt1.reaction();
platt2.display();
platt2.reaction();
platt3.display();
platt3.reaction();
platt4.display();
platt4.reaction();
platt5.display();
platt5.reaction();
platt6.display();
platt6.reaction();
platt7.display();
platt7.reaction();
platt8.display();
platt8.reaction();
platt9.display();
platt9.reaction();
platt10.display();
platt10.reaction();
platt11.display();
platt11.reaction();
platt12.display();
platt12.reaction();
platt13.display();
platt13.reaction();
platt14.display();
platt14.reaction();
platt15.display();
platt15.reaction();
platt16.display();
platt16.reaction();
platt17.display();
platt17.reaction();
platt18.display();
platt18.reaction();
platt19.display();
platt19.reaction();
platt20.display();
platt20.reaction();
platt21.display();
platt21.reaction();
platt22.display();
platt22.reaction();
platt23.display();
platt23.reaction();
platt24.display();
platt24.reaction();
platt25.display();
platt25.reaction();
sp1.display();
sp2.display();
sp3.display();
sp4.display();
sp5.display();
sp6.display();
sp7.display();
sp8.display();
sp9.display();
sp10.display();
sp11.display();
sp12.display();
sp13.display();
sp14.display();
sp15.display();
sp16.display();
jplatt1.display();
jplatt1.reaction();
jplatt2.display();
jplatt2.reaction();
jplatt3.display();
jplatt3.reaction();
jplatt4.display();
jplatt4.reaction();
jplatt5.display();
jplatt5.reaction();
jplatt6.display();
jplatt6.reaction();
jplatt7.display();
jplatt7.reaction();
jplatt8.display();
jplatt8.reaction();
 if(sdf==false){
  stillalive=false;
h1.display();
h2.display();
h3.display();}
text1.display();
text2.display();
text3.display();
text4.display();

if(count>5000)
{
stop=true;
hitablew=true;
boss1.display();
 
}
textFont(hello);
 
if(count>2300)
{
harpy1.display();
harpy1.reaction();
harpy2.display();
harpy2.reaction();
hitable=true;
}
if(wormbossdead==true)
{y=600;
if(sdf==true)
{ys=0;}else{
GameOver();}
}


 
if(rand<3.3333f)
{
ears.ears();}
if(rand>3.3333f&&rand<6.66666f)
{
coat.transparentcoat();}
if(rand>6.66666f)
{
chilli.redtears();
}
 if(keys[0]==true)
  {
   
  psx=psx-3;
  }
   
if(keys[1]==true)
  {
  psx=psx+3;
 }
if(sdf==false)
{
if(y>600)
{
GameOver();
}
}
if(sdf==true)
{
if(y>600&&ys<0)
{
 multiGameOver();
 }}
 if(jobo==true){multiGameOver();}


count++;

}
 
 
class cyclope
{
  public void display(){
     
  if(coatenabled==false)
  {
stroke(0);
fill(0xffFCFFCE);
ellipseMode(CENTER);
ellipse(x,y,30,28);
fill(0xff4BDCFF);
if(smarttears==true)
{
fill(255,0,0);
point(x,y-5);
}ellipse(x,y-5,7,5);
beginShape();
stroke(0xffF07272);
fill(255,0,0);
curveVertex(x-10,y+5);
curveVertex(x-10,y+5);
curveVertex(x-5,y+7);
curveVertex(x,y+10);
curveVertex(x+3,y+13);
curveVertex(x+10,y+5);
curveVertex(x+10,y+5);
if(keys[0]==true)
  {
   
  px=px-3;
  }
   
if(keys[1]==true)
  {
  px=px+3;
 }
    if(x>px)
    {
    moveright=false;
   
fill(0xffFCFFCE);
stroke(0);
ellipseMode(CENTER);
ellipse(x,y,28,30);
fill(0xff4BDCFF);
if(smarttears==true)
{
fill(255,0,0);
point(x-9,y-5);
}
ellipse(x-9,y-5,5,7);
beginShape();
stroke(0xffF07272);
fill(255,0,0);
curveVertex(x-10,y+5);
curveVertex(x-10,y+5);
curveVertex(x-5,y+10);
curveVertex(x-2,y+1);
curveVertex(x-5,y+10);
 
endShape(CLOSE);
}
if(x<px)
{
  moveright=true;
fill(0xffFCFFCE);
stroke(0);
ellipseMode(CENTER);
ellipse(x,y,28,30);
fill(0xff4BDCFF);
if(smarttears==true)
{
fill(255,0,0);
point(x+9,y-5);
}
ellipse(x+9,y-5,5,7);
beginShape();
stroke(0xffF07272);
fill(255,0,0);
curveVertex(x+10,y+5);
curveVertex(x+10,y+5);
curveVertex(x+5,y+10);
curveVertex(x+2,y+1);
curveVertex(x+5,y+10);
 
endShape(CLOSE);
}
}
     
    
 
 
endShape(CLOSE);
  }
  public void movement()
  {
    if(hell==false)
    {
    if(touch==true)
  {
    if(ax<6)
    {
    y=y-8;
    }
    else if(ax>2&&ax<10)
    {
    y=y-7;
    }
    else if(ax>4&&ax<14)
    {
    y=y-6;
    }
    else if(ax>6&&ax<20)
    {
    y=y-5;
    }
   
  else if(ax==20)
  {
    y=y-4;
  
  }
  else if(ax>20&&ax<26)
  {y=y-2;}
  else if(ax==26)
  {
   touch=false;
   ax=0;
  }
  if(ax<26)
  {
  ax++;
  }}
  else{
  y=y+gravity;}
 
 
     
  if(keys[0]==true)
  {
   
  x=x-3;
  }
   
if(keys[1]==true)
  {
  x=x+3;
 }


if(mouseX<xs)
{
xs=xs-3;
}
else if(mouseX>xs)
{
xs=xs+3;
}
    }
  }
}
//line 387
 
public void highsc(){
  Highs=Integer.toString(pointes);
  String[] High=split(Highs,' ');
saveStrings("xXx.txt",High);
}
public void manage1(){Le1=Integer.toString(win);
  String[] le1=split(Le1,' ');
saveStrings("Xxxx.txt",le1);
}
public void bhighsc(){
  String troll=Integer.toString(pointes);
  String[] Troll=split(troll,' ');
  saveStrings("XxXxX.txt",Troll);

}
class item{
int effect;
int itemsS;
int itemx;
float itemy;
  item(int cureffect,int curitemsS,int curitemx,float curitemy)
  {
  effect=cureffect;
  itemx=curitemx;
  itemy=curitemy;
  itemsS=curitemsS;
  }
  public void ears()
  {
if(sdf==false)
{
  if(earsenabled==false)
  {
  itemx=itemx-itemsS;
  }
  if(earsenabled==true)
{
itemx=x;
itemy=y;
gravity=3;}
fill(0xffF5FC96);
helix=false;
if(earsenabled==true){
  
if(keyPressed)
{
  helix=true;
  if(key=='a'||key=='A'||keyCode==LEFT)
{
  helix=true;
  beginShape();

  curveVertex(x+4,y-7);
curveVertex(x+4,y-7);

curveVertex(x+6,y-11);
curveVertex(x+13,y-12);
curveVertex(x+15,y-5);
curveVertex(x+13,y+4);
curveVertex(x+6,y+3);
curveVertex(x+4,y-1);
curveVertex(x+4,y-1);

endShape(CLOSE);
line(x+6,y-11,x+6,y+3);

}
if(key=='d'||key=='D'||keyCode==RIGHT)
{helix=true;
if(coatenabled==false)
{
beginShape();

  curveVertex(x-4,y-7);
curveVertex(x-4,y-7);

curveVertex(x-6,y-11);
curveVertex(x-13,y-12);
curveVertex(x-15,y-5);
curveVertex(x-13,y+4);
curveVertex(x-6,y+3);
curveVertex(x-4,y-1);
curveVertex(x-4,y-1);

endShape(CLOSE);
line(x-6,y-11,x-6,y+3);
}
}}}
if(helix==false)
{if(coatenabled==false){
beginShape();
curveVertex(itemx-12,itemy-4);
curveVertex(itemx-12,itemy-4);
curveVertex(itemx-19,itemy-10);
curveVertex(itemx-21,itemy-8);
curveVertex(itemx-23,itemy);
curveVertex(itemx-19,itemy+8);
curveVertex(itemx-13,itemy+6);
curveVertex(itemx-12,itemy);
curveVertex(itemx-12,itemy);
endShape(CLOSE);
arc(itemx-16, itemy, 1, 16, -PI / 6, PI / 6);


beginShape();
curveVertex(itemx+12,itemy-4);
curveVertex(itemx+12,itemy-4);
curveVertex(itemx+19,itemy-10);
curveVertex(itemx+21,itemy-8);
curveVertex(itemx+24,itemy);
curveVertex(itemx+19,itemy+8);
curveVertex(itemx+14,itemy+6);
curveVertex(itemx+12,itemy);
curveVertex(itemx+12,itemy);
endShape(CLOSE);
arc(itemx+16, itemy, 1, 16, -PI / 6, PI / 6);
}}
if(x<itemx+23&&x>itemx-23&&y<itemy+10&&y>itemy-10)
{
earsenabled=true;
}

  }}

public void transparentcoat()
{if(coatenabled==false){
  if(why==true){
  beginShape();
  noFill();
  stroke(0);
  curveVertex(itemx-3,itemy-4);
  curveVertex(itemx-5,itemy-10);
  curveVertex(itemx-10,itemy-12);
  curveVertex(itemx-15,itemy-10);
  curveVertex(itemx-17,itemy-4);
  curveVertex(itemx-17,itemy+10);
  curveVertex(itemx,itemy+10);
  curveVertex(itemx,itemy);
  endShape(CLOSE);
  beginShape();
  curveVertex(itemx+3,itemy-4);
  curveVertex(itemx+5,itemy-10);
  curveVertex(itemx+10,itemy-12);
  curveVertex(itemx+15,itemy-10);
  curveVertex(itemx+17,itemy-4);
  curveVertex(itemx+17,itemy+10);
  curveVertex(itemx,itemy+10);
  curveVertex(itemx,itemy);
  endShape(CLOSE);
itemx=itemx-itemsS;
}}
if(x<itemx+23&&x>itemx-23&&y<itemy+10&&y>itemy-10)
{
coatenabled=true;
coatdur=50;
why=false;
}
if(coatdur==0)
{
coatenabled=false;
}
if(coatenabled==true)
{
coatdur--;
}
}
public void redtears(){
if(smarttears==false)
{
itemx=itemx-itemsS;
beginShape();
fill(255,0,0);
curveVertex(itemx-9,itemy-6);
curveVertex(itemx-9,itemy-6);
curveVertex(itemx-6,itemy-3);
curveVertex(itemx-3,itemy-0);
curveVertex(itemx,itemy-0);
curveVertex(itemx+3,itemy-4);
curveVertex(itemx+6,itemy-8);
curveVertex(itemx+1,itemy-3);
curveVertex(itemx+1,itemy-3);
endShape(CLOSE);
if(x<itemx+10&&x>itemx-10&&y<itemy+20&&y>itemy-10){
smarttears=true;
}
}
}
}
//line 173
class plattform{
int posX;
  float posY;
  int tempSpeed;
  int speed;
  int pc;
  plattform(int tempposX,float tempposY,int tempSpeed,int curpc)
{
posX=tempposX;
posY=tempposY;
speed=tempSpeed;
pc=curpc;
}
public void display()
{if(xtears>posX-50&&xtears<posX+50&&ytears<posY+11&&ytears>posY-21)
{
ellipsemake10=false;
}
  fill(pc);
  
  rectMode(CENTER);
rect(posX,posY,100,20);
posX=posX-speed;
}
public void reaction()
{
if(x>posX-50&&x<posX+50&&y<posY+11&&y>posY-21)
{
touch=true;
if(jobo==false){
pointes=pointes+10;}
}
if(xs>posX-50&&xs<posX+50&&ys>posY+11&&ys<posY+21)
{
touch2=true;
if(jobo==false){
pointes2=pointes2+10;}
}
}
}



class splattform{
int posX;
  float posY;
  int tempSpeed;
  int speed;
  splattform(int tempposX,float tempposY,int tempSpeed)
{
posX=tempposX;
posY=tempposY;
speed=tempSpeed;
}
public void display()
{if(xtears>posX-50&&xtears<posX+50&&ytears<posY+11&&ytears>posY-21)
{
ellipsemake10=false;
}
 
  rectMode(CENTER);
  
  for (int i = posX-50; i < posX+50; i = i+20) {
 if(makak==true)
 {
 fill(0);
 makak=false;
 }
 else{
 fill(255);
 makak=true;
 }
rect(i,posY,20,20);

}
makak=true;
posX=posX-speed;}
public void reaction()
{
if(x>posX-50&&x<posX+50&&y<posY+11&&y>posY-21)
{
touch=true;
sa=x;
if(jobo==false){
pointes=pointes+50;}
}
if(xs>posX-50&&xs<posX+50&&ys>posY+11&&ys<posY+21)
{
touch2=true;
if(jobo==false){
  
pointes2=pointes2+50;}
}
}
}
class textform{
  int posTX;
  float posTY;
  String youtext;
  int ct;
  int speed;
 textform(int curposTX,float curposTY,String curyoutext, int curct,int curspeed)
{
youtext=curyoutext;
posTX=curposTX;
posTY=curposTY;
ct=curct;
speed=curspeed;
} 
  public void display()
  {
    fill(ct);

textFont(hello);
text(youtext,posTX,posTY);
posTX=posTX-speed;
}
}
//line 61
class spikeplatt
{

  int spX;
  float spY;
  boolean turn;
  int spspeed;
  spikeplatt(int curspX, float curspY, boolean curturn, int curspspeed)
  {
  spX=curspX;
  spY=curspY;
  turn=curturn;
  spspeed=curspspeed;
  }
  
public void display()
{
  if (x>spX-50&&x<spX+50&&y<spY+11&&y>spY-31&&turn==false)
  {
    y=600;
  
  }
  if(x>spX-50&&x<spX+50&&y<spY+31&&y>spY-11&&turn==true)
  {
  y=600;
  }
  if (xs>spX-50&&xs<spX+50&&ys<spY+11&&ys>spY-31&&turn==false)
  {
    ys=-600;
  
  }
  if (xs>spX-50&&xs<spX+50&&ys<spY+31&&ys>spY-11&&turn==true)
  {
    ys=-600;
  
  }
  if(xtears>spX-50&&xtears<spX+50&&ytears<spY+11&&ytears>spY-41)
{
ellipsemake10=false;
}
  fill(0);
  stroke(255,0,0);
rect(spX,spY,100,20);
if(turn==false)
{
triangle(spX-50,spY-8,spX-30,spY-50,spX-10,spY-8);
triangle(spX-20,spY-8,spX,spY-50,spX+20,spY-8);
triangle(spX+50,spY-8,spX+30,spY-50,spX+10,spY-8);
}

if(turn==true)
{
triangle(spX-50,spY+8,spX-30,spY+50,spX-10,spY+8);
triangle(spX-20,spY+8,spX,spY+50,spX+20,spY+8);
triangle(spX+50,spY+8,spX+30,spY+50,spX+10,spY+8);
}
spX=spX-spspeed;

}}






class jplattform{
int posX;
  float posY;
  int tempSpeed;
  int speed;
  jplattform(int tempposX,float tempposY,int tempSpeed)
{
posX=tempposX;
posY=tempposY;
speed=tempSpeed;

}
public void display()
{if(xtears>posX-50&&xtears<posX+50&&ytears<posY+11&&ytears>posY-21)
{
ellipsemake10=false;
}
  fill(0xffA7A00E);
  stroke(0);
  rectMode(CENTER);
rect(posX,posY,100,20);
if(stop==false){
posX=posX-speed;}
}
public void reaction()
{
if(x>posX-50&&x<posX+50&&y<posY+11&&y>posY-21)
{
touch=true;
if(jobo==false){
pointes=pointes+10;}
}
if(xs>posX-50&&xs<posX+50&&ys>posY+11&&ys<posY+21)
{
touch2=true;
if(jobo==false){
pointes2=pointes2+10;}
}
if(posY==150)
{
upgo=false;
}
else if(posY==400)
{
upgo=true;
}
if(upgo==true)
{
posY=posY-2;
}
else if(upgo==false)
{
posY=posY+2;
}
}
}
//line 107
public void story1()
{rectMode(CENTER);
strokeJoin(ROUND);
strokeCap(ROUND);
background(0xffCCCCCC);
fill(0,0,128);
rect(250,345,200,200);
  image(i1,250,250);
  strokeJoin(MITER);
strokeCap(MITER);

}
class shot
{
shot(int curtx,int curty){
xtears=curtx;
ytears=curty;
}
public void display()
{
  fill(0xff52F2FF);
if(smarttears==true)
{
fill(255,0,0);
}
stroke(0);


 ellipse(xtears,ytears,5,5);
 
xtears=xtears+10;
if(smarttears==true&&hitablew==true)
{
if(fbX<x){
xtears=xtears-20;
}
}
}
}
public void menu()
{
  background(0);
  pushMatrix();
  translate(200,200);
  rotate(radians(-25));
beginShape();
fill(255);
curveVertex(330-200,330-200);
curveVertex(330-200,330-200);
curveVertex(150-200,300-200);
curveVertex(100-200,100-200);
curveVertex(300-200,150-200);
curveVertex(330-200,330-200);
curveVertex(330-200,330-200);
endShape();

popMatrix();
if(win>0)
{
  noStroke();
beginShape();
curveVertex(330,190);
curveVertex(330,190);
curveVertex(340,300);
curveVertex(360,350);
curveVertex(460,270);
curveVertex(450,200);
curveVertex(330,190);
curveVertex(330,190);
endShape(CLOSE);
stroke(0);


pushMatrix();
translate(375,240);
rotate(radians(25));
fill(0,0,255);
ellipse(0+15,0,50,110);
fill(0xffECF096);
ellipse(0,0,30,100);

popMatrix();
image(btree,375,240);
image(btree,370,250);
fill(0);
if(mouseX<405&&mouseX>315&&mouseY<325&&mouseY>215)
{pushMatrix();
translate(380,305);
scale(1.4f);
fill(255,0,0);
text("Beach 1-2",0,0);
popMatrix();
}
else{
text("Beach 1-2",380,305);}
pushMatrix();
fill(0);
translate(375,320);
scale(0.8f);
text("Highscore "+bhighscore,0,0);
popMatrix();
}
 pushMatrix();
 translate(470,470);
  scale(0.5f);
 if(scaleoption==true)
 {scale(1.5f);}

 rotate(radians(wheelturnb));
 wheelturn++;
 wheelturnb--;
 if(wheelturnb==0)
 {wheelturnb=360;}
 if(wheelturn==360)
 {wheelturn=0;}
 image(optio,0,0);

 popMatrix();
  if(mouseX<500&&mouseX>450&&mouseY<500&&mouseY>450)
 {
 scaleoption=true;
 }
 else{
 scaleoption=false;
 }
 pushMatrix();
 translate(30,470);
 stroke(255);
 rotate(radians(wheelturn));
 strokeWeight(5);
 if(mouseX<50&&mouseX>0&&mouseY<500&&mouseY>450)
 {scale(1.5f);}
 fill(0);
 ellipse(0,0,30,30);
 line(-10,-10,10,10);
 line(10,-10,-10,10);
 stroke(0);
 strokeWeight(1);
 popMatrix();
fill(0xff0E296C);
rect(180,180,20,40);
rect(250,180,25,40);
rect(200,160,30,60);
fill(255,255,0);
rect(207,175,7,7);
rect(215,194,7,7);
rect(190,190,6,6);
rect(255,190,6,6);
fill(0);
textFont(levelfont);

if(mouseX<275&&mouseX>160&&mouseY<260&&mouseY>150)
{pushMatrix();
translate(225,240);
scale(1.4f);
fill(255,0,0);
text("City 1-1",0,0);
popMatrix();
}
else{
text("City 1-1",225,240);}
fill(0);
pushMatrix();
translate(225,260);
scale(0.8f);
text("Highscore "+highscore,0,0);
popMatrix();
}

public void intro()
{
background(0);
noStroke();

fill(0xffAA0303);
ellipse(330,320,300,300);
fill(255);
beginShape();
curveVertex(200,200);
curveVertex(200,200);
curveVertex(220,300);
curveVertex(300,320);
curveVertex(400,400);
curveVertex(250,350);
curveVertex(250,350);
endShape();
pushMatrix();
textFont(hello);
rotate(radians(-50));
translate(0,250);
text("Dark",0,-100);
text("Entertainment",0,-50);
fill(0xff2010E3);
text("             blue",0,-100);
popMatrix();
stroke(0);
timer++;
if(timer==200)
{game=1;}
}
public void setting()
{
background(0);
textFont(hello);
fill(255);
text("Settings",250,100);
textFont(font);
text("Music",100,200);
if(musicon==true)
{
rect(200,185,50,20);
text("off",350,200);
fill(0);
text("on",225,200);
}
else{
rect(325,185,50,20);
text("on",225,200);
fill(0);
text("off",350,200);
}

pushMatrix();
fill(255);
translate(450,450);
scale(0.5f);
scale(0.3f);
if(mouseX<500&&mouseX>440&&mouseY<500&&mouseY>440)
{
scale(3);
}
image(ex,0,0);
popMatrix();

}

public void cred(){background(0);
fill(255);
textFont(hello);
text("Cyclops",width/2,200);

textFont(hellosmall);
text("Programmed by - Kevin De Keyser",310,350);
text("Music by - Lucas Schenck",335,370);
text("Copyright - 2011-2012 All Rights Reserved - Dark Entertainment",350,480);
fill(0xffFCFFCE);
stroke(0);
ellipse(50,400,160,200);
fill(250,0,0);
ellipse(90,350,20,20);
fill(0xff4BDCFF);
ellipse(120,450,80,100);
beginShape();
stroke(0xffF07272);
fill(255,0,0);
pushMatrix();
translate(150,480);
rotate(radians(25));
scale(3);
curveVertex(0-10,0-5);
curveVertex(0-10,0-5);
curveVertex(0-5,0-10);
curveVertex(0-2,0-1);
curveVertex(0-5,0-10);
 
endShape(CLOSE);
popMatrix();
fill(0xffFAFF08);
stroke(0);
ellipse(140,420,11,10);
}
  public void settings() { 
size(500,500); 
smooth(); }
  static public void main(String[] passedArgs) {
    String[] appletArgs = new String[] { "Cyclops_v1o5" };
    if (passedArgs != null) {
      PApplet.main(concat(appletArgs, passedArgs));
    } else {
      PApplet.main(appletArgs);
    }
  }
}
