mirror of
https://github.com/lov3b/h_ng_dig.git
synced 2025-01-18 21:00:11 +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;
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user