# Beginners

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

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

**Page:** 25

---

## [Difference between loadPixels and get()](https://discourse.processing.org/t/difference-between-loadpixels-and-get/24491)

<div class="topic-metadata">

**Author:** [@paulgoux](https://discourse.processing.org/u/paulgoux)\
**Replies:** 1\
**Last updated:** [October 10, 2020, 4:52am UTC](https://discourse.processing.org/t/difference-between-loadpixels-and-get/24491 "2020-10-10T04:52:57Z")

</div>

As the title implies just after a bit of info. Looking through some examples I came across the histogram image sketch which makes use of get to retrieve pixel values. for (int i = 0; i \< img.width; i++) { for (int j …

---

## [pv.random3D(target, parent);](https://discourse.processing.org/t/pv-random3d-target-parent/24442)

<div class="topic-metadata">

**Author:** [@J\_Silva](https://discourse.processing.org/u/J_Silva)\
**Replies:** 10\
**Last updated:** [October 9, 2020, 4:04am UTC](https://discourse.processing.org/t/pv-random3d-target-parent/24442 "2020-10-09T04:04:09Z")

</div>

Hi. Could someone explain when pv.random3D(target, parent); is used? like PVector pv = PVector.random3D(this); What are target and parent referring to?

---

## [How to check for similar number in array and bring out a error sign](https://discourse.processing.org/t/how-to-check-for-similar-number-in-array-and-bring-out-a-error-sign/24454)

<div class="topic-metadata">

**Author:** [@newtothis](https://discourse.processing.org/u/newtothis)\
**Replies:** 6\
**Last updated:** [October 8, 2020, 10:59pm UTC](https://discourse.processing.org/t/how-to-check-for-similar-number-in-array-and-bring-out-a-error-sign/24454 "2020-10-08T22:59:10Z")

</div>

please format code with \</\> button \* homework policy \* asking questions for(int iIndex=0;iIndex\<6; iIndex++) { fill(67, 214, 250); text(iArray\[iIn…

---

## [Indexing for (datatype element : array) loops](https://discourse.processing.org/t/indexing-for-datatype-element-array-loops/24406)

<div class="topic-metadata">

**Author:** [@RFullum](https://discourse.processing.org/u/RFullum)\
**Replies:** 5\
**Last updated:** [October 8, 2020, 2:34pm UTC](https://discourse.processing.org/t/indexing-for-datatype-element-array-loops/24406 "2020-10-08T14:34:43Z")

</div>

I’ve been trying to figure out if there’s a simple way to extract the index of the iteration through a for-loop when using the for(elements in an array) style iteration. It’s simple enough using the for(init; test; upda…

---

## [Random class from book of nature of code](https://discourse.processing.org/t/random-class-from-book-of-nature-of-code/24354)

<div class="topic-metadata">

**Author:** [@sangshen](https://discourse.processing.org/u/sangshen)\
**Replies:** 2\
**Last updated:** [October 5, 2020, 12:41pm UTC](https://discourse.processing.org/t/random-class-from-book-of-nature-of-code/24354 "2020-10-05T12:41:17Z")

</div>

please format code with \</\> button \* homework policy \* asking questions there is a Random class showed on the book , but when I wrote code like this , the console showed me it cannot find a class named Random .

---

## [Side Scrolling Action Game](https://discourse.processing.org/t/side-scrolling-action-game/24323)

<div class="topic-metadata">

**Author:** [@Bob\_With\_A\_X](https://discourse.processing.org/u/Bob_With_A_X)\
**Replies:** 3\
**Last updated:** [October 4, 2020, 10:15am UTC](https://discourse.processing.org/t/side-scrolling-action-game/24323 "2020-10-04T10:15:57Z")

</div>

Hello, I am trying to make a 2D side scrolling action game similar to “Dan The Man”. However, I am stuck as to how to manage the level physics. Initially I though to create the ground terrain as an image for each level…

---

## [Keyboard shortcuts](https://discourse.processing.org/t/keyboard-shortcuts/24291)

<div class="topic-metadata">

**Author:** [@moms\_spaghetti](https://discourse.processing.org/u/moms_spaghetti)\
**Replies:** 2\
**Last updated:** [October 3, 2020, 12:10pm UTC](https://discourse.processing.org/t/keyboard-shortcuts/24291 "2020-10-03T12:10:16Z")

</div>

Hello Can somebody give me a list or say where I can find them , of all or at least the most important keyboard shortcuts as this would be very helpfull ? Thanks in advance

---

## [Idk why but I get this error message: Expected an assignment or function call and instead saw an expression](https://discourse.processing.org/t/idk-why-but-i-get-this-error-message-expected-an-assignment-or-function-call-and-instead-saw-an-expression/24311)

<div class="topic-metadata">

**Author:** [@olaf000olaf](https://discourse.processing.org/u/olaf000olaf)\
**Replies:** 2\
**Last updated:** [October 3, 2020, 5:01pm UTC](https://discourse.processing.org/t/idk-why-but-i-get-this-error-message-expected-an-assignment-or-function-call-and-instead-saw-an-expression/24311 "2020-10-03T17:01:51Z")

</div>

if (timer = 98){ xd1 == xd1 \* -1; yd1 == yd1 \* -1; }

---

## [Why directionallight cannot show anything](https://discourse.processing.org/t/why-directionallight-cannot-show-anything/24305)

<div class="topic-metadata">

**Author:** [@yyf](https://discourse.processing.org/u/yyf)\
**Replies:** 5\
**Last updated:** [October 3, 2020, 2:33pm UTC](https://discourse.processing.org/t/why-directionallight-cannot-show-anything/24305 "2020-10-03T14:33:15Z")

</div>

void draw() { background(0,0,0); translate(400,400,-mouseY); fill(0,255,0); directionalLight(255,0,0,10,0,0); noStroke(); sphere(100.0); }

---

## [Constrain() function / mouse click on button](https://discourse.processing.org/t/constrain-function-mouse-click-on-button/24299)

<div class="topic-metadata">

**Author:** [@bigjoebob](https://discourse.processing.org/u/bigjoebob)\
**Replies:** 2\
**Last updated:** [October 2, 2020, 11:32pm UTC](https://discourse.processing.org/t/constrain-function-mouse-click-on-button/24299 "2020-10-02T23:32:12Z")

</div>

please format code with \</\> button \* homework policy \* asking questions Hi!! I need help in understanding how to use the constrain() function. I want to be able to click on a rectangle and have it change colors, howe…

---

## [Why Can't Processing Do Basic Math lol](https://discourse.processing.org/t/why-cant-processing-do-basic-math-lol/24277)

<div class="topic-metadata">

**Author:** [@wyattsworlddd](https://discourse.processing.org/u/wyattsworlddd)\
**Replies:** 8\
**Last updated:** [October 2, 2020, 4:32pm UTC](https://discourse.processing.org/t/why-cant-processing-do-basic-math-lol/24277 "2020-10-02T16:32:36Z")

</div>

Hey yall! I’m building a model that can simulate the trading that occurs across a liquidity pool and to experiment with how I can use a balancer contract account to tend the pool and keep a stable currency ratio. The iss…

---

## [Why? My class exists!](https://discourse.processing.org/t/why-my-class-exists/24269)

<div class="topic-metadata">

**Author:** [@HumanoidX](https://discourse.processing.org/u/HumanoidX)\
**Replies:** 9\
**Last updated:** [October 1, 2020, 1:55pm UTC](https://discourse.processing.org/t/why-my-class-exists/24269 "2020-10-01T13:55:00Z")

</div>

The compiler says… the class “Circle” does not exist …but it does. Code: Circle circle = new Circle(10,color(0),color(255,0,0),0,new PVector(400,400),new PVector(0,0),new PVector(0,0)); class Circle{ float diamete…

---

## [Using noLoop() function with nested for loops](https://discourse.processing.org/t/using-noloop-function-with-nested-for-loops/24208)

<div class="topic-metadata">

**Author:** [@thughes](https://discourse.processing.org/u/thughes)\
**Replies:** 1\
**Last updated:** [September 28, 2020, 11:35pm UTC](https://discourse.processing.org/t/using-noloop-function-with-nested-for-loops/24208 "2020-09-28T23:35:55Z")

</div>

Can you use noLoop with nested for loops? I have an assignment that states to create a grid shown in my lesson and observe what it does. Then it says to add the noLoop() function and observe what it does. I have done …

---

## [Question for "try()"](https://discourse.processing.org/t/question-for-try/24151)

<div class="topic-metadata">

**Author:** [@JoLi](https://discourse.processing.org/u/JoLi)\
**Replies:** 4\
**Last updated:** [September 28, 2020, 11:10am UTC](https://discourse.processing.org/t/question-for-try/24151 "2020-09-28T11:10:59Z")

</div>

Any Ideas, why this is not working? Processing 3.5.4, Windows 10

---

## [It looks like you're mixing "active" and "static" modes](https://discourse.processing.org/t/it-looks-like-youre-mixing-active-and-static-modes/24159)

<div class="topic-metadata">

**Author:** [@COZ](https://discourse.processing.org/u/COZ)\
**Replies:** 3\
**Last updated:** [September 28, 2020, 2:00am UTC](https://discourse.processing.org/t/it-looks-like-youre-mixing-active-and-static-modes/24159 "2020-09-28T02:00:55Z")

</div>

Hello, complete begginer here. Just making my way through some tutorials and i’ve been hit with the error (the subject title). I know it’s defining static and active states, which can’t be both at the same time. But i c…

---

## [Trying to create a font, getting error: IllegalArgumentException: loadFont() is for .vlw files, try createFont()](https://discourse.processing.org/t/trying-to-create-a-font-getting-error-illegalargumentexception-loadfont-is-for-vlw-files-try-createfont/24174)

<div class="topic-metadata">

**Author:** [@adl](https://discourse.processing.org/u/adl)\
**Replies:** 2\
**Last updated:** [September 27, 2020, 10:23pm UTC](https://discourse.processing.org/t/trying-to-create-a-font-getting-error-illegalargumentexception-loadfont-is-for-vlw-files-try-createfont/24174 "2020-09-27T22:23:21Z")

</div>

I used tools, create fonts option from menu to create font , the system created data folder with the font file name. the code is below. What am I missing? / PFont font1; void setup(){ size(500,500); font1=loadFon…

---

## [Adding objects to the canvas fom within the mousePressed() method](https://discourse.processing.org/t/adding-objects-to-the-canvas-fom-within-the-mousepressed-method/24121)

<div class="topic-metadata">

**Author:** [@nestor0920](https://discourse.processing.org/u/nestor0920)\
**Replies:** 8\
**Last updated:** [September 26, 2020, 6:33pm UTC](https://discourse.processing.org/t/adding-objects-to-the-canvas-fom-within-the-mousepressed-method/24121 "2020-09-26T18:33:16Z")

</div>

I’m trying to create a sketch where after setup the canvas is only changed when the user adds some geometrical objects by pressing the mouse. So it seems inappropriate to me to even implement the draw() method. To my un…

---

## [Class get set question](https://discourse.processing.org/t/class-get-set-question/24087)

<div class="topic-metadata">

**Author:** [@pandl](https://discourse.processing.org/u/pandl)\
**Replies:** 2\
**Last updated:** [September 24, 2020, 1:48am UTC](https://discourse.processing.org/t/class-get-set-question/24087 "2020-09-24T01:48:00Z")

</div>

I’ve created an LED class that has worked well for me upto this point. Now, I have an array of leds and I need to know the state (weather it’s on or off) of a particular led. To do that I’ve added getState() to the class…

---

## [How to get a difference of one int list/array to another](https://discourse.processing.org/t/how-to-get-a-difference-of-one-int-list-array-to-another/24010)

<div class="topic-metadata">

**Author:** [@AlexAlex](https://discourse.processing.org/u/AlexAlex)\
**Replies:** 3\
**Last updated:** [September 23, 2020, 12:55am UTC](https://discourse.processing.org/t/how-to-get-a-difference-of-one-int-list-array-to-another/24010 "2020-09-23T00:55:57Z")

</div>

Hello everyone, I have two lists/arrays of variable size A, B and I would like to get everything extra a list B might have, that list A does not. public int a = {2,2,3,2,0}; public int b = {3,2,1}; ---------------\> …

---

## [Accessing individual channel values of a color var?](https://discourse.processing.org/t/accessing-individual-channel-values-of-a-color-var/23993)

<div class="topic-metadata">

**Author:** [@pablohotsauce](https://discourse.processing.org/u/pablohotsauce)\
**Replies:** 4\
**Last updated:** [September 21, 2020, 4:55pm UTC](https://discourse.processing.org/t/accessing-individual-channel-values-of-a-color-var/23993 "2020-09-21T16:55:39Z")

</div>

I’m trying to access the individual RGBA channel values of a color variable in Processing. In p5, it seems like color variables are objects, and they have a property called levels, which is an array, which can spit out …

---

## [Int array and Int dict](https://discourse.processing.org/t/int-array-and-int-dict/23879)

<div class="topic-metadata">

**Author:** [@rattus](https://discourse.processing.org/u/rattus)\
**Replies:** 6\
**Last updated:** [September 19, 2020, 7:53pm UTC](https://discourse.processing.org/t/int-array-and-int-dict/23879 "2020-09-19T19:53:54Z")

</div>

hi, i am foreign with java, and processing but i know just enough to “get around” now, i have a lattice/2d array, and I would like to assign a dictionary to each one ex: int myArray = new int\[2\]\[2\]; for (int x = 0;…

---

## [Bubble popping animation](https://discourse.processing.org/t/bubble-popping-animation/15341)

<div class="topic-metadata">

**Author:** [@Teljemo](https://discourse.processing.org/u/Teljemo)\
**Replies:** 33\
**Last updated:** [September 16, 2020, 9:16am UTC](https://discourse.processing.org/t/bubble-popping-animation/15341 "2020-09-16T09:16:32Z")

</div>

Hi Me and my son are following Daniel Shiffman’s learn processing guide on YT. We are on creating objects and are want to make a bubble. This bubble is wobbling and rising but we also want it to pop when clicked on. …

---

## [Fullscreen width and height variables returning 100](https://discourse.processing.org/t/fullscreen-width-and-height-variables-returning-100/20351)

<div class="topic-metadata">

**Author:** [@kikomali2517](https://discourse.processing.org/u/kikomali2517)\
**Replies:** 5\
**Last updated:** [September 12, 2020, 7:37pm UTC](https://discourse.processing.org/t/fullscreen-width-and-height-variables-returning-100/20351 "2020-09-12T19:37:59Z")

</div>

Hi! I have seen width and height returning 100 or incorrect values when a sketch is run in fullScreen() many times. Is there a way to get the accurate dimensions of the screen?

---

## [How to keep a shape in center, when the window size is changing?](https://discourse.processing.org/t/how-to-keep-a-shape-in-center-when-the-window-size-is-changing/23766)

<div class="topic-metadata">

**Author:** [@newtothis](https://discourse.processing.org/u/newtothis)\
**Replies:** 1\
**Last updated:** [September 10, 2020, 12:50am UTC](https://discourse.processing.org/t/how-to-keep-a-shape-in-center-when-the-window-size-is-changing/23766 "2020-09-10T00:50:03Z")

</div>

void setup() { size(800,1200); background(200); } //\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\* void draw() { stroke(75); strokeWeight(5); fill(25); rect(135,310,500,500); }

---

## [Why doesn't this halftone code work?](https://discourse.processing.org/t/why-doesnt-this-halftone-code-work/23738)

<div class="topic-metadata">

**Author:** [@gatz\_gaz](https://discourse.processing.org/u/gatz_gaz)\
**Replies:** 1\
**Last updated:** [September 8, 2020, 3:29pm UTC](https://discourse.processing.org/t/why-doesnt-this-halftone-code-work/23738 "2020-09-08T15:29:47Z")

</div>

PImage foto; int maxImages = 6; // Img in totale int imageIndex = 0; // Img iniziale PImage\[\] images = new PImage\[maxImages\]; // Serie di Img void setup() { size(2300, 1700); foto = loadImage("Data/nin0.jpg")…

---

## [Equivalent of p5's "on-demand global mode" for regular (Java) Processing?](https://discourse.processing.org/t/equivalent-of-p5s-on-demand-global-mode-for-regular-java-processing/23701)

<div class="topic-metadata">

**Author:** [@pablohotsauce](https://discourse.processing.org/u/pablohotsauce)\
**Replies:** 8\
**Last updated:** [September 6, 2020, 7:49am UTC](https://discourse.processing.org/t/equivalent-of-p5s-on-demand-global-mode-for-regular-java-processing/23701 "2020-09-06T07:49:49Z")

</div>

Is there an equivalent of p5’s on-demand global mode … new p5(); // in global space … but for regular (Java) Processing? I want to be able to use all Processing functions / methods outside of setup() and draw(). Searche…

---

## [How to get current stroke weight?](https://discourse.processing.org/t/how-to-get-current-stroke-weight/23695)

<div class="topic-metadata">

**Author:** [@mr\_riptano](https://discourse.processing.org/u/mr_riptano)\
**Replies:** 4\
**Last updated:** [September 5, 2020, 6:29pm UTC](https://discourse.processing.org/t/how-to-get-current-stroke-weight/23695 "2020-09-05T18:29:23Z")

</div>

I can set strokeWeight(x) but I can’t find a method to return the current weight.

---

## [Why does empty draw() function change canvas?](https://discourse.processing.org/t/why-does-empty-draw-function-change-canvas/23679)

<div class="topic-metadata">

**Author:** [@mr\_riptano](https://discourse.processing.org/u/mr_riptano)\
**Replies:** 1\
**Last updated:** [September 4, 2020, 3:41pm UTC](https://discourse.processing.org/t/why-does-empty-draw-function-change-canvas/23679 "2020-09-04T15:41:53Z")

</div>

void setup(){ size(400,400); background(0); paint(200,200,150,10); } void draw() { } void paint(float x, float y, float r, float v){ noFill(); strokeWeight(v); stroke(250,180,0,10); ellipse(x,y,r,r); } P…

---

## [Sometimes can't access classes outside of main .pde file](https://discourse.processing.org/t/sometimes-cant-access-classes-outside-of-main-pde-file/23535)

<div class="topic-metadata">

**Author:** [@usr-pyth](https://discourse.processing.org/u/usr-pyth)\
**Replies:** 3\
**Last updated:** [August 28, 2020, 8:29pm UTC](https://discourse.processing.org/t/sometimes-cant-access-classes-outside-of-main-pde-file/23535 "2020-08-28T20:29:19Z")

</div>

I’m making a Processing example of boids, and I have a main boids.pde file and a boid\_class.pde file. I have a class Boid in the boid\_class.pde file that I’m unable to access from boids.pde. How do I fix this?

---

## [Trying to call a function from one class to another. Worked until I made created an array of the Class](https://discourse.processing.org/t/trying-to-call-a-function-from-one-class-to-another-worked-until-i-made-created-an-array-of-the-class/23468)

<div class="topic-metadata">

**Author:** [@BackTo](https://discourse.processing.org/u/BackTo)\
**Replies:** 4\
**Last updated:** [August 27, 2020, 9:05pm UTC](https://discourse.processing.org/t/trying-to-call-a-function-from-one-class-to-another-worked-until-i-made-created-an-array-of-the-class/23468 "2020-08-27T21:05:50Z")

</div>

Hi, I’ve probably not described the problem in the title properly. The error I get is ‘sx cannot be resolved or is not a field’ Me again. I’m adapting an old sketch just as a practice tool to help cement the various c…

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

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