Added userguess fail (partly)

This commit is contained in:
lov3b 2020-12-08 16:33:55 +01:00
parent ad958d406f
commit 75f08c40fb

View File

@ -18,11 +18,15 @@ final int distansMellanrum = 20;
final int distansTot = distansLangd+distansMellanrum;
int state = startState;
// Användarfel
boolean gissatRatt=false;
int felGissningar = 0;
//Färger
final color rod = color(255,0,0);
final color gron = color(0,255,0);
final color bla = color(0,0,255);
final color turkos = color(0,255,255);
final color rod = color(255, 0, 0);
final color gron = color(0, 255, 0);
final color bla = color(0, 0, 255);
final color turkos = color(0, 255, 255);
final color svart = color(0);
// Images
PImage hill;
@ -51,7 +55,7 @@ void setup() {
// Images
hill = loadImage("hill.png");
sun = loadImage("sun.png");
sun.resize(120,101);
sun.resize(120, 101);
sky = loadImage("sky.png");
}
@ -126,8 +130,8 @@ void drawStart() {
void drawPlay() {
background(gron);
//image(sky,0,0);
image(hill,(width/2)-512/2,200);
image(sun,width-120,0);
image(hill, (width/2)-512/2, 200);
image(sun, width-120, 0);
noStroke();
fill(rod);
drawUnderstrack();
@ -146,14 +150,19 @@ void drawPlay() {
if (secretWordArray[i].charAt(0) == anvandarVal && harBilvitTaget[i] == false) {
println(i);
harBilvitTaget[i] = true;
gissatRatt=true;
}
}
if(gissatRatt == false){
felGissningar +=1;
}
// Stycket kod skriver ut de bokstäverna som användaren har gissat rätt i det hemliga ordet.
int[] understrackKordinater = PositionOfLetter();
for(int i=0; i < rVal.length(); i++){
if(harBilvitTaget[i]){
text(""+secretWordArray[i],float(understrackKordinater[i]),(height/4.0)*3-height*0.02125);
for (int i=0; i < rVal.length(); i++) {
if (harBilvitTaget[i]) {
text(""+secretWordArray[i], float(understrackKordinater[i]), (height/4.0)*3-height*0.02125);
}
}
}