Hey, guys i got an question about my code i want to reset the int [] hinder so that the objects arre resettet when i make back=true. Is it possible to make processing by my android things multiple screens because on my phone is it perfect but on my tablet not.
Thanks.
PImage Hintergrund, figur1, figur2, figur3, Rakete, GameOverScreen, Gewonnen, Gewonnen2, arrow;
int hg;
boolean starten, knopf, figur1_ak, figur2_ak, figur3_ak;
int [] hinder;
int [] hinderspeed;
int [] speed;
boolean [] sichtbar;
int springen;
int figurx;
int figury;
int SprSpeed;
boolean springt = false;
int counter;
int speedcounter;
boolean einstellungen;
boolean GameOver;
boolean spiel_laeuft;
boolean gewonnen;
boolean back;
int [] timer;
int timer1;
void setup()
{
size(displayWidth, displayHeight);
orientation(LANDSCAPE);
//size(1600,800);
hinder = new int[100];
sichtbar = new boolean [100];
hinderspeed = new int [30];
timer= new int[30];
speed = new int [30];
figurx = 95;
figury = 800;
speedcounter=0;
timer1=0;
counter=0;
hg=0;
figur1=loadImage(“mario.png”);
figur2=loadImage(“figur2.png”);
figur3=loadImage(“figur3.png”);
Rakete=loadImage(“rakete.png”);
GameOverScreen=loadImage(“goscreen.jpg”);
arrow=loadImage(“arrow.png”);
Hintergrund = loadImage(“hintergrund.png”);
spiel_laeuft=false;
einstellungen=false;
GameOver=false;
gewonnen=false;
knopf=false;
starten=false;
figur1_ak=true;
figur2_ak=false;
figur3_ak=false;
back=false;
for (int i=0; i<20; i=i+1)
{
hinder[i]=2000;
hinderspeed[i]=0;
sichtbar[i]=false;
}
speed[0]= 17;
speed[1]= 14;
speed[2]= 25;
speed[3]= 20;
speed[4]= 35;
speed[5]= 35;
speed[6]= 30;
speed[7]= 25;
speed[8]= 20;
speed[9]= 35;
speed[10]= 30;
speed[11]= 20;
speed[12]= 35;
speed[13]= 20;
speed[14]= 45;
speed[15]= 40;
speed[16]= 34;
speed[17]= 22;
speed[18]= 25;
speed[19]= 35;
speed[20]= 35;
speed[21]= 43;
speed[22]= 31;
speed[23]= 25;
speed[24]= 33;
speed[25]= 35;
speed[26]= 35;
speed[27]= 29;
speed[28]= 15;
speed[29]= 3;
timer[0]=10;
timer[1]=25;
timer[2]=40;
timer[3]=35;
timer[4]=35;
timer[5]=35;
timer[6]=35;
timer[7]=25;
timer[8]=20;
timer[9]=30;
timer[10]=25;
timer[11]=15;
timer[12]=25;
timer[13]=10;
timer[14]=40;
timer[15]=20;
timer[16]=25;
timer[17]=30;
timer[18]=40;
timer[19]=50;
timer[20]=10;
timer[21]=20;
timer[22]=25;
timer[23]=10;
timer[24]=30;
timer[25]=10;
timer[26]=40;
timer[27]=50;
timer[28]=20;
timer[29]=50;
}
void draw()
{
background(250);
fill(250, 0, 0);
rect(800, 200, 400, 250);
if (starten==false);
{
fill(0, 250, 0);
textSize(35);
text(“Klicke zum Starten!”, 835, 330);
fill(250, 0, 250);
textSize(20);
text(“created by Nick and Marvin”, 10, 1070);
fill(0, 0, 250);
rect(800, 600, 400, 100);
textSize(40);
fill(250, 0, 0);
text(“Einstellungen”, 870, 660);
if (einstellungen==true)
{
background(250);
fill(0, 0, 250);
textSize(50);
text(“Wähle eine Figur!”, 750, 70);
fill(0, 0, 250);
rect(100, 250, 400, 600);
rect(750, 250, 400, 600);
rect(1450, 250, 400, 600);
rect(10, 950, 250, 80);
if (figur1_ak==true && figur2_ak==false && figur3_ak==false)
{
fill(250, 0, 0);
rect(100, 250, 400, 600);
}
if (figur2_ak==true && figur1_ak==false && figur3_ak==false)
{
fill(250, 0, 0);
rect(750, 250, 400, 600);
}
if (figur3_ak==true && figur2_ak==false && figur1_ak==false)
{
fill(250, 0, 0);
rect(1450, 250, 400, 600);
}
image(figur1, 100, 250, 400, 600);
image(figur2, 700, 250, 500, 600);
image(figur3, 1450, 250, 400, 600);
fill(250, 0, 0);
text("Zum Start", 10, 1000);
}
if (GameOver==true)
{
image(GameOverScreen, 0, 0, 1950, 1100);
fill(0);
textSize(100);
text("Punkte:"+ counter, 800, 100);
fill(0, 0, 250);
rect(10, 950, 250, 80);
fill(250,0,0);
textSize(60);
text("Neustart",10,1000);
}
}
// SPIEL
if (starten==true && spiel_laeuft==true)
{
//background(Hintergrund);
image(Hintergrund, hg, 0, 1600, 1200);
image(Hintergrund, hg+1600, 0, 1600, 1200);
image(Hintergrund, hg+3200, 0, 1600, 1200);
if (figur1_ak==true)
{
figur2_ak=false;
figur3_ak=false;
image(figur1, figurx, figury, 150, 150);
}
if (figur2_ak==true)
{
figur1_ak=false;
figur3_ak=false;
image(figur2, figurx, figury, 150, 150);
}
if (figur3_ak==true)
{
figur1_ak=false;
figur2_ak=false;
image(figur3, figurx, figury, 150, 150);
}
hg=hg-5;
fill(250, 0, 0);
noFill();
rect(1600,150,220,220);//PFEIL
image(arrow, 1600, 150, 220, 220);
// SPRINGEN
if (springt == true)
{
figury = figury - SprSpeed;
SprSpeed = SprSpeed -3;
if (figury>800)
{
springt=false;
figury = 800;
}
}
if (knopf==true && springt == false)
{
springt = true;
SprSpeed = 35;
knopf=false;
}
// HINDERNISSE
hinder[counter]=2000;
fill(0);
textSize(40);
text(counter, 20, 40);
timer1=timer1+1;
if (timer1>timer[speedcounter])
{
timer1=0;
sichtbar[counter]=true;
hinderspeed[counter]= speed[speedcounter];
hinder[counter]=2000;
counter= counter+1;
speedcounter= speedcounter+1;
}
if (hg<-1600)
{
hg=0;
}
// Hindernisse
for (int i=0; i<100; i=i+1)
{
if (sichtbar[i]==true)
{
hinder[i]=hinder[i]-hinderspeed[i];
image(Rakete, hinder[i], 870, 120, 80);
if (hinder[i]<-100)
{
sichtbar[i]=false;
}
}
if (hinder[i]< figurx+155 && hinder[i] > figurx - 70 && figury > 760)
{
GameOver=true;
starten=false;
}
}
}
if (counter == 29)
{
gewonnen=true;
}
if (gewonnen==true)
{
background(250);
image(Gewonnen, 880, 370, 800, 800);
image(Gewonnen2, -400, 400, 800, 800);
starten=false;
textSize(70);
text(“Du hast gewonnen!”, 370, 230);
}
if (back==true)
{
einstellungen=false;
GameOver=false;
counter=0;
hinder[counter]=2000;
back=false;
}
}
void mousePressed()
{
//println(mouseX, mouseY);
if (starten==false && GameOver==true)
{
if (mouseX>10 && mouseX<260 && mouseY>950 && mouseY<1030)
{
back=true;
}
}
if (mouseX>800 && mouseX<1200 && mouseY>600 && mouseY<700 && starten==false)
{
einstellungen=true;
}
if (mouseX>800 && mouseX<1200 && mouseY>200 && mouseY<450 && einstellungen==false)
{
starten=true;
spiel_laeuft=true;
}
if (starten==true && spiel_laeuft==true)
{
if (mouseX>1600 && mouseX<1820 && mouseY>150 && mouseY<370)
{
knopf=true;
}
}
if (einstellungen==true)
{
if (mouseX>100 && mouseX<500 && mouseY>250 && mouseY<850)
{
figur1_ak=true;
figur2_ak=false;
figur3_ak=false;
}
if (mouseX>750 && mouseX<1150 && mouseY>250 && mouseY<850)
{
figur1_ak=false;
figur2_ak=true;
figur3_ak=false;
}
if (mouseX>1450 && mouseX<1850 && mouseY>250 && mouseY<850)
{
figur1_ak=false;
figur2_ak=false;
figur3_ak=true;
}
if (mouseX>10 && mouseX<260 && mouseY>950 && mouseY<1030)
{
back=true;
}
}
}