# Beginners

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

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

**Page:** 33

---

## [Instances of classes always updating](https://discourse.processing.org/t/instances-of-classes-always-updating/14985)

<div class="topic-metadata">

**Author:** [@WeinSim](https://discourse.processing.org/u/WeinSim)\
**Replies:** 7\
**Last updated:** [October 28, 2019, 5:38pm UTC](https://discourse.processing.org/t/instances-of-classes-always-updating/14985 "2019-10-28T17:38:30Z")

</div>

Alright, so usually, when you have two variables, e.g. int i1 and int 2, and then you set i1 equal to i2 and change i2, the value in i1 stays put. int i1 = 5; int i2 = i1; i1 = 3; println(i1); //would print 5 But now …

---

## [Get class variables from another class](https://discourse.processing.org/t/get-class-variables-from-another-class/14866)

<div class="topic-metadata">

**Author:** [@HoboGreed](https://discourse.processing.org/u/HoboGreed)\
**Replies:** 6\
**Last updated:** [October 23, 2019, 5:23pm UTC](https://discourse.processing.org/t/get-class-variables-from-another-class/14866 "2019-10-23T17:23:41Z")

</div>

How do I get a variable from the class that created the class ? One a; void setup() { a=new One(); } void draw() {} public class One { Two b; int num; One() { num=9; println(num); b=new Two(); }…

---

## [List of global properties of processing](https://discourse.processing.org/t/list-of-global-properties-of-processing/14879)

<div class="topic-metadata">

**Author:** [@Jean-Michel](https://discourse.processing.org/u/Jean-Michel)\
**Replies:** 2\
**Last updated:** [October 22, 2019, 7:56pm UTC](https://discourse.processing.org/t/list-of-global-properties-of-processing/14879 "2019-10-22T19:56:03Z")

</div>

Hi all, Is there a list all global properties served by processing, width, heigth, mouseX, mouseY, key, keyCode … Thanks, Yours

---

## [Beginner Color Help](https://discourse.processing.org/t/beginner-color-help/14873)

<div class="topic-metadata">

**Author:** [@FilDomInteractive](https://discourse.processing.org/u/FilDomInteractive)\
**Replies:** 2\
**Last updated:** [October 22, 2019, 3:14pm UTC](https://discourse.processing.org/t/beginner-color-help/14873 "2019-10-22T15:14:18Z")

</div>

How do I make something happen when like a line is on a specific colour?

---

## [Create filename from variables](https://discourse.processing.org/t/create-filename-from-variables/14861)

<div class="topic-metadata">

**Author:** [@paulstgeorge](https://discourse.processing.org/u/paulstgeorge)\
**Replies:** 4\
**Last updated:** [October 21, 2019, 8:57pm UTC](https://discourse.processing.org/t/create-filename-from-variables/14861 "2019-10-21T20:57:38Z")

</div>

I want to save an image from the display window using save(). For example: save(“filename.tif”); I want, though, to create the filename using the values of some variables in my sketch. so int var1 = 290; float var2…

---

## [keyPressed Help](https://discourse.processing.org/t/keypressed-help/14807)

<div class="topic-metadata">

**Author:** [@TandemMISMI](https://discourse.processing.org/u/TandemMISMI)\
**Replies:** 9\
**Last updated:** [October 21, 2019, 8:54pm UTC](https://discourse.processing.org/t/keypressed-help/14807 "2019-10-21T20:54:46Z")

</div>

Hello all , I just begin with processing few days ago and I need help about the function keyPressed I want to change the position of my man’s arms when I press a key but when I press the key I have the position before a…

---

## [My text has become myopic](https://discourse.processing.org/t/my-text-has-become-myopic/14736)

<div class="topic-metadata">

**Author:** [@Waboqueox](https://discourse.processing.org/u/Waboqueox)\
**Replies:** 11\
**Last updated:** [October 17, 2019, 8:06am UTC](https://discourse.processing.org/t/my-text-has-become-myopic/14736 "2019-10-17T08:06:42Z")

</div>

\[This is an Android Studio / P3D question\] Hi people :wave: ; I wanted to add a “night mode” to my app, so I made a pair of variables :sunglasses: : int black = 0, white = 255; And changed all my strokes, fill, bac…

---

## [Error unexpected token: void](https://discourse.processing.org/t/error-unexpected-token-void/14662)

<div class="topic-metadata">

**Author:** [@MrRex](https://discourse.processing.org/u/MrRex)\
**Replies:** 7\
**Last updated:** [October 15, 2019, 7:31am UTC](https://discourse.processing.org/t/error-unexpected-token-void/14662 "2019-10-15T07:31:53Z")

</div>

Hello, I’m trying to learn processing but I have an error with my code. Here is my code : void step() { float x; float y; float r = random(1); if (r \< 0.4) { x++; } else if (r \< 0.6) { x--; } else…

---

## [Invoking a common method among different object types](https://discourse.processing.org/t/invoking-a-common-method-among-different-object-types/14677)

<div class="topic-metadata">

**Author:** [@thesuperdaine](https://discourse.processing.org/u/thesuperdaine)\
**Replies:** 10\
**Last updated:** [October 15, 2019, 12:53am UTC](https://discourse.processing.org/t/invoking-a-common-method-among-different-object-types/14677 "2019-10-15T00:53:48Z")

</div>

I am making an rpg game that has lots of different items. I want the different items to do different things when used, but I want them to all have the same methods so that I can call “hpPotion01.use()” on a healing potio…

---

## [The function transform(PVector) does not exist](https://discourse.processing.org/t/the-function-transform-pvector-does-not-exist/14668)

<div class="topic-metadata">

**Author:** [@mamamoo](https://discourse.processing.org/u/mamamoo)\
**Replies:** 18\
**Last updated:** [October 14, 2019, 6:31pm UTC](https://discourse.processing.org/t/the-function-transform-pvector-does-not-exist/14668 "2019-10-14T18:31:43Z")

</div>

class StarField { final int STAR\_COUNT = width / 2; final int MAX\_SPEED = 11, MIN\_SPEED = 1; final int SPEED\_STEP = 1; ArrayList\<Star\> stars; PVector endpoint; int speed; StarField() { e…

---

## [Mixed Datatype Arrays](https://discourse.processing.org/t/mixed-datatype-arrays/14673)

<div class="topic-metadata">

**Author:** [@KeirMeDear](https://discourse.processing.org/u/KeirMeDear)\
**Replies:** 6\
**Last updated:** [October 13, 2019, 11:44pm UTC](https://discourse.processing.org/t/mixed-datatype-arrays/14673 "2019-10-13T23:44:51Z")

</div>

Is there a way to have various datatypes in one array? Checking online it says to initialise as an Object type but that doesn’t seem to work with processing. Can’t seem to find anything in the docu either The Goal: dat…

---

## [Problem with setup() loading order, instantiate an object with 'width' and 'height'](https://discourse.processing.org/t/problem-with-setup-loading-order-instantiate-an-object-with-width-and-height/14552)

<div class="topic-metadata">

**Author:** [@Protos](https://discourse.processing.org/u/Protos)\
**Replies:** 4\
**Last updated:** [October 10, 2019, 8:01am UTC](https://discourse.processing.org/t/problem-with-setup-loading-order-instantiate-an-object-with-width-and-height/14552 "2019-10-10T08:01:53Z")

</div>

Hi, How can I reliably provide width and height to the constructor while creating an object instance. I am constructing a “device object” from a class which is automatically loaded before setup() is executed. In the de…

---

## [Local variable x may not have been initialized](https://discourse.processing.org/t/local-variable-x-may-not-have-been-initialized/14477)

<div class="topic-metadata">

**Author:** [@FilDomInteractive](https://discourse.processing.org/u/FilDomInteractive)\
**Replies:** 8\
**Last updated:** [October 9, 2019, 1:57pm UTC](https://discourse.processing.org/t/local-variable-x-may-not-have-been-initialized/14477 "2019-10-09T13:57:22Z")

</div>

I’m completely new to processing, i’m making a calculator. Please help me! boolean selected = false; float x; float y; { x = 0; y = 0; } void setup() { smooth(8); size(350,450); selected = true; } void draw(…

---

## [Value NaN of a variable](https://discourse.processing.org/t/value-nan-of-a-variable/14220)

<div class="topic-metadata">

**Author:** [@Ignaki](https://discourse.processing.org/u/Ignaki)\
**Replies:** 7\
**Last updated:** [October 3, 2019, 3:34pm UTC](https://discourse.processing.org/t/value-nan-of-a-variable/14220 "2019-10-03T15:34:07Z")

</div>

What does it mean wnen the printed value of a variable is “NaN”?

---

## [Cannot find a class or type named “ParticleSystem”](https://discourse.processing.org/t/cannot-find-a-class-or-type-named-particlesystem/14394)

<div class="topic-metadata">

**Author:** [@Andrea](https://discourse.processing.org/u/Andrea)\
**Replies:** 3\
**Last updated:** [October 3, 2019, 3:10pm UTC](https://discourse.processing.org/t/cannot-find-a-class-or-type-named-particlesystem/14394 "2019-10-03T15:10:10Z")

</div>

Hi! I’m a beginner at programming and coding (actually, I know nothing but what I’ve seen in tutorials) so I’ve been following Daniel’s tutorials on Youtube. The thing is that I’m stuck into this particular tutorial, eve…

---

## [Using camera() and displaying pin up things](https://discourse.processing.org/t/using-camera-and-displaying-pin-up-things/14350)

<div class="topic-metadata">

**Author:** [@Waboqueox](https://discourse.processing.org/u/Waboqueox)\
**Replies:** 2\
**Last updated:** [October 2, 2019, 7:23am UTC](https://discourse.processing.org/t/using-camera-and-displaying-pin-up-things/14350 "2019-10-02T07:23:03Z")

</div>

Hi people; I’m starting using camera(…) and don’t understand well looking the reference or other topics :dizzy\_face: I want to change the camera but let some buttons/text in the front lane without moving (to be able to …

---

## [Linear array of values to grid](https://discourse.processing.org/t/linear-array-of-values-to-grid/14206)

<div class="topic-metadata">

**Author:** [@tombass](https://discourse.processing.org/u/tombass)\
**Replies:** 4\
**Last updated:** [September 29, 2019, 4:05pm UTC](https://discourse.processing.org/t/linear-array-of-values-to-grid/14206 "2019-09-29T16:05:28Z")

</div>

Say i have an array of 16 values eg {10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25} but i want to display them in a 4 x 4 grid. What is the easiest way to get them into a 2d array that looks like this? { {10,11,12,1…

---

## [How to get x and y lines follow mouse + draw coordinates](https://discourse.processing.org/t/how-to-get-x-and-y-lines-follow-mouse-draw-coordinates/14257)

<div class="topic-metadata">

**Author:** [@Teljemo](https://discourse.processing.org/u/Teljemo)\
**Replies:** 7\
**Last updated:** [September 28, 2019, 4:57pm UTC](https://discourse.processing.org/t/how-to-get-x-and-y-lines-follow-mouse-draw-coordinates/14257 "2019-09-28T16:57:37Z")

</div>

Me and my 13 year old son just started to learn programming in processing with the guidence from “the coding train”. I have a hard time explaining how easy the coorinate system is. Drawing on paper and stuff but I guess…

---

## [Exported Processing applications won't run fullScreen() on 2nd display. Mac](https://discourse.processing.org/t/exported-processing-applications-wont-run-fullscreen-on-2nd-display-mac/14155)

<div class="topic-metadata">

**Author:** [@nicnut](https://discourse.processing.org/u/nicnut)\
**Replies:** 2\
**Last updated:** [September 26, 2019, 6:41pm UTC](https://discourse.processing.org/t/exported-processing-applications-wont-run-fullscreen-on-2nd-display-mac/14155 "2019-09-26T18:41:28Z")

</div>

Hi, I am using a Mac powerbook running OS 10.13.6 and Processing 3. I am trying to get my Processing sketches, plus exported applications, running on a external monitor, and eventually a projector connected to my comput…

---

## [Changing shape colors in loops](https://discourse.processing.org/t/changing-shape-colors-in-loops/14117)

<div class="topic-metadata">

**Author:** [@Adrian1998](https://discourse.processing.org/u/Adrian1998)\
**Replies:** 4\
**Last updated:** [September 24, 2019, 5:37am UTC](https://discourse.processing.org/t/changing-shape-colors-in-loops/14117 "2019-09-24T05:37:34Z")

</div>

I am currently trying to change the color of my shapes in a loop, I want the color to change a little each time a ellipse is printed, I don’t know why it is not working it just makes the ellipses all the same color, I ca…

---

## [Need help figuring out how to make triangle and custom shape follow cursor](https://discourse.processing.org/t/need-help-figuring-out-how-to-make-triangle-and-custom-shape-follow-cursor/14021)

<div class="topic-metadata">

**Author:** [@Adrian1998](https://discourse.processing.org/u/Adrian1998)\
**Replies:** 4\
**Last updated:** [September 19, 2019, 10:39pm UTC](https://discourse.processing.org/t/need-help-figuring-out-how-to-make-triangle-and-custom-shape-follow-cursor/14021 "2019-09-19T22:39:48Z")

</div>

So I am very confused on how to make a triangle and a custom shape follow my cursor, with ellipses and rectangles it is very simple because I can just switch the x and y values to mouseX and mouse Y, but with a triangle…

---

## [How do I draw something and then save it as an Image?](https://discourse.processing.org/t/how-do-i-draw-something-and-then-save-it-as-an-image/14033)

<div class="topic-metadata">

**Author:** [@LoliProcessor](https://discourse.processing.org/u/LoliProcessor)\
**Replies:** 14\
**Last updated:** [September 19, 2019, 10:08pm UTC](https://discourse.processing.org/t/how-do-i-draw-something-and-then-save-it-as-an-image/14033 "2019-09-19T22:08:21Z")

</div>

When I draw something on a custom offscreen PGraphics and then save the file it is a blank image with alpha 0 on all pixels. How is PImage and PGraphics supposed to be used to save an image drawn? Worth mentioning is t…

---

## [Github: How to delete files or folder?](https://discourse.processing.org/t/github-how-to-delete-files-or-folder/14059)

<div class="topic-metadata">

**Author:** [@Chrisir](https://discourse.processing.org/u/Chrisir)\
**Replies:** 3\
**Last updated:** [September 19, 2019, 3:41pm UTC](https://discourse.processing.org/t/github-how-to-delete-files-or-folder/14059 "2019-09-19T15:41:10Z")

</div>

Github: How to delete files or folder? I don’t get it I use the browser version

---

## [Difference between randomGaussian() and nextGaussian()](https://discourse.processing.org/t/difference-between-randomgaussian-and-nextgaussian/14008)

<div class="topic-metadata">

**Author:** [@nzfs](https://discourse.processing.org/u/nzfs)\
**Replies:** 2\
**Last updated:** [September 18, 2019, 1:43am UTC](https://discourse.processing.org/t/difference-between-randomgaussian-and-nextgaussian/14008 "2019-09-18T01:43:32Z")

</div>

is there a difference between the randomGaussian() function in processing, and the nextGaussian() in the java.util class?

---

## [Never ending loop](https://discourse.processing.org/t/never-ending-loop/13990)

<div class="topic-metadata">

**Author:** [@Ignaki](https://discourse.processing.org/u/Ignaki)\
**Replies:** 3\
**Last updated:** [September 14, 2019, 7:59pm UTC](https://discourse.processing.org/t/never-ending-loop/13990 "2019-09-14T19:59:52Z")

</div>

Why a loop is never ending a you use de function random as in: for (int i = 0; i \< 1000; i = i+1) { A = random(i); B = random(i); point(A,B); } An…

---

## [Choosing among array, arrayList, etc](https://discourse.processing.org/t/choosing-among-array-arraylist-etc/13956)

<div class="topic-metadata">

**Author:** [@mdg](https://discourse.processing.org/u/mdg)\
**Replies:** 3\
**Last updated:** [September 12, 2019, 10:09pm UTC](https://discourse.processing.org/t/choosing-among-array-arraylist-etc/13956 "2019-09-12T22:09:47Z")

</div>

I am somewhat new to Processing and Java-type syntax, but not new to programming in general. My project requires use of arrays, and I’ve been able to code everything out using for loops etc., but it’s tedious compared to…

---

## [How to print with 2 decimals?](https://discourse.processing.org/t/how-to-print-with-2-decimals/13929)

<div class="topic-metadata">

**Author:** [@GuilhermeVolker](https://discourse.processing.org/u/GuilhermeVolker)\
**Replies:** 4\
**Last updated:** [September 12, 2019, 2:04am UTC](https://discourse.processing.org/t/how-to-print-with-2-decimals/13929 "2019-09-12T02:04:13Z")

</div>

Hello. I need to print a float variable with 2 decimals. I couldn’t find on processing reference :expressionless:

---

## [Display images alternately](https://discourse.processing.org/t/display-images-alternately/13567)

<div class="topic-metadata">

**Author:** [@Moene](https://discourse.processing.org/u/Moene)\
**Replies:** 3\
**Last updated:** [August 24, 2019, 11:11am UTC](https://discourse.processing.org/t/display-images-alternately/13567 "2019-08-24T11:11:16Z")

</div>

How can I display an image in draw() successively with a delay between them? PImage img1; PImage img2; void setup () { img1 = loadImage("step5.png"); img2 = loadImage("fail2.png"); size(801,583); background(…

---

## [Float Precision](https://discourse.processing.org/t/float-precision/13836)

<div class="topic-metadata">

**Author:** [@grumo](https://discourse.processing.org/u/grumo)\
**Replies:** 15\
**Last updated:** [September 7, 2019, 4:10am UTC](https://discourse.processing.org/t/float-precision/13836 "2019-09-07T04:10:43Z")

</div>

I’m using doubles for some mathematical calculations and I’m getting these two values: a = -69.49068165087722 n = 304.2372372266157 The problem is when I do this: float fa = (float) a; float fb = (float) b; I get: …

---

## [Dividing a round number doesn't work. Dividing as a variable does?](https://discourse.processing.org/t/dividing-a-round-number-doesnt-work-dividing-as-a-variable-does/13862)

<div class="topic-metadata">

**Author:** [@Marinus](https://discourse.processing.org/u/Marinus)\
**Replies:** 6\
**Last updated:** [September 7, 2019, 7:06pm UTC](https://discourse.processing.org/t/dividing-a-round-number-doesnt-work-dividing-as-a-variable-does/13862 "2019-09-07T19:06:15Z")

</div>

Hi, I am having a question why something doesn’t work one way, but it does the other way. I was sketching something out in processing with this variable: float k = 5 / 8; It didn’t want to work. But when I did it like…

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

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