# Beginners

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

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

**Page:** 36

---

## [Help with class and draw](https://discourse.processing.org/t/help-with-class-and-draw/10979)

<div class="topic-metadata">

**Author:** [@jensemand](https://discourse.processing.org/u/jensemand)\
**Replies:** 10\
**Last updated:** [May 6, 2019, 7:13pm UTC](https://discourse.processing.org/t/help-with-class-and-draw/10979 "2019-05-06T19:13:36Z")

</div>

Hi, I have a class with the variable lvl=1;. the problem is I want to display the “1” in draw by doing something like this: text(“lvl”,200,200,100,100); however this doesn’t work

---

## [for-Loop w/ Array of random RGB values](https://discourse.processing.org/t/for-loop-w-array-of-random-rgb-values/11084)

<div class="topic-metadata">

**Author:** [@r8th](https://discourse.processing.org/u/r8th)\
**Replies:** 2\
**Last updated:** [May 10, 2019, 5:18am UTC](https://discourse.processing.org/t/for-loop-w-array-of-random-rgb-values/11084 "2019-05-10T05:18:07Z")

</div>

Hi! I’m using Casey and Ben’s Getting Stared with Processing book. Example 11-8, pp 155-156, shows how to fill an ARRAY w RANDOM values using a FOR loop. The RANDOM values are passed to STROKE values. The example below i…

---

## [PImage in class](https://discourse.processing.org/t/pimage-in-class/11091)

<div class="topic-metadata">

**Author:** [@jashuman19](https://discourse.processing.org/u/jashuman19)\
**Replies:** 7\
**Last updated:** [May 10, 2019, 2:25am UTC](https://discourse.processing.org/t/pimage-in-class/11091 "2019-05-10T02:25:45Z")

</div>

When I try to create a PImage instance variable in a class file, I get the following error: Cannot find a class or type named “PImage” Does anyone know why this is? For reference, the (simplified) class looks like this…

---

## [Drawn shapes stay after frame they were drawn?](https://discourse.processing.org/t/drawn-shapes-stay-after-frame-they-were-drawn/11080)

<div class="topic-metadata">

**Author:** [@DerekCresswell](https://discourse.processing.org/u/DerekCresswell)\
**Replies:** 2\
**Last updated:** [May 9, 2019, 7:49pm UTC](https://discourse.processing.org/t/drawn-shapes-stay-after-frame-they-were-drawn/11080 "2019-05-09T19:49:50Z")

</div>

I know this is really stupid. Why are shapes staying on screen even if they weren’t drawn this frame? This hasn’t happened on my other projects. Basically my shapes are leaving trails of themselves.

---

## [Creating a lot of variables](https://discourse.processing.org/t/creating-a-lot-of-variables/11052)

<div class="topic-metadata">

**Author:** [@crab](https://discourse.processing.org/u/crab)\
**Replies:** 2\
**Last updated:** [May 9, 2019, 8:13am UTC](https://discourse.processing.org/t/creating-a-lot-of-variables/11052 "2019-05-09T08:13:38Z")

</div>

Hi, I need to create a lot of variables with the same name, but with different numbers after the name, like that(obviously doesn’t work): void setup(){ for(int i = 10;i\>=0;i--){ int "var" + char(i); } } What c…

---

## [Saving a variable](https://discourse.processing.org/t/saving-a-variable/11025)

<div class="topic-metadata">

**Author:** [@jensemand](https://discourse.processing.org/u/jensemand)\
**Replies:** 3\
**Last updated:** [May 8, 2019, 12:55pm UTC](https://discourse.processing.org/t/saving-a-variable/11025 "2019-05-08T12:55:58Z")

</div>

Hi i want to save a variable inside draw without it changes its value. How do I do that?

---

## [Object Methods not looping](https://discourse.processing.org/t/object-methods-not-looping/10995)

<div class="topic-metadata">

**Author:** [@Timo1](https://discourse.processing.org/u/Timo1)\
**Replies:** 1\
**Last updated:** [May 7, 2019, 10:35am UTC](https://discourse.processing.org/t/object-methods-not-looping/10995 "2019-05-07T10:35:54Z")

</div>

Hi there, Not sure if this a bug or if I have done something silly, but I have a very simple sketch using a class which for some reason is not updating/looping… Circle ball; void setup() { size (100,100); backgr…

---

## [Can "return" be applied to a String?](https://discourse.processing.org/t/can-return-be-applied-to-a-string/10823)

<div class="topic-metadata">

**Author:** [@laptophead](https://discourse.processing.org/u/laptophead)\
**Replies:** 3\
**Last updated:** [May 2, 2019, 12:08pm UTC](https://discourse.processing.org/t/can-return-be-applied-to-a-string/10823 "2019-05-02T12:08:43Z")

</div>

I wrote this little function to convert miliseconds to Human readible time. I would like to use “return” to make life simple. So I tried: void MsConversion(int MS) { int totalSec= (MS / 1000); int seconds = (MS / 10…

---

## [Line not drawing as it should](https://discourse.processing.org/t/line-not-drawing-as-it-should/10771)

<div class="topic-metadata">

**Author:** [@xKoldFuzionx](https://discourse.processing.org/u/xKoldFuzionx)\
**Replies:** 2\
**Last updated:** [April 30, 2019, 12:54am UTC](https://discourse.processing.org/t/line-not-drawing-as-it-should/10771 "2019-04-30T00:54:11Z")

</div>

Ok, I am newer to processing, but not a complete beginner. I’ve been going through a book to try and build my skills a little better and I just wanted to test myself by drawing a line on a small 200x200 window. The bas…

---

## [Fill color not working](https://discourse.processing.org/t/fill-color-not-working/10600)

<div class="topic-metadata">

**Author:** [@nhurst](https://discourse.processing.org/u/nhurst)\
**Replies:** 2\
**Last updated:** [April 24, 2019, 5:25pm UTC](https://discourse.processing.org/t/fill-color-not-working/10600 "2019-04-24T17:25:14Z")

</div>

Not sure what I expected isn’t happening? The following draws a square, loops, reduces size of square and rotates slightly. Each square should be filled with a color that changes. However, at the end of the program, a…

---

## [The function printArray doesn't exist?](https://discourse.processing.org/t/the-function-printarray-doesnt-exist/10452)

<div class="topic-metadata">

**Author:** [@bking](https://discourse.processing.org/u/bking)\
**Replies:** 3\
**Last updated:** [April 21, 2019, 3:55pm UTC](https://discourse.processing.org/t/the-function-printarray-doesnt-exist/10452 "2019-04-21T15:55:06Z")

</div>

Hi, I don’t manage to see an array of float. I don’t understand why. The array is declared like that before the setup public float\[\] naturalFrequency; and I use printArray (naturalFrequency\[i\]); but it doesn’t work …

---

## [Make the camera follow an object](https://discourse.processing.org/t/make-the-camera-follow-an-object/10386)

<div class="topic-metadata">

**Author:** [@jensemand](https://discourse.processing.org/u/jensemand)\
**Replies:** 5\
**Last updated:** [April 21, 2019, 3:52pm UTC](https://discourse.processing.org/t/make-the-camera-follow-an-object/10386 "2019-04-21T15:52:10Z")

</div>

Hi, I am trying to make a game in processing and I need to make the camera follow an object by using camera, but i can’t get it to work so it would be nice with just a simple example

---

## [Using java code in processing](https://discourse.processing.org/t/using-java-code-in-processing/10416)

<div class="topic-metadata">

**Author:** [@ctrembla](https://discourse.processing.org/u/ctrembla)\
**Replies:** 10\
**Last updated:** [April 20, 2019, 7:27pm UTC](https://discourse.processing.org/t/using-java-code-in-processing/10416 "2019-04-20T19:27:00Z")

</div>

OK, I was looking into the toy AI coding train made and found the code for flappy bird nn in processing so I copied and pasted to see what would happen, but one file said java instead of the processing end letter. do I c…

---

## [Cannot convert from double to float](https://discourse.processing.org/t/cannot-convert-from-double-to-float/10427)

<div class="topic-metadata">

**Author:** [@bking](https://discourse.processing.org/u/bking)\
**Replies:** 2\
**Last updated:** [April 18, 2019, 8:28pm UTC](https://discourse.processing.org/t/cannot-convert-from-double-to-float/10427 "2019-04-18T20:28:29Z")

</div>

Hi, I need to change variable from double to float but I can’t. private double differentiate(double phase, double noise, double naturalFrequency) { //float AvPh= averagePhase; // float Ph= phase; float AvPh…

---

## [2D Array Average of each row and ignoring single values](https://discourse.processing.org/t/2d-array-average-of-each-row-and-ignoring-single-values/10488)

<div class="topic-metadata">

**Author:** [@Zortak](https://discourse.processing.org/u/Zortak)\
**Replies:** 3\
**Last updated:** [April 20, 2019, 4:35pm UTC](https://discourse.processing.org/t/2d-array-average-of-each-row-and-ignoring-single-values/10488 "2019-04-20T16:35:38Z")

</div>

Hey, I’ve got an assignment about 2D Arrays in which the array is supposed to be an ozon meter and the values are hourly measurements per day, with the value = 0 meaning the meter was defect. We need to get the averag…

---

## [Adding numbers in an empty array in Processing 3.5.3](https://discourse.processing.org/t/adding-numbers-in-an-empty-array-in-processing-3-5-3/10496)

<div class="topic-metadata">

**Author:** [@TambourMagique](https://discourse.processing.org/u/TambourMagique)\
**Replies:** 3\
**Last updated:** [April 20, 2019, 3:34pm UTC](https://discourse.processing.org/t/adding-numbers-in-an-empty-array-in-processing-3-5-3/10496 "2019-04-20T15:34:17Z")

</div>

Hello, I am trying to code a rythm game in Processing. Since then I was coding in OpenProcessing but in order to import songs, I had to change the application. I had to make a list of 600 integer. To make the program m…

---

## [Why does my int give me 3 results?](https://discourse.processing.org/t/why-does-my-int-give-me-3-results/10479)

<div class="topic-metadata">

**Author:** [@dewwolf](https://discourse.processing.org/u/dewwolf)\
**Replies:** 4\
**Last updated:** [April 20, 2019, 9:03am UTC](https://discourse.processing.org/t/why-does-my-int-give-me-3-results/10479 "2019-04-20T09:03:55Z")

</div>

Hello! I am re-entering the world of processing, and have hit a learning snag. With what I have right now, It is giving me 10, 11, and 12 as an answer. I understand the 11, but not the other 2. Can anyone explain? Thank …

---

## [\[Processing 3\] Moving through a map bigger than the screen](https://discourse.processing.org/t/processing-3-moving-through-a-map-bigger-than-the-screen/10393)

<div class="topic-metadata">

**Author:** [@whedz](https://discourse.processing.org/u/whedz)\
**Replies:** 6\
**Last updated:** [April 20, 2019, 12:35am UTC](https://discourse.processing.org/t/processing-3-moving-through-a-map-bigger-than-the-screen/10393 "2019-04-20T00:35:27Z")

</div>

Hello, I’m currently trying to make a arcade video game, with a vertical scrolling. I use eclipse and processing 3 as a library import into java classes and I don’t face any issue about it. I now get two variables for …

---

## [Can't create a PShape in class constructor](https://discourse.processing.org/t/cant-create-a-pshape-in-class-constructor/10463)

<div class="topic-metadata">

**Author:** [@cyanblue](https://discourse.processing.org/u/cyanblue)\
**Replies:** 2\
**Last updated:** [April 19, 2019, 6:18pm UTC](https://discourse.processing.org/t/cant-create-a-pshape-in-class-constructor/10463 "2019-04-19T18:18:36Z")

</div>

I’ve created a “Star” class that allows me to create a star shape given inner and outer radii and number of points. I’ve written a load of code in the constructor that works out the vertices of the star, and saves each t…

---

## [Variable/interactive beginShape() kind?](https://discourse.processing.org/t/variable-interactive-beginshape-kind/10354)

<div class="topic-metadata">

**Author:** [@cyanblue](https://discourse.processing.org/u/cyanblue)\
**Replies:** 3\
**Last updated:** [April 19, 2019, 5:35pm UTC](https://discourse.processing.org/t/variable-interactive-beginshape-kind/10354 "2019-04-19T17:35:49Z")

</div>

I have a set of vertices I’m drawing within beginShape(), and I wanted to cycle through the different options each time the mouse is clicked i.e. beginShape(TRIANGLES), beginShape(POINTS), beginShape(LINES) etc. I’ve ma…

---

## [Array expand doesn't always work?](https://discourse.processing.org/t/array-expand-doesnt-always-work/10410)

<div class="topic-metadata">

**Author:** [@RichardDL](https://discourse.processing.org/u/RichardDL)\
**Replies:** 2\
**Last updated:** [April 17, 2019, 9:05pm UTC](https://discourse.processing.org/t/array-expand-doesnt-always-work/10410 "2019-04-17T21:05:47Z")

</div>

The example given for ‘expand’ works alright, but the code below is the example for loadStrings, with expand added. Why doesn’t it expand the array? String\[\] lines = loadStrings("list.txt"); println("there are " + line…

---

## [Problems with true false](https://discourse.processing.org/t/problems-with-true-false/10348)

<div class="topic-metadata">

**Author:** [@jensemand](https://discourse.processing.org/u/jensemand)\
**Replies:** 6\
**Last updated:** [April 16, 2019, 1:32pm UTC](https://discourse.processing.org/t/problems-with-true-false/10348 "2019-04-16T13:32:15Z")

</div>

Hi, I have some troubles. I want to make a boolean true when I press a bottom and then stay true but it always changes back to false

---

## [Size() not recognised by PVector?](https://discourse.processing.org/t/size-not-recognised-by-pvector/10235)

<div class="topic-metadata">

**Author:** [@itch](https://discourse.processing.org/u/itch)\
**Replies:** 2\
**Last updated:** [April 13, 2019, 10:58am UTC](https://discourse.processing.org/t/size-not-recognised-by-pvector/10235 "2019-04-13T10:58:33Z")

</div>

Hi all, I’ve been reading about the issue with size() not working in void setup() through version 3, and the fix of moving size() into void settings(). I have run into a similar scenario but it seems to be directly rela…

---

## [Why does my bubble not stop at the top?](https://discourse.processing.org/t/why-does-my-bubble-not-stop-at-the-top/10232)

<div class="topic-metadata">

**Author:** [@abigail](https://discourse.processing.org/u/abigail)\
**Replies:** 8\
**Last updated:** [April 13, 2019, 10:57am UTC](https://discourse.processing.org/t/why-does-my-bubble-not-stop-at-the-top/10232 "2019-04-13T10:57:45Z")

</div>

Hi, if anyone could help me figure out why my bubble does not stop once y is greater than the height that would be great :slight\_smile: Thanks in advance. Bubble b; void setup() { size(600, 400); b = new Bubble();…

---

## [Shift Key Creating Box Character](https://discourse.processing.org/t/shift-key-creating-box-character/10197)

<div class="topic-metadata">

**Author:** [@clevelandbrowns](https://discourse.processing.org/u/clevelandbrowns)\
**Replies:** 5\
**Last updated:** [April 12, 2019, 1:07pm UTC](https://discourse.processing.org/t/shift-key-creating-box-character/10197 "2019-04-12T13:07:06Z")

</div>

When I input characters, my shift keys are producing a box character when pressed. For example, if I’m typing the name Bob, it comes up as \[box\]Bob. How can I prevent this? This is for console output by the way.

---

## [Is it possible to have and array of objects with varying parameters?](https://discourse.processing.org/t/is-it-possible-to-have-and-array-of-objects-with-varying-parameters/10188)

<div class="topic-metadata">

**Author:** [@itch](https://discourse.processing.org/u/itch)\
**Replies:** 4\
**Last updated:** [April 11, 2019, 7:50pm UTC](https://discourse.processing.org/t/is-it-possible-to-have-and-array-of-objects-with-varying-parameters/10188 "2019-04-11T19:50:17Z")

</div>

Hi everyone, I’m just getting started with Processing and I’m writing a simple, one-octave piano keyboard. I have a class named Key: class Key{ float x; float y; float w; float h; color col; Key(flo…

---

## [How find the Class of argument when this one is a primitive?](https://discourse.processing.org/t/how-find-the-class-of-argument-when-this-one-is-a-primitive/9970)

<div class="topic-metadata">

**Author:** [@Stanlepunk](https://discourse.processing.org/u/Stanlepunk)\
**Replies:** 8\
**Last updated:** [April 5, 2019, 5:59pm UTC](https://discourse.processing.org/t/how-find-the-class-of-argument-when-this-one-is-a-primitive/9970 "2019-04-05T17:59:21Z")

</div>

I try to check the class of argument to create a method builder, but when the case the argument is primitive, i don’t find a way to do that ? My code who’s don’t work !!! void setup() { Truc t = new Truc(); println…

---

## [\`The sketch path is not set.\` error when loading table in global](https://discourse.processing.org/t/the-sketch-path-is-not-set-error-when-loading-table-in-global/9952)

<div class="topic-metadata">

**Author:** [@jmt2080ad](https://discourse.processing.org/u/jmt2080ad)\
**Replies:** 5\
**Last updated:** [April 5, 2019, 8:34am UTC](https://discourse.processing.org/t/the-sketch-path-is-not-set-error-when-loading-table-in-global/9952 "2019-04-05T08:34:47Z")

</div>

I have a large 500K row table that I am trying to use for animating a point. All the examples I can find for loadTable() show the table loading in draw() and using a for loop there to iterate over rows. What I want to do…

---

## [Why am I getting a NullPointerException](https://discourse.processing.org/t/why-am-i-getting-a-nullpointerexception/9932)

<div class="topic-metadata">

**Author:** [@hasanfarhan33](https://discourse.processing.org/u/hasanfarhan33)\
**Replies:** 4\
**Last updated:** [April 3, 2019, 7:01pm UTC](https://discourse.processing.org/t/why-am-i-getting-a-nullpointerexception/9932 "2019-04-03T19:01:33Z")

</div>

Hello everyone, this is my first ever personal processing project. I am trying to create a game where you send the colored boxes to their particular location. For example, the red box should go to the red position and th…

---

## [Defining Coordinates of a Sphere](https://discourse.processing.org/t/defining-coordinates-of-a-sphere/9813)

<div class="topic-metadata">

**Author:** [@kirstee\_baxt](https://discourse.processing.org/u/kirstee_baxt)\
**Replies:** 5\
**Last updated:** [April 2, 2019, 7:27pm UTC](https://discourse.processing.org/t/defining-coordinates-of-a-sphere/9813 "2019-04-02T19:27:47Z")

</div>

Hello! I’m interested in defining the coordinates of where a sphere lies in a 3D space. I know sphere uses just radius sphere(r); Is there a way to define (x,y,z) values?

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

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