mirror of
https://github.com/lov3b/h_ng_dig.git
synced 2025-01-19 05:10:09 +01:00
Added userguess fail (partly)
This commit is contained in:
parent
ad958d406f
commit
75f08c40fb
29
h_ng_dig.pde
29
h_ng_dig.pde
@ -18,11 +18,15 @@ final int distansMellanrum = 20;
|
|||||||
final int distansTot = distansLangd+distansMellanrum;
|
final int distansTot = distansLangd+distansMellanrum;
|
||||||
int state = startState;
|
int state = startState;
|
||||||
|
|
||||||
|
// Användarfel
|
||||||
|
boolean gissatRatt=false;
|
||||||
|
int felGissningar = 0;
|
||||||
|
|
||||||
//Färger
|
//Färger
|
||||||
final color rod = color(255,0,0);
|
final color rod = color(255, 0, 0);
|
||||||
final color gron = color(0,255,0);
|
final color gron = color(0, 255, 0);
|
||||||
final color bla = color(0,0,255);
|
final color bla = color(0, 0, 255);
|
||||||
final color turkos = color(0,255,255);
|
final color turkos = color(0, 255, 255);
|
||||||
final color svart = color(0);
|
final color svart = color(0);
|
||||||
// Images
|
// Images
|
||||||
PImage hill;
|
PImage hill;
|
||||||
@ -51,7 +55,7 @@ void setup() {
|
|||||||
// Images
|
// Images
|
||||||
hill = loadImage("hill.png");
|
hill = loadImage("hill.png");
|
||||||
sun = loadImage("sun.png");
|
sun = loadImage("sun.png");
|
||||||
sun.resize(120,101);
|
sun.resize(120, 101);
|
||||||
sky = loadImage("sky.png");
|
sky = loadImage("sky.png");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -126,8 +130,8 @@ void drawStart() {
|
|||||||
void drawPlay() {
|
void drawPlay() {
|
||||||
background(gron);
|
background(gron);
|
||||||
//image(sky,0,0);
|
//image(sky,0,0);
|
||||||
image(hill,(width/2)-512/2,200);
|
image(hill, (width/2)-512/2, 200);
|
||||||
image(sun,width-120,0);
|
image(sun, width-120, 0);
|
||||||
noStroke();
|
noStroke();
|
||||||
fill(rod);
|
fill(rod);
|
||||||
drawUnderstrack();
|
drawUnderstrack();
|
||||||
@ -146,14 +150,19 @@ void drawPlay() {
|
|||||||
if (secretWordArray[i].charAt(0) == anvandarVal && harBilvitTaget[i] == false) {
|
if (secretWordArray[i].charAt(0) == anvandarVal && harBilvitTaget[i] == false) {
|
||||||
println(i);
|
println(i);
|
||||||
harBilvitTaget[i] = true;
|
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.
|
// Stycket kod skriver ut de bokstäverna som användaren har gissat rätt i det hemliga ordet.
|
||||||
int[] understrackKordinater = PositionOfLetter();
|
int[] understrackKordinater = PositionOfLetter();
|
||||||
for(int i=0; i < rVal.length(); i++){
|
for (int i=0; i < rVal.length(); i++) {
|
||||||
if(harBilvitTaget[i]){
|
if (harBilvitTaget[i]) {
|
||||||
text(""+secretWordArray[i],float(understrackKordinater[i]),(height/4.0)*3-height*0.02125);
|
text(""+secretWordArray[i], float(understrackKordinater[i]), (height/4.0)*3-height*0.02125);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user