Hello, I’m new to Processing and this forum but I’m trying to create a project for University, where you can create a unique street as you type.
I have started with the character string example, however, instead of a character appearing, I would like specific thumbnail images(buildings) to appear. A different jpeg image for each key, which would appear in the same way as typing a sentence would.
this is my code at the moment:
char letter;
String words = "Type...";
PImage img1;
PImage img2;
PImage img3;
PImage img4;
PImage img5;
PImage img6;
PImage img7;
PImage img8;
void setup() {
size(640, 360);
img1 = loadImage("img1.png");
img2 = loadImage("img2.png");
img3 = loadImage("img3.png");
img4 = loadImage("img4.png");
img5 = loadImage("img5.png");
img6 = loadImage("img6.png");
img7 = loadImage("img7.png");
img8 = loadImage("img8.png");
textFont(createFont("Georgia-48.vlw", 36));
}
void draw() {
background(0);
textSize(14);
textSize(36);
text(words, 10, 10, 620, 500);
}
void keyTyped() {
if ((key >= 'A' && key <= 'z') || key == ' ') {
letter = key;
words = words + key;
println(key);
}
}
I hope my explanation makes sense,
If anybody has any clues that would be great, thank you!