# Beginners

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

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

**Page:** 9

---

## [Coding Train Tutorial 6.2 while loop question](https://discourse.processing.org/t/coding-train-tutorial-6-2-while-loop-question/40020)

<div class="topic-metadata">

**Author:** [@Siyue](https://discourse.processing.org/u/Siyue)\
**Replies:** 3\
**Last updated:** [December 4, 2022, 6:01pm UTC](https://discourse.processing.org/t/coding-train-tutorial-6-2-while-loop-question/40020 "2022-12-04T18:01:28Z")

</div>

float y=0; float x=0; void setup() { size(800, 800); } void draw() { background(200, 20, 90); y=0; while (y\<height) { if (mouseY\<1) { y=y+1; } else { y=mouseY+y; } } …

---

## [Using Sublime text.. Processing-Java error in Processing](https://discourse.processing.org/t/using-sublime-text-processing-java-error-in-processing/39998)

<div class="topic-metadata">

**Author:** [@bardo](https://discourse.processing.org/u/bardo)\
**Replies:** 6\
**Last updated:** [December 3, 2022, 5:04pm UTC](https://discourse.processing.org/t/using-sublime-text-processing-java-error-in-processing/39998 "2022-12-03T17:04:05Z")

</div>

hi there, i am tryng to use processing with Sublime. I have been following the tutorials on how to set everything. The only issue im having is that when I click build in Sublime, it gies me an error about Processign-ja…

---

## [First project - moving a transparent circle over a semi opaque background with an image behind](https://discourse.processing.org/t/first-project-moving-a-transparent-circle-over-a-semi-opaque-background-with-an-image-behind/1078)

<div class="topic-metadata">

**Author:** [@redstevo](https://discourse.processing.org/u/redstevo)\
**Replies:** 7\
**Last updated:** [December 1, 2022, 4:09pm UTC](https://discourse.processing.org/t/first-project-moving-a-transparent-circle-over-a-semi-opaque-background-with-an-image-behind/1078 "2022-12-01T16:09:21Z")

</div>

Hi all, First post - I’ve been tasked with making a model to recreate a tunnel vision experience for someone - the model I’ve been given is using an old eye test list of letters and mimicking the inability to scan the li…

---

## [Background color not changing](https://discourse.processing.org/t/background-color-not-changing/39953)

<div class="topic-metadata">

**Author:** [@appas](https://discourse.processing.org/u/appas)\
**Replies:** 3\
**Last updated:** [December 1, 2022, 11:33am UTC](https://discourse.processing.org/t/background-color-not-changing/39953 "2022-12-01T11:33:48Z")

</div>

Hello, I am having the problem that calls to background do nothing. Eg. this minimal code: void setup() { background(51); } void draw() { clear(); } Is, according to the reference, supposed to produce this: …

---

## [NullPointerException by creating an object](https://discourse.processing.org/t/nullpointerexception-by-creating-an-object/39876)

<div class="topic-metadata">

**Author:** [@Exartyss](https://discourse.processing.org/u/Exartyss)\
**Replies:** 4\
**Last updated:** [November 26, 2022, 7:35am UTC](https://discourse.processing.org/t/nullpointerexception-by-creating-an-object/39876 "2022-11-26T07:35:24Z")

</div>

Hello ! I wrote a program in which I created a class called Ro with objects : circles who goes on a random X position But by running the program it craches. It writes " NullPointerException" and “c\[i++\] = new Ro(width1…

---

## [Beginner Needs help with Generative art](https://discourse.processing.org/t/beginner-needs-help-with-generative-art/39858)

<div class="topic-metadata">

**Author:** [@WingedOS](https://discourse.processing.org/u/WingedOS)\
**Replies:** 6\
**Last updated:** [November 26, 2022, 7:22am UTC](https://discourse.processing.org/t/beginner-needs-help-with-generative-art/39858 "2022-11-26T07:22:49Z")

</div>

Hello! I’m a beginner at coding and making art through technology. I watch the coding train to learn but I also like to experiment with existing code made by the community. Here, I wanted to make art, and Generate\_me …

---

## [Processing3 problems with using a variable in draw and thread](https://discourse.processing.org/t/processing3-problems-with-using-a-variable-in-draw-and-thread/39856)

<div class="topic-metadata">

**Author:** [@t00cg](https://discourse.processing.org/u/t00cg)\
**Replies:** 4\
**Last updated:** [November 24, 2022, 6:19pm UTC](https://discourse.processing.org/t/processing3-problems-with-using-a-variable-in-draw-and-thread/39856 "2022-11-24T18:19:09Z")

</div>

hi there in my opinion, x should be counted till 20 and then reseted in the thread. but it is not happening. can someone help me? thanks for any help t00cg public int x = 0; void setup() { thread("threadcode");…

---

## [Error — Missing operator, semicolon, or ‘}’ near ‘setup’?](https://discourse.processing.org/t/error-missing-operator-semicolon-or-near-setup/39845)

<div class="topic-metadata">

**Author:** [@vrtx](https://discourse.processing.org/u/vrtx)\
**Replies:** 7\
**Last updated:** [November 24, 2022, 5:30pm UTC](https://discourse.processing.org/t/error-missing-operator-semicolon-or-near-setup/39845 "2022-11-24T17:30:58Z")

</div>

i’ve being days trying to solve this error… Erro - Missing operator, semicolon, or ‘}’ near ‘setup’? .Any help, please?! import ddf.minim.\*; import ddf.minim.analysis.\*; import ddf.minim.effects.\*; import ddf.minim.si…

---

## [Dividing two numbers results in int, even though it should be a float](https://discourse.processing.org/t/dividing-two-numbers-results-in-int-even-though-it-should-be-a-float/39794)

<div class="topic-metadata">

**Author:** [@Kalarila](https://discourse.processing.org/u/Kalarila)\
**Replies:** 3\
**Last updated:** [November 19, 2022, 9:23pm UTC](https://discourse.processing.org/t/dividing-two-numbers-results-in-int-even-though-it-should-be-a-float/39794 "2022-11-19T21:23:28Z")

</div>

please format code with \</\> button \* homework policy \* asking questions Ok, so I’m writing an image editing program and would like to get the aspect ratio of the image. So I declared a float variable called “aspectRa…

---

## [How to solve error: "Error in void"?](https://discourse.processing.org/t/how-to-solve-error-error-in-void/39790)

<div class="topic-metadata">

**Author:** [@nicoos](https://discourse.processing.org/u/nicoos)\
**Replies:** 2\
**Last updated:** [November 19, 2022, 5:37pm UTC](https://discourse.processing.org/t/how-to-solve-error-error-in-void/39790 "2022-11-19T17:37:03Z")

</div>

//Google chrome dinosaurio Dinosaurio d1 = new Dinosaurio void setup(){ //void setup its an error says. size(1080, 720); } void draw() { background(255); d1.display(); }

---

## [I have some simple questions](https://discourse.processing.org/t/i-have-some-simple-questions/39756)

<div class="topic-metadata">

**Author:** [@OhiosStrongest](https://discourse.processing.org/u/OhiosStrongest)\
**Replies:** 5\
**Last updated:** [November 17, 2022, 5:11pm UTC](https://discourse.processing.org/t/i-have-some-simple-questions/39756 "2022-11-17T17:11:14Z")

</div>

How do I make it so that only one part of a program executes once? I have an animation that when the mouse is pressed the background is changed. However, I only want this to happen once. How do I make it so that only …

---

## [Does anyonw know how to create Bouncy Bubbles with multiple colors?](https://discourse.processing.org/t/does-anyonw-know-how-to-create-bouncy-bubbles-with-multiple-colors/39686)

<div class="topic-metadata">

**Author:** [@learningprocessing23](https://discourse.processing.org/u/learningprocessing23)\
**Replies:** 3\
**Last updated:** [November 13, 2022, 8:07am UTC](https://discourse.processing.org/t/does-anyonw-know-how-to-create-bouncy-bubbles-with-multiple-colors/39686 "2022-11-13T08:07:34Z")

</div>

please format code with \</\> button \* homework policy \* asking questions Hello! I saw the Bouncy Balls from Processing Org Example, and I want to create multiple colors of bubbles. However, when I tried to use random(…

---

## [I need a shortcut for stopping sketch in Processing](https://discourse.processing.org/t/i-need-a-shortcut-for-stopping-sketch-in-processing/39642)

<div class="topic-metadata">

**Author:** [@abdu](https://discourse.processing.org/u/abdu)\
**Replies:** 3\
**Last updated:** [November 11, 2022, 12:50am UTC](https://discourse.processing.org/t/i-need-a-shortcut-for-stopping-sketch-in-processing/39642 "2022-11-11T00:50:58Z")

</div>

please format code with \</\> button \* homework policy \* asking questions I want to create a custom shortcut for stopping the sketch because there is no shortcut for that is there any code I can use in the program f…

---

## [Way to scale canvas to fit on monitor?](https://discourse.processing.org/t/way-to-scale-canvas-to-fit-on-monitor/39656)

<div class="topic-metadata">

**Author:** [@i-draw-monkeys](https://discourse.processing.org/u/i-draw-monkeys)\
**Replies:** 1\
**Last updated:** [November 10, 2022, 12:58pm UTC](https://discourse.processing.org/t/way-to-scale-canvas-to-fit-on-monitor/39656 "2022-11-10T12:58:08Z")

</div>

I am making very large sketches at the moment. The current one is 1900 x 2800. Despite my large monitor, the canvas doesn’t fit. I don’t see the entire image until after I have saved it as an SVG and throw it into Inksc…

---

## [How can i empty an array](https://discourse.processing.org/t/how-can-i-empty-an-array/39630)

<div class="topic-metadata">

**Author:** [@REK166](https://discourse.processing.org/u/REK166)\
**Replies:** 1\
**Last updated:** [November 8, 2022, 5:15pm UTC](https://discourse.processing.org/t/how-can-i-empty-an-array/39630 "2022-11-08T17:15:10Z")

</div>

how can i remove all elements of an array?

---

## [In Java, can an interface extend several interfaces?](https://discourse.processing.org/t/in-java-can-an-interface-extend-several-interfaces/39612)

<div class="topic-metadata">

**Author:** [@neon124](https://discourse.processing.org/u/neon124)\
**Replies:** 1\
**Last updated:** [November 7, 2022, 12:34pm UTC](https://discourse.processing.org/t/in-java-can-an-interface-extend-several-interfaces/39612 "2022-11-07T12:34:04Z")

</div>

In Java, can an interface extend several interfaces? This code looks to be valid in my IDE and compiles: interface Foo extends Runnable, Set, Comparator\<String\> { } However, I looked up on the internet from various sou…

---

## [Does anyone know how to fix the background color?](https://discourse.processing.org/t/does-anyone-know-how-to-fix-the-background-color/39553)

<div class="topic-metadata">

**Author:** [@learningprocessing23](https://discourse.processing.org/u/learningprocessing23)\
**Replies:** 11\
**Last updated:** [November 4, 2022, 2:30am UTC](https://discourse.processing.org/t/does-anyone-know-how-to-fix-the-background-color/39553 "2022-11-04T02:30:02Z")

</div>

Hello! I setup the color could be changed from 2 pink colors. I hope after dragging to a color that I like (between color A and color B), I can decide and make the color as background color (maybe by mousePressed()) And …

---

## [Cannot invoke red() on the primitive type int](https://discourse.processing.org/t/cannot-invoke-red-on-the-primitive-type-int/39575)

<div class="topic-metadata">

**Author:** [@nanto2016](https://discourse.processing.org/u/nanto2016)\
**Replies:** 3\
**Last updated:** [November 3, 2022, 7:47pm UTC](https://discourse.processing.org/t/cannot-invoke-red-on-the-primitive-type-int/39575 "2022-11-03T19:47:47Z")

</div>

Hello, I here have a problem I do not understand: the code below prints to the console : Cannot invoke red() on the primitive type int void mousePressed() { color m = get(mouseX, mouseY); if(m.red() == 255 && m.gree…

---

## [Collision Resolution in 3D](https://discourse.processing.org/t/collision-resolution-in-3d/39493)

<div class="topic-metadata">

**Author:** [@Divitiacus](https://discourse.processing.org/u/Divitiacus)\
**Replies:** 10\
**Last updated:** [November 2, 2022, 2:17am UTC](https://discourse.processing.org/t/collision-resolution-in-3d/39493 "2022-11-02T02:17:42Z")

</div>

I try to get elastic collision of two particles calculated, that means the velocity of both particles after collision. It is based on this: The issue is, that the results are not correct. In an elastic collision, when …

---

## [Text() of matches being overwritten while searching through an array](https://discourse.processing.org/t/text-of-matches-being-overwritten-while-searching-through-an-array/39527)

<div class="topic-metadata">

**Author:** [@Asclepiadae](https://discourse.processing.org/u/Asclepiadae)\
**Replies:** 0\
**Last updated:** [October 31, 2022, 6:57pm UTC](https://discourse.processing.org/t/text-of-matches-being-overwritten-while-searching-through-an-array/39527 "2022-10-31T18:57:36Z")

</div>

Hey everyone, New to Processing (and non-web programming) and having a slight issue with displaying matching values with text() on the screen as I search through an array. The search works correctly, and println(); cor…

---

## [How to make a game over statement after object is being collided to a player](https://discourse.processing.org/t/how-to-make-a-game-over-statement-after-object-is-being-collided-to-a-player/39499)

<div class="topic-metadata">

**Author:** [@Lyca](https://discourse.processing.org/u/Lyca)\
**Replies:** 5\
**Last updated:** [October 30, 2022, 5:39pm UTC](https://discourse.processing.org/t/how-to-make-a-game-over-statement-after-object-is-being-collided-to-a-player/39499 "2022-10-30T17:39:32Z")

</div>

Hi badly need your help. Im just a beginner and I coundn’t run my application as Im doing a game. where in if falling object from above hits the player game will end with a message “game over”

---

## [Ellipse and trail](https://discourse.processing.org/t/ellipse-and-trail/39508)

<div class="topic-metadata">

**Author:** [@Ero](https://discourse.processing.org/u/Ero)\
**Replies:** 4\
**Last updated:** [October 30, 2022, 3:00pm UTC](https://discourse.processing.org/t/ellipse-and-trail/39508 "2022-10-30T15:00:24Z")

</div>

How can I make an ellipse that leaves behind a “trail”?

---

## [Number guessing game](https://discourse.processing.org/t/number-guessing-game/39364)

<div class="topic-metadata">

**Author:** [@OutLite](https://discourse.processing.org/u/OutLite)\
**Replies:** 3\
**Last updated:** [October 21, 2022, 10:34am UTC](https://discourse.processing.org/t/number-guessing-game/39364 "2022-10-21T10:34:54Z")

</div>

I’m new to processing and have an homework assignment to make a number guessing game. I have no idea where to start and i cant find anything online. Can anyone help me?

---

## [Break and for-loops](https://discourse.processing.org/t/break-and-for-loops/39374)

<div class="topic-metadata">

**Author:** [@jensemand](https://discourse.processing.org/u/jensemand)\
**Replies:** 4\
**Last updated:** [October 20, 2022, 6:03pm UTC](https://discourse.processing.org/t/break-and-for-loops/39374 "2022-10-20T18:03:56Z")

</div>

Just a quick question. I am new to using “break” and I am making a program that checks an integer grid if the number 1 is in an entry. Obviously I don’t want to check the rest of the grid if I have found an entry that is…

---

## [How to read a csv file that is constantly updated](https://discourse.processing.org/t/how-to-read-a-csv-file-that-is-constantly-updated/39372)

<div class="topic-metadata">

**Author:** [@ALCOHOLICBRY](https://discourse.processing.org/u/ALCOHOLICBRY)\
**Replies:** 1\
**Last updated:** [October 20, 2022, 4:32pm UTC](https://discourse.processing.org/t/how-to-read-a-csv-file-that-is-constantly-updated/39372 "2022-10-20T16:32:35Z")

</div>

This is the goal I want to achieve: As soon as I write the text in a csv file and save it, processing will display it instantly. But now, if I save the csv file while running the code, Error will show up. Here is the…

---

## [Using the try{} catch() {}](https://discourse.processing.org/t/using-the-try-catch/26108)

<div class="topic-metadata">

**Author:** [@CodeMasterX](https://discourse.processing.org/u/CodeMasterX)\
**Replies:** 10\
**Last updated:** [December 16, 2020, 10:24am UTC](https://discourse.processing.org/t/using-the-try-catch/26108 "2020-12-16T10:24:56Z")

</div>

Hi! I recently saw a function try{ } catch() { } I am curently working on a “game of life” project. I use the int\[\]\[\] grid = new int\[w\]\[h\]. It is annoying if I have to use if(i \> 0) { grid\[i-1\]\[j\] } everytime I …

---

## [Can I fill an array by using a for loop?](https://discourse.processing.org/t/can-i-fill-an-array-by-using-a-for-loop/39330)

<div class="topic-metadata">

**Author:** [@ExplodingWhale](https://discourse.processing.org/u/ExplodingWhale)\
**Replies:** 3\
**Last updated:** [October 18, 2022, 12:47am UTC](https://discourse.processing.org/t/can-i-fill-an-array-by-using-a-for-loop/39330 "2022-10-18T00:47:03Z")

</div>

If i want to store values of integers from 0 to 1000 with increments of 20, what would be the easiest way to put those values into the array? And what about a 2D-array? there has to be an easier way than this, right?: …

---

## [What happened to the primitive "short"?](https://discourse.processing.org/t/what-happened-to-the-primitive-short/39332)

<div class="topic-metadata">

**Author:** [@echamp](https://discourse.processing.org/u/echamp)\
**Replies:** 1\
**Last updated:** [October 18, 2022, 12:39am UTC](https://discourse.processing.org/t/what-happened-to-the-primitive-short/39332 "2022-10-18T00:39:31Z")

</div>

Just curious why the primitive “short” isn’t being shown in any of the references, but does work in the Processing editor? Noticed it is documented in the Learning Processing book. Thank in advance!

---

## [The Nature Of Code Chapter 1 Solutions](https://discourse.processing.org/t/the-nature-of-code-chapter-1-solutions/39288)

<div class="topic-metadata">

**Author:** [@felicia](https://discourse.processing.org/u/felicia)\
**Replies:** 3\
**Last updated:** [October 16, 2022, 2:00am UTC](https://discourse.processing.org/t/the-nature-of-code-chapter-1-solutions/39288 "2022-10-16T02:00:30Z")

</div>

Hi there, Does anyone know if the solutions for the examples in the book/site ‘The Nature of Code’ are available somewhere online? It seems like not everything is on Github … ? http://natureofcode.com https://github.c…

---

## [Read all files in a directory](https://discourse.processing.org/t/read-all-files-in-a-directory/39285)

<div class="topic-metadata">

**Author:** [@5x9x7x2x7x9](https://discourse.processing.org/u/5x9x7x2x7x9)\
**Replies:** 2\
**Last updated:** [October 15, 2022, 7:42pm UTC](https://discourse.processing.org/t/read-all-files-in-a-directory/39285 "2022-10-15T19:42:28Z")

</div>

How would I read all files in a directory? For example, I would have a bunch of images in a folder and would want to load them in. Or would have a bunch of levels as .txt files and would load them?

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

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