# Beginners

**URL:** https://discourse.processing.org/c/processing/processing-beginners/14.md?page=29

[Latest](https://discourse.processing.org/latest.md) · [Categories](https://discourse.processing.org/categories.md) · [Tags](https://discourse.processing.org/tags.md)

**Page:** 30

---

## [Need help with this Loop](https://discourse.processing.org/t/need-help-with-this-loop/18256)

<div class="topic-metadata">

**Author:** [@GKBeginner](https://discourse.processing.org/u/GKBeginner)\
**Replies:** 8\
**Last updated:** [March 1, 2020, 2:14am UTC](https://discourse.processing.org/t/need-help-with-this-loop/18256 "2020-03-01T02:14:27Z")

</div>

Can anyone tell me what I am doing wrong? I cannot get this to do more than one row. float randomW; float randomH; float row; float column; void setup(){ size(400,400); background(250,250,0); for(int row = 0; row\<…

---

## [For Statement not working](https://discourse.processing.org/t/for-statement-not-working/18257)

<div class="topic-metadata">

**Author:** [@GKBeginner](https://discourse.processing.org/u/GKBeginner)\
**Replies:** 1\
**Last updated:** [March 1, 2020, 12:36am UTC](https://discourse.processing.org/t/for-statement-not-working/18257 "2020-03-01T00:36:10Z")

</div>

I can’t seem to limit this to 25 ellipses even though I wrote a for statement. float randomX; float randomY; float randomZ; float randomQ; int x; void setup(){ size(400,400); background(250,250,0); } void draw…

---

## [Can someone help me? Nested for-loop](https://discourse.processing.org/t/can-someone-help-me-nested-for-loop/18179)

<div class="topic-metadata">

**Author:** [@seojin051005](https://discourse.processing.org/u/seojin051005)\
**Replies:** 5\
**Last updated:** [February 27, 2020, 10:30pm UTC](https://discourse.processing.org/t/can-someone-help-me-nested-for-loop/18179 "2020-02-27T22:30:44Z")

</div>

I want to combine these two lines but I don’t know how to. for (int x=940; x\<1001; x+=30); for (int y=53; y\<234; y+=30)

---

## [How to check if an int array contains a number](https://discourse.processing.org/t/how-to-check-if-an-int-array-contains-a-number/18068)

<div class="topic-metadata">

**Author:** [@Yannik](https://discourse.processing.org/u/Yannik)\
**Replies:** 3\
**Last updated:** [February 26, 2020, 7:14pm UTC](https://discourse.processing.org/t/how-to-check-if-an-int-array-contains-a-number/18068 "2020-02-26T19:14:21Z")

</div>

How can I check if an array contains a number? Here’s an example: int \[\] array = new int \[200\]; array\[0\] = int(random(0,200)); If(array.contains 20){ println(“20”); }

---

## [Class Extensions possible error](https://discourse.processing.org/t/class-extensions-possible-error/18148)

<div class="topic-metadata">

**Author:** [@paulgoux](https://discourse.processing.org/u/paulgoux)\
**Replies:** 2\
**Last updated:** [February 26, 2020, 7:04pm UTC](https://discourse.processing.org/t/class-extensions-possible-error/18148 "2020-02-26T19:04:57Z")

</div>

Just wandering if this is a bug. I have a constructor called tab. then I have created a horizontal tab constructor which extends tab This class works seemingly fine but when I use the following constructor I am…

---

## [Differences between renderers](https://discourse.processing.org/t/differences-between-renderers/18141)

<div class="topic-metadata">

**Author:** [@paulgoux](https://discourse.processing.org/u/paulgoux)\
**Replies:** 0\
**Last updated:** [February 26, 2020, 2:32pm UTC](https://discourse.processing.org/t/differences-between-renderers/18141 "2020-02-26T14:32:22Z")

</div>

Other than textsize what other differences should be expected from renderers and is there a way to adjust this. void settings(){ //size(W,H,JAVA2D); if(Terrain3d){ size(W,H,P3D); }else{ size(W,H,FX2D); /…

---

## [Why can't i color this bubble?](https://discourse.processing.org/t/why-cant-i-color-this-bubble/17915)

<div class="topic-metadata">

**Author:** [@Rai](https://discourse.processing.org/u/Rai)\
**Replies:** 36\
**Last updated:** [February 24, 2020, 9:13pm UTC](https://discourse.processing.org/t/why-cant-i-color-this-bubble/17915 "2020-02-24T21:13:34Z")

</div>

please help me why can’t i color this bubble ? Bubble b1; Bubble b2; void setup() { size(640, 360); b1 = new Bubble(200, 360, 60, color(255, 100, 0)); b2 = new Bubble(400, 360, 60, color(0, 100, 200)); } void dr…

---

## [How should I modify this for loop to satisfy a condition?](https://discourse.processing.org/t/how-should-i-modify-this-for-loop-to-satisfy-a-condition/17994)

<div class="topic-metadata">

**Author:** [@anon94203042](https://discourse.processing.org/u/anon94203042)\
**Replies:** 1\
**Last updated:** [February 22, 2020, 3:57am UTC](https://discourse.processing.org/t/how-should-i-modify-this-for-loop-to-satisfy-a-condition/17994 "2020-02-22T03:57:36Z")

</div>

So let’s say that we have a for loop: SIZE = 3; // can be changed later on for (int a = 250; a \< SIZE; a += 100) What number should I add/multiply to SIZE so that the loop only runs 3 times? And I can’t set SIZE to a …

---

## [How to loop through objects?](https://discourse.processing.org/t/how-to-loop-through-objects/17990)

<div class="topic-metadata">

**Author:** [@anon94203042](https://discourse.processing.org/u/anon94203042)\
**Replies:** 5\
**Last updated:** [February 22, 2020, 2:50am UTC](https://discourse.processing.org/t/how-to-loop-through-objects/17990 "2020-02-22T02:50:21Z")

</div>

Let’s say that we have a simple class in use here: boolean wheatClicked = false; boolean carrotClicked = false; boolean potatoClicked = false; class Crop { int quantity; Crop(int cropQuantity) { quantity …

---

## [How to reference an object in another function to its class?](https://discourse.processing.org/t/how-to-reference-an-object-in-another-function-to-its-class/17964)

<div class="topic-metadata">

**Author:** [@anon94203042](https://discourse.processing.org/u/anon94203042)\
**Replies:** 3\
**Last updated:** [February 21, 2020, 1:32pm UTC](https://discourse.processing.org/t/how-to-reference-an-object-in-another-function-to-its-class/17964 "2020-02-21T13:32:51Z")

</div>

Let’s say that we have a class and a function (sorry for the peudo-code): class Person { int age; } Person squid; void IncreaseAge(Human object) { } How would I make it so that I could do something like this: v…

---

## ["If doc == null" not is correct](https://discourse.processing.org/t/if-doc-null-not-is-correct/17941)

<div class="topic-metadata">

**Author:** [@NoName](https://discourse.processing.org/u/NoName)\
**Replies:** 9\
**Last updated:** [February 20, 2020, 2:07pm UTC](https://discourse.processing.org/t/if-doc-null-not-is-correct/17941 "2020-02-20T14:07:53Z")

</div>

Guys, I tried to solve this problem myself, but I couldn’t. I have the docMain \[0\] line, which I take from the file on the phone, but even if it is null (checked), then the if check considers it not null anyway . how …

---

## [The count of files in the sketch folder?](https://discourse.processing.org/t/the-count-of-files-in-the-sketch-folder/17931)

<div class="topic-metadata">

**Author:** [@iamjustcurious](https://discourse.processing.org/u/iamjustcurious)\
**Replies:** 4\
**Last updated:** [February 20, 2020, 9:30am UTC](https://discourse.processing.org/t/the-count-of-files-in-the-sketch-folder/17931 "2020-02-20T09:30:58Z")

</div>

How can I get the number of files in the sketch folder? Second Question Is it possible to get the number of files in the desktop? Thanks.

---

## [What are the advantages of using predefined functions over keywords?](https://discourse.processing.org/t/what-are-the-advantages-of-using-predefined-functions-over-keywords/17897)

<div class="topic-metadata">

**Author:** [@anon94203042](https://discourse.processing.org/u/anon94203042)\
**Replies:** 6\
**Last updated:** [February 19, 2020, 10:56pm UTC](https://discourse.processing.org/t/what-are-the-advantages-of-using-predefined-functions-over-keywords/17897 "2020-02-19T22:56:46Z")

</div>

Are there any benefits to using void keyPressed() {} instead of if (keyPressed)? Or void mousePressed() {} instead of if (mousePressed). Or something like that. And in which situations would you use one over the other?

---

## [Class and background image](https://discourse.processing.org/t/class-and-background-image/17846)

<div class="topic-metadata">

**Author:** [@Taby](https://discourse.processing.org/u/Taby)\
**Replies:** 2\
**Last updated:** [February 16, 2020, 11:08am UTC](https://discourse.processing.org/t/class-and-background-image/17846 "2020-02-16T11:08:33Z")

</div>

Hello. I wrote a code using functions and had a background image written like that: PImage bg; Void setup() { size (600,400); bg = loadimage(“floral.jpg”); } Void draw() { background(bg); stroke(0); } How…

---

## [How to name a save?](https://discourse.processing.org/t/how-to-name-a-save/17753)

<div class="topic-metadata">

**Author:** [@MadMarines](https://discourse.processing.org/u/MadMarines)\
**Replies:** 4\
**Last updated:** [February 11, 2020, 10:02pm UTC](https://discourse.processing.org/t/how-to-name-a-save/17753 "2020-02-11T22:02:38Z")

</div>

Hi !, I’m a french student (excuse my english), and I have a problem… :sob: I make a game levels creator and I want to give a name at the save, I know how to save but I don’t know how a can give a name at them. I will …

---

## [How to access the sub-arrays of an Array list?](https://discourse.processing.org/t/how-to-access-the-sub-arrays-of-an-array-list/17695)

<div class="topic-metadata">

**Author:** [@solub](https://discourse.processing.org/u/solub)\
**Replies:** 4\
**Last updated:** [February 10, 2020, 7:16pm UTC](https://discourse.processing.org/t/how-to-access-the-sub-arrays-of-an-array-list/17695 "2020-02-10T19:16:45Z")

</div>

Hi, Can someone kindly explain how to access the sub arrays of an ArrayList in Processing Java ? The example below throws a casting error when I try to get of the sub-arrays at a specific index. cannot convert from O…

---

## [Help with making vector array with specified coordinates](https://discourse.processing.org/t/help-with-making-vector-array-with-specified-coordinates/17671)

<div class="topic-metadata">

**Author:** [@Dangeroustuber](https://discourse.processing.org/u/Dangeroustuber)\
**Replies:** 3\
**Last updated:** [February 10, 2020, 2:31pm UTC](https://discourse.processing.org/t/help-with-making-vector-array-with-specified-coordinates/17671 "2020-02-10T14:31:44Z")

</div>

Hello. I would like help implementing this idea from C# code to processing private Point\[\] grads = new Point\[\] { new Point(0, 1), new Point(1, 1), new Point(1, 0), new Point(1, -1), new Point(0, -1), new Point…

---

## [How to save an image correctly?](https://discourse.processing.org/t/how-to-save-an-image-correctly/17638)

<div class="topic-metadata">

**Author:** [@maxrussell](https://discourse.processing.org/u/maxrussell)\
**Replies:** 4\
**Last updated:** [February 8, 2020, 1:44pm UTC](https://discourse.processing.org/t/how-to-save-an-image-correctly/17638 "2020-02-08T13:44:06Z")

</div>

How do I correctly save my image to a file? void setup() { size(312, 161); //size(624, 712); img1 = loadImage("spaceodyssey.jpg"); img2 = loadImage("spaceodyssey.jpg"); img1.filter(POSTERIZE, 7.5); img1.filt…

---

## [Getting Started With Processing?](https://discourse.processing.org/t/getting-started-with-processing/17556)

<div class="topic-metadata">

**Author:** [@JohnDoe1972](https://discourse.processing.org/u/JohnDoe1972)\
**Replies:** 3\
**Last updated:** [February 4, 2020, 10:14pm UTC](https://discourse.processing.org/t/getting-started-with-processing/17556 "2020-02-04T22:14:37Z")

</div>

Hey Guys, I’ve just started reading through ‘Getting Started with Processing’ and have successfully drawn a circle :slight\_smile: The very next example ‘Example 2-2 Make circles’ however gives an error.‘Cannot find a typ…

---

## [Escaping string path](https://discourse.processing.org/t/escaping-string-path/17549)

<div class="topic-metadata">

**Author:** [@plux](https://discourse.processing.org/u/plux)\
**Replies:** 1\
**Last updated:** [February 4, 2020, 5:50pm UTC](https://discourse.processing.org/t/escaping-string-path/17549 "2020-02-04T17:50:33Z")

</div>

Hello, I have the following string that gives me error (replaced some with “abc” for privacy) String dir = "D:\\OneDrive - Abc abc abc abc \\ABC\\processing-3.0.1\\abc\\CsvPaddingAutomator"; Error: Not expecting symbol 'O…

---

## [Using selectOutput](https://discourse.processing.org/t/using-selectoutput/17534)

<div class="topic-metadata">

**Author:** [@spflanze](https://discourse.processing.org/u/spflanze)\
**Replies:** 1\
**Last updated:** [February 4, 2020, 1:50am UTC](https://discourse.processing.org/t/using-selectoutput/17534 "2020-02-04T01:50:51Z")

</div>

I seek to add a file browser to my application. I see that the selectOutput, and selectInput, classes were made for it. In this document for selectOutput: https://processing.org/reference/selectOutput\_.html I see const…

---

## [Found some problem with color](https://discourse.processing.org/t/found-some-problem-with-color/17521)

<div class="topic-metadata">

**Author:** [@Daniele92](https://discourse.processing.org/u/Daniele92)\
**Replies:** 5\
**Last updated:** [February 3, 2020, 6:36pm UTC](https://discourse.processing.org/t/found-some-problem-with-color/17521 "2020-02-03T18:36:11Z")

</div>

color c= color(#2f4f4f); color b= color(115,10,100); color a= color(0,100,255); void setup() { size(500,500); background(255); for(int i = 0; i\<100; i++) { rett(int(random(width)), int(random(height)), …

---

## [Easier way to write if else statement](https://discourse.processing.org/t/easier-way-to-write-if-else-statement/17250)

<div class="topic-metadata">

**Author:** [@MikkelS](https://discourse.processing.org/u/MikkelS)\
**Replies:** 6\
**Last updated:** [February 2, 2020, 9:44pm UTC](https://discourse.processing.org/t/easier-way-to-write-if-else-statement/17250 "2020-02-02T21:44:09Z")

</div>

Hey, I was just wondering if there exists an easier way to write the following code? if (lives == 3) { // image(heart, heartX1, heartY, heartWH, heartWH); image(heart, heartX2, heartY, heartWH, heartWH);…

---

## [Expecting EOF, found if. idk how to fix it](https://discourse.processing.org/t/expecting-eof-found-if-idk-how-to-fix-it/17468)

<div class="topic-metadata">

**Author:** [@prototype\_31](https://discourse.processing.org/u/prototype_31)\
**Replies:** 1\
**Last updated:** [January 30, 2020, 9:34pm UTC](https://discourse.processing.org/t/expecting-eof-found-if-idk-how-to-fix-it/17468 "2020-01-30T21:34:33Z")

</div>

void setup(){ size(2000,2000); background(0); } void keyPressed() { //1st planet if (key == 'b' || key == 'B') { if (keyPressed) stroke(0); fill(0); } else { stroke(#18B733); fill(#18B…

---

## [Problem of display in a " for" loop](https://discourse.processing.org/t/problem-of-display-in-a-for-loop/17422)

<div class="topic-metadata">

**Author:** [@cypseb](https://discourse.processing.org/u/cypseb)\
**Replies:** 6\
**Last updated:** [January 29, 2020, 8:15pm UTC](https://discourse.processing.org/t/problem-of-display-in-a-for-loop/17422 "2020-01-29T20:15:12Z")

</div>

Hello everybody i am not a beguiner in programing, but i am a beguinner in processing I try to move a text in a FOR loop but the drawing is not refresh, only at the end of the loop i try to add redraw() in my loop bu…

---

## [Storing Point in a variable](https://discourse.processing.org/t/storing-point-in-a-variable/17381)

<div class="topic-metadata">

**Author:** [@prathmesh](https://discourse.processing.org/u/prathmesh)\
**Replies:** 2\
**Last updated:** [January 27, 2020, 9:26pm UTC](https://discourse.processing.org/t/storing-point-in-a-variable/17381 "2020-01-27T21:26:13Z")

</div>

Hello All, Why is the statement below invalid: float x = point(a,b); it gives me the error : void cannot be matched with int.(interesting!!) Is it not possible to store a point in a variable? I came across this while …

---

## [Accessing variables in an array of different objects](https://discourse.processing.org/t/accessing-variables-in-an-array-of-different-objects/17324)

<div class="topic-metadata">

**Author:** [@J0R1AN](https://discourse.processing.org/u/J0R1AN)\
**Replies:** 4\
**Last updated:** [January 25, 2020, 11:09pm UTC](https://discourse.processing.org/t/accessing-variables-in-an-array-of-different-objects/17324 "2020-01-25T23:09:21Z")

</div>

I am working on a bigger project with a game that has an AI and Human player. I want to expand it so I have an array of players that I can set to whatever I want. The AI and Human classes are different in logic but have …

---

## [Sketch 84552 don't work, error](https://discourse.processing.org/t/sketch-84552-dont-work-error/17114)

<div class="topic-metadata">

**Author:** [@motorimicro](https://discourse.processing.org/u/motorimicro)\
**Replies:** 7\
**Last updated:** [January 25, 2020, 7:10pm UTC](https://discourse.processing.org/t/sketch-84552-dont-work-error/17114 "2020-01-25T19:10:12Z")

</div>

here where download the sketch: Hi, I have just entered the world of processing and I am really a beginner, I have only a little understood how to use processing sketches by trial and error. I’m trying to run the …

---

## [Creating an object from a class](https://discourse.processing.org/t/creating-an-object-from-a-class/17296)

<div class="topic-metadata">

**Author:** [@floflopm](https://discourse.processing.org/u/floflopm)\
**Replies:** 2\
**Last updated:** [January 23, 2020, 11:27pm UTC](https://discourse.processing.org/t/creating-an-object-from-a-class/17296 "2020-01-23T23:27:30Z")

</div>

hi, I would like to use the mousePressed function to create new objects from a class at the location of the mouse. But the class itself seems complicated (I’m working on an example I found). When I type: void mousePres…

---

## [Objects and class objects cannot be converted?](https://discourse.processing.org/t/objects-and-class-objects-cannot-be-converted/17276)

<div class="topic-metadata">

**Author:** [@Edudmas](https://discourse.processing.org/u/Edudmas)\
**Replies:** 3\
**Last updated:** [January 23, 2020, 10:55pm UTC](https://discourse.processing.org/t/objects-and-class-objects-cannot-be-converted/17276 "2020-01-23T22:55:21Z")

</div>

I don’t want to muck up the page, so there will be a pastebin at the bottom with my code on it. I am trying to create a HashMap and create multiple objects of a ‘Car’ class depending on the variable entered into my ‘Tra…

[Previous page](https://discourse.processing.org/c/processing/processing-beginners/14.md?page=28)

[Next page](https://discourse.processing.org/c/processing/processing-beginners/14.md?page=30)
