Sorry this could be in the wrong section but I'm wondering if anyone knows what the name is of the default font being used in the standard IDE for Processing. Asking because I have started using Eclipse IDE for Java and coming from the Processing language I would like to have the same font in Eclipse.
I'm really nervous about taking my first exam tomorrow on Processing . I struggle with questions that require output values to be written out. I am wondering if someone would be kind enough to explain what mental steps, procedures or questions one should take when faced with these sorts of questions. I thought I knew the process of loops but sometimes I just get confused with the more complicated ones.
Thanks.
//1. String[] myArray = split("shoes and ships and ceiling wax and cabbages and kings", ' '); String[][] myOtherArray = new String[3][3]; int index = 1; for (int i = 0; i < 3; i++) { for (int j = 0; j < 3; j++) { myOtherArray[i][j] = myArray[index]; index++; } println(myOtherArray[2][0]); } ------------------------------------- //2. int x = 0; for (int i = 0; i < 10; i++) if (i % 2 == 0) { x += 5; println(x); }
------------------------------------ //3. for (int i = 1; i <= 5; i++) for (int j = 10; j > i; j--) statement;
class Heart { int x, y; int dia; int steps; Heart(int _x, int _y, int _dia, int _steps) { x = _x; y = _y; dia = _dia; steps = _steps; } void drawCircle() { for (int i = dia; i > 0; i-=steps) { if (i%(2 * steps) == 0) { fill(col); } else { fill(col2); } ellipse(x, y, i, i); } } }
I am trying to simply count all the letters for a user input string but don't want any 'spaces' to be included in the count, just the letters.
Is this possible using length() ?
Thanks for any help!
import javax.swing.JOptionPane; String s;
void setup() { size(1000,400); background(255); fill(0); smooth(); textAlign(CENTER); textSize(18); s = JOptionPane.showInputDialog("Enter a word or sentence");
}
void draw() { text("There are "+s.length()+ " letters in your word or sentence.", width/2, 80); // length of string. }
Well I'm stuck again. All I'm trying to do is be able to click the mouse and drag the circle into any quadrant and have the ball 'snap' to the center of the quadrant upon a mouse release. When the mouse is released the color of the ball should change too - nothing occurs on a mouse press. How can I drag and release the 'ball' at this point and also make it change color upon a release?
Thanks.
Ball all;
void setup() { size(400, 400); smooth(); all = new Ball(); }
I am trying to write a program that will start with two random ellipses, at random diameters between 20,40 and at random positions and color with each start. The speed of the balls must be randomised between -5 and 5. If the two balls collide the program stops and if the balls hit any edges they are rebounded. I'm not sure how to go about adding collision detection to the balls or have them bounce off edges. I have never used a 'class' before so I'm just not sure if I have implemented things correctly (constructor) along with the functions I have used and well probably many other things that are wrong.
Any help would be appreciated.
Thanks.
Ball myBall;
void setup() { size(400, 400); myBall = new Ball(); //should this line be in the constructor for class ball? smooth(); frameRate(200); }
I am attempting to write a program that will draw different coloured filled circles in all four quadrants. That is the top left quadrant to draw red circles, the bottom left quadrant to draw green circles and the other two quadrants blue and black. I am an absalute beginner and I know the code I have so far is terrible and totally wrong but I can't seem to get the outcome Im looking for.
Absolutely any help in would be very appreciated in what or where it is Im going wrong.
void draw() { if (mouseX < x && mouseY < y && mousePressed) { fill (255,0,0); ellipse(mouseX, mouseY, 20,20); if (mouseX > x && mouseY > y && mousePressed) { fill (0,255,0); ellipse(mouseX, mouseY, 20,20); if (mouseX < x && mouseY > y && mousePressed) { fill (0,0,255); ellipse(mouseX, mouseY, 20,20); if (mouseX > x && mouseY > y && mousePressed) { fill (0); ellipse(mouseX, mouseY, 20,20); } } } } } void mousePressed() { ellipse(mouseX, mouseY, 20,20); }