We are about to switch to a new forum software. Until then we have removed the registration on this forum.
first post here so bear with me :P
Now I'm not a programmer by trade, but my university offers a programming unit related to digital arts using processing. An assignment I'm working on requires the user to input an integer value which is then used to create a range for randomization. Ideally the output should look like a bunch of random high-rises, creating a city skyline (abstract art don't question it) with 5 "high-rises". However, only one is appearing and the GUI appears again. Any help would be much appreciated as I'm at wits end with my deadline approaching fast :|
import static javax.swing.JOptionPane.*; //GUI element class
void setup() { //setup canvas size(1250,750); //sets size of canvas
frameRate(10);
}
void draw(){
String input = showInputDialog("Type in integer number...");
int num = parseInt(input == null? "" : input, MIN_INT);
if (input == null) showMessageDialog(null, "You didn't enter anything!", "Alert", ERROR_MESSAGE);
else if (num == MIN_INT) showMessageDialog(null, "Entry \"" + input + "\" isn't a number!", "Alert", ERROR_MESSAGE);
else showMessageDialog(null, "Number " + num + " has been registered.", "Info", INFORMATION_MESSAGE);
for(int i = 0 ; i < 5 ; i++) {
background(random(125,175),random(125,175),random(125,175)); //sets colour of canvas, ideally in rgb
fill (random (150,255));
float X = random(num,num+400);
float Y = random(num,num+450);
rect(X,Y,150,750);
}
Answers
https://Forum.Processing.org/two/discussion/12532/windowjs-cross-mode-alert-confirm-prompt-other-js-api-for-java
http://Studio.ProcessingTogether.com/sp/pad/export/ro.9$Bjf6i21oXBw
https://Gist.GitHub.com/GoToLoop/bba0c288aaeeb5ef9bb1
Thanks, will try them out tomorrow (it's a bit late rn) and see if I can get it to work as intended :P
https://Forum.Processing.org/two/discussion/15473/readme-how-to-format-code-and-text