This code takes a 1 letter input from keyboard and moves a pointer
what i would like to do is take a 4 letter word input something like
if (input == cold ) { do this stuff }
thankyou for your time
`Preformatted text`
PShape s; // The PShape object
int y = 180; //pointer place
int rectWidth;
void setup() {
size(640, 360, P3D);
noStroke();
background(0);
rectWidth = width/4;
s = createShape();
s.beginShape();
s.fill(255, 255, 255);
s.noStroke();
s.vertex(0, 0);
// s.vertex(0, 0);
s.vertex(25, 25);
s.vertex(50, 0);
s.endShape(CLOSE);
}
void draw() {
// keep draw() here to continue looping while waiting for keys
textSize(50);
fill(600, 600, 612);
text("Temp", 40, 320);
fill(0, 0, 600);
rect(200, 290, 75, 30); //move accross,move up,size accross.size up
fill(0, 600, 0);
rect(275, 290, 100, 30); //move accross,move up,size accross.size up
fill(600, 0, 0);
rect(370, 290, 75, 30); //move accross,move up,size accross.size up
textSize(20);
fill(0, 0, 0);
text("Cold", 210, 310);
fill(0, 0, 0);
text("Good", 300, 310);
fill(0, 0, 0);
text("Hot", 390, 310);
fill(600, 600, 612);
}
void keyPressed() {
if (keyPressed) {
fill(0, 0, 0);
rect(150, 250, 300, 30); //move accross,move up,size accross.size up
if (key == 'z' ) {
y = 180;
shape(s, y, 255); //pointer
}
if (key == 'x' ) {
y = 200;
shape(s, y, 255); //pointer
}
if (key == 'c' ) {
y = 220;
shape(s, y, 255);//pointer
}
}
}