# Beginners

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

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

**Page:** 23

---

## [Can someone explain noise() aka perlinNoise() function?](https://discourse.processing.org/t/can-someone-explain-noise-aka-perlinnoise-function/26627)

<div class="topic-metadata">

**Author:** [@CodeMasterX](https://discourse.processing.org/u/CodeMasterX)\
**Replies:** 8\
**Last updated:** [December 31, 2020, 1:55pm UTC](https://discourse.processing.org/t/can-someone-explain-noise-aka-perlinnoise-function/26627 "2020-12-31T13:55:29Z")

</div>

Hi! How do I use noise()? I tried a few times but still nothing. I know you can enter a 1D, 2D or 3D input. but this happen void setup() { size(600,600); } void draw() { for(int i = 0; i \< width; i++) { for…

---

## [Multiplication bug](https://discourse.processing.org/t/multiplication-bug/26619)

<div class="topic-metadata">

**Author:** [@Javier](https://discourse.processing.org/u/Javier)\
**Replies:** 16\
**Last updated:** [December 30, 2020, 11:09pm UTC](https://discourse.processing.org/t/multiplication-bug/26619 "2020-12-30T23:09:29Z")

</div>

Good morning! Can anybody explain to me why the return value of t is -8.311896E7? There is a max value that a variable can have? I can’t understand why it is happening. I have read the reference guide of Processing, …

---

## [Help with objects](https://discourse.processing.org/t/help-with-objects/26590)

<div class="topic-metadata">

**Author:** [@CodeMasterX](https://discourse.processing.org/u/CodeMasterX)\
**Replies:** 2\
**Last updated:** [December 29, 2020, 6:02pm UTC](https://discourse.processing.org/t/help-with-objects/26590 "2020-12-29T18:02:02Z")

</div>

Hi! I always had the issue with objects. I want to replicate PVector a = new PVector(x,y,z) with the class Circles. So something like ArrayList\<Circles\> circle = new ArrayList\<Circles\>() circle.add(new Circles( x, y,…

---

## [NullPointerException with arrays help](https://discourse.processing.org/t/nullpointerexception-with-arrays-help/26543)

<div class="topic-metadata">

**Author:** [@Ironbatman1](https://discourse.processing.org/u/Ironbatman1)\
**Replies:** 3\
**Last updated:** [December 27, 2020, 10:57pm UTC](https://discourse.processing.org/t/nullpointerexception-with-arrays-help/26543 "2020-12-27T22:57:59Z")

</div>

Hey so it’s an array of Test (custom object/class) called tests and I’m trying to do clearing with all objects in the array hence the for loop. so I set them and when I try to use it breaks and gives a null pointer at te…

---

## [Void function is returning values but shouldn't](https://discourse.processing.org/t/void-function-is-returning-values-but-shouldnt/26528)

<div class="topic-metadata">

**Author:** [@Divitiacus](https://discourse.processing.org/u/Divitiacus)\
**Replies:** 6\
**Last updated:** [December 27, 2020, 1:23pm UTC](https://discourse.processing.org/t/void-function-is-returning-values-but-shouldnt/26528 "2020-12-27T13:23:15Z")

</div>

Hi there, as far as I know, void functions do not return values. However, when I run the code below, the wind vector gets smaller and smaller with each frame, because the va value is returned back as new wind vector. …

---

## [Addition of all integer numbers from 1 - 100 (loop)](https://discourse.processing.org/t/addition-of-all-integer-numbers-from-1-100-loop/26237)

<div class="topic-metadata">

**Author:** [@hullah](https://discourse.processing.org/u/hullah)\
**Replies:** 5\
**Last updated:** [December 26, 2020, 1:47am UTC](https://discourse.processing.org/t/addition-of-all-integer-numbers-from-1-100-loop/26237 "2020-12-26T01:47:41Z")

</div>

hey guys, I am an absolutely beginner who wants to add all integer numbers from 1 to 100 ( in a loop) and print the result with println(). I know that I should use a for() loop but how can I add each element of 1-100 in…

---

## [Using String\[ : 10\] in Java mode](https://discourse.processing.org/t/using-string-10-in-java-mode/26520)

<div class="topic-metadata">

**Author:** [@CodeMasterX](https://discourse.processing.org/u/CodeMasterX)\
**Replies:** 1\
**Last updated:** [December 26, 2020, 1:05pm UTC](https://discourse.processing.org/t/using-string-10-in-java-mode/26520 "2020-12-26T13:05:50Z")

</div>

I started learning processing.py and found a String\[int\] function (String.charAt( ) ) and String\[ : int \] which returns the string before int. Can I do something similar to it in Java mode (normal processing) without us…

---

## [How to create a vector with 4 parameters?](https://discourse.processing.org/t/how-to-create-a-vector-with-4-parameters/26509)

<div class="topic-metadata">

**Author:** [@CodeMasterX](https://discourse.processing.org/u/CodeMasterX)\
**Replies:** 4\
**Last updated:** [December 25, 2020, 5:19pm UTC](https://discourse.processing.org/t/how-to-create-a-vector-with-4-parameters/26509 "2020-12-25T17:19:36Z")

</div>

How do I create a vector with 4 varriables stored within? (position x & y, speed x & y) so something like //moving the ball ball = new PVector( ball.x + ball.z, ball.y + ball.w, ball.z\*friction, ball.w\*friction); circl…

---

## [How to truncate, limit, clamp, constrain, shorten, etc ... a string?](https://discourse.processing.org/t/how-to-truncate-limit-clamp-constrain-shorten-etc-a-string/26458)

<div class="topic-metadata">

**Author:** [@CaseyJ](https://discourse.processing.org/u/CaseyJ)\
**Replies:** 2\
**Last updated:** [December 24, 2020, 4:19am UTC](https://discourse.processing.org/t/how-to-truncate-limit-clamp-constrain-shorten-etc-a-string/26458 "2020-12-24T04:19:52Z")

</div>

I have a better feeling for how to limit the run on numbers in a long decimal using the nf() function in Processing. However, how do you do this with a string? I see no alternative so maybe you can still use nf()? For…

---

## [Setting an Array\[\] as function parameter](https://discourse.processing.org/t/setting-an-array-as-function-parameter/26429)

<div class="topic-metadata">

**Author:** [@CodeMasterX](https://discourse.processing.org/u/CodeMasterX)\
**Replies:** 2\
**Last updated:** [December 22, 2020, 12:45pm UTC](https://discourse.processing.org/t/setting-an-array-as-function-parameter/26429 "2020-12-22T12:45:48Z")

</div>

Hi! I made a quiz program where you have to create a String q\[\] = {"what is the first letter?","a","b","c"}; and use this in addQuestion(q,2); is it possible to use something like addQuestion( {"what is the first lette…

---

## [How to define two types of variables in a for-loop](https://discourse.processing.org/t/how-to-define-two-types-of-variables-in-a-for-loop/26414)

<div class="topic-metadata">

**Author:** [@CodeMasterX](https://discourse.processing.org/u/CodeMasterX)\
**Replies:** 7\
**Last updated:** [December 22, 2020, 8:47am UTC](https://discourse.processing.org/t/how-to-define-two-types-of-variables-in-a-for-loop/26414 "2020-12-22T08:47:18Z")

</div>

Hi! Today I leared something like this size(600, 600); for (int i = 0, mi = 10, r = 200; i \< mi; i++) line(cos(TWO\_PI/mi\*i)\*r+width/2, sin(TWO\_PI/mi\*i)\*r+height/2, cos(TWO\_PI/mi\*(i+1))\*r+width/2, sin(TWO\_PI/mi\*(i+1))\*r…

---

## [How to check for a color in an area](https://discourse.processing.org/t/how-to-check-for-a-color-in-an-area/17616)

<div class="topic-metadata">

**Author:** [@Yannik](https://discourse.processing.org/u/Yannik)\
**Replies:** 10\
**Last updated:** [December 21, 2020, 5:01pm UTC](https://discourse.processing.org/t/how-to-check-for-a-color-in-an-area/17616 "2020-12-21T17:01:40Z")

</div>

How can I check, if there is a specific color in an area? Like: If(color in area(10,100,50,600) == color(0,0,255)){ run code }

---

## [Making the variables into arrays, just to make the code more optimal](https://discourse.processing.org/t/making-the-variables-into-arrays-just-to-make-the-code-more-optimal/26368)

<div class="topic-metadata">

**Author:** [@GoWithTheFloe](https://discourse.processing.org/u/GoWithTheFloe)\
**Replies:** 3\
**Last updated:** [December 21, 2020, 2:33pm UTC](https://discourse.processing.org/t/making-the-variables-into-arrays-just-to-make-the-code-more-optimal/26368 "2020-12-21T14:33:54Z")

</div>

Hello, I am a beginner and I am trying to make my code more optimal and look more professional. I have some variables that are called the same but they all end with the numbers 0,1, 2 and so on. I ask this question whil…

---

## [Having keyPressed() in multiple classes](https://discourse.processing.org/t/having-keypressed-in-multiple-classes/26401)

<div class="topic-metadata">

**Author:** [@gapigapi](https://discourse.processing.org/u/gapigapi)\
**Replies:** 2\
**Last updated:** [December 20, 2020, 6:53pm UTC](https://discourse.processing.org/t/having-keypressed-in-multiple-classes/26401 "2020-12-20T18:53:30Z")

</div>

I am having some problems with void keypress() function. If i use it in the main class it works, but if i then try to call a class where i do the maths and then draw() which works in that class and draw on canvas create…

---

## [Issue with expecting }, found 'else'](https://discourse.processing.org/t/issue-with-expecting-found-else/26377)

<div class="topic-metadata">

**Author:** [@yevsym](https://discourse.processing.org/u/yevsym)\
**Replies:** 8\
**Last updated:** [December 19, 2020, 10:33am UTC](https://discourse.processing.org/t/issue-with-expecting-found-else/26377 "2020-12-19T10:33:23Z")

</div>

I wrote this code, but Processing keeps telling me about the “expecting }, found ‘else’” error. I checked my code many times, but I just stick at missing out the mistake. Please help out, if you spot it. void draw() { …

---

## [Boolean confusion](https://discourse.processing.org/t/boolean-confusion/26348)

<div class="topic-metadata">

**Author:** [@SadCSstudent](https://discourse.processing.org/u/SadCSstudent)\
**Replies:** 2\
**Last updated:** [December 17, 2020, 11:38pm UTC](https://discourse.processing.org/t/boolean-confusion/26348 "2020-12-17T23:38:16Z")

</div>

nothing to see here anymore, question answered

---

## [How to know that a pixel is semi-transparent？](https://discourse.processing.org/t/how-to-know-that-a-pixel-is-semi-transparent/26325)

<div class="topic-metadata">

**Author:** [@AbleYudada](https://discourse.processing.org/u/AbleYudada)\
**Replies:** 2\
**Last updated:** [December 17, 2020, 6:51am UTC](https://discourse.processing.org/t/how-to-know-that-a-pixel-is-semi-transparent/26325 "2020-12-17T06:51:49Z")

</div>

Hi guys, is there any way to know if a pixel is semi-transparent？No matter what color it is, I just want to know if it is semi-transparent.

---

## [Can anyone point out what I'm doing wrong?](https://discourse.processing.org/t/can-anyone-point-out-what-im-doing-wrong/26239)

<div class="topic-metadata">

**Author:** [@Marsquid](https://discourse.processing.org/u/Marsquid)\
**Replies:** 4\
**Last updated:** [December 14, 2020, 4:21pm UTC](https://discourse.processing.org/t/can-anyone-point-out-what-im-doing-wrong/26239 "2020-12-14T16:21:49Z")

</div>

Hey all! I was given a task by my Lecturer to make a Baloon popping game but for some reason when I run the code the screen is completely gray. I have absolutely no clue as to how/why this is happening and was wondering…

---

## [Problem with ArrayList\<Float\>](https://discourse.processing.org/t/problem-with-arraylist-float/26215)

<div class="topic-metadata">

**Author:** [@CodeMasterX](https://discourse.processing.org/u/CodeMasterX)\
**Replies:** 3\
**Last updated:** [December 13, 2020, 10:08pm UTC](https://discourse.processing.org/t/problem-with-arraylist-float/26215 "2020-12-13T22:08:19Z")

</div>

I stumbled upon a problem a few times. It’s either this or error: index: 0 size: 0. Why is this happening. I am relatively new to this but I can’t do anything. It sometimes fixes on itself and at other times it just does…

---

## [Bug with int\[\]={};](https://discourse.processing.org/t/bug-with-int/26135)

<div class="topic-metadata">

**Author:** [@CodeMasterX](https://discourse.processing.org/u/CodeMasterX)\
**Replies:** 2\
**Last updated:** [December 11, 2020, 3:45pm UTC](https://discourse.processing.org/t/bug-with-int/26135 "2020-12-11T15:45:25Z")

</div>

Here is a program I wrote for MASTERMIND game. When I was trying a way to get the correct placing & correct numbers. Here is the code which always returns OutOfBounds exception //mastermind int code\[\] = {0, 3, 1, 2}; i…

---

## [Moving two Objects at the same time with different keys](https://discourse.processing.org/t/moving-two-objects-at-the-same-time-with-different-keys/26097)

<div class="topic-metadata">

**Author:** [@jorick](https://discourse.processing.org/u/jorick)\
**Replies:** 3\
**Last updated:** [December 9, 2020, 9:42pm UTC](https://discourse.processing.org/t/moving-two-objects-at-the-same-time-with-different-keys/26097 "2020-12-09T21:42:58Z")

</div>

I´m working on a game in wich i have two balls. Both Balls should be movable at the same time, the first one with w,a,s,d and the second one with the arrow keys. My problem is that i can always only move one object. Are …

---

## [Using ArrayList\<int\>](https://discourse.processing.org/t/using-arraylist-int/26094)

<div class="topic-metadata">

**Author:** [@CodeMasterX](https://discourse.processing.org/u/CodeMasterX)\
**Replies:** 22\
**Last updated:** [December 9, 2020, 8:10pm UTC](https://discourse.processing.org/t/using-arraylist-int/26094 "2020-12-09T20:10:45Z")

</div>

Hi! I recently learned how to use ArrayLists and tried to use ArrayList\<int\> selection = new ArrayList\<int\>(); but the int does not work. Any ideas why? Here is the code if this is an isolated issue which I doubt //d…

---

## [Vectors give me same data](https://discourse.processing.org/t/vectors-give-me-same-data/26054)

<div class="topic-metadata">

**Author:** [@Banana](https://discourse.processing.org/u/Banana)\
**Replies:** 4\
**Last updated:** [December 9, 2020, 11:01am UTC](https://discourse.processing.org/t/vectors-give-me-same-data/26054 "2020-12-09T11:01:56Z")

</div>

Hello everyone, i’m new here I want to make a slingshot that throws projectiles but i’m confronted to a problem with vector. The objectiv is to have a vector that stores the datas of the throw. “v3” Can you tell me wh…

---

## [Issues finding strings](https://discourse.processing.org/t/issues-finding-strings/26017)

<div class="topic-metadata">

**Author:** [@CodeMasterX](https://discourse.processing.org/u/CodeMasterX)\
**Replies:** 2\
**Last updated:** [December 7, 2020, 4:16pm UTC](https://discourse.processing.org/t/issues-finding-strings/26017 "2020-12-07T16:16:35Z")

</div>

Hi! I have some issues with the split() command and == “xyz”. I am currently creating a console like program, in which you can type “draw ellipse x y r1 r2”. However whenever I use String segments\[\] = split(command,' ')…

---

## [It keeps me waiting](https://discourse.processing.org/t/it-keeps-me-waiting/25883)

<div class="topic-metadata">

**Author:** [@muffininwinter](https://discourse.processing.org/u/muffininwinter)\
**Replies:** 2\
**Last updated:** [December 2, 2020, 12:17pm UTC](https://discourse.processing.org/t/it-keeps-me-waiting/25883 "2020-12-02T12:17:01Z")

</div>

It keeps loading, but never get the program running. Anyone knows what’s wrong with it? Thanks a lot!

---

## [Int that goes from 1 to 100](https://discourse.processing.org/t/int-that-goes-from-1-to-100/25873)

<div class="topic-metadata">

**Author:** [@denis](https://discourse.processing.org/u/denis)\
**Replies:** 5\
**Last updated:** [December 1, 2020, 10:21pm UTC](https://discourse.processing.org/t/int-that-goes-from-1-to-100/25873 "2020-12-01T22:21:24Z")

</div>

Hello everyone, Im trying to make an int that goes from the number 1 to 100, increasing one by one and then to reset and start again. I hope someone can help, Thanks!! D.

---

## [Calling arraylist object function on entire arraylist](https://discourse.processing.org/t/calling-arraylist-object-function-on-entire-arraylist/25813)

<div class="topic-metadata">

**Author:** [@ScriptKiddie](https://discourse.processing.org/u/ScriptKiddie)\
**Replies:** 1\
**Last updated:** [November 29, 2020, 5:14pm UTC](https://discourse.processing.org/t/calling-arraylist-object-function-on-entire-arraylist/25813 "2020-11-29T17:14:49Z")

</div>

Hi everyone, pseudocode below: class Class { void function() { instruction performed by object; } } ArrayList\<Class\> objectList = new ArrayList(100); for(int i = 0; i \< 100; i++) { objectList.get(i)…

---

## [Index out of bounds](https://discourse.processing.org/t/index-out-of-bounds/25775)

<div class="topic-metadata">

**Author:** [@ScriptKiddie](https://discourse.processing.org/u/ScriptKiddie)\
**Replies:** 4\
**Last updated:** [November 28, 2020, 9:27am UTC](https://discourse.processing.org/t/index-out-of-bounds/25775 "2020-11-28T09:27:30Z")

</div>

Hi everyone, I’m hoping I’m missing something simple here. I want to display an object (which works) and when my player entity collides with this object the object should disappear. My collision code works but once the …

---

## [Decimal into binary numbers](https://discourse.processing.org/t/decimal-into-binary-numbers/25758)

<div class="topic-metadata">

**Author:** [@Ellie98](https://discourse.processing.org/u/Ellie98)\
**Replies:** 2\
**Last updated:** [November 28, 2020, 6:40am UTC](https://discourse.processing.org/t/decimal-into-binary-numbers/25758 "2020-11-28T06:40:54Z")

</div>

Hey, i’m trying to convert the decimal numerbs into binary numbers but I get a lot of zeros in front of the binary numbers. How do I cut of the zeros? Thanks in advance! void setup() { //System.out.printf("Dez -\> Du…

---

## [Expecting EOF, found else](https://discourse.processing.org/t/expecting-eof-found-else/25759)

<div class="topic-metadata">

**Author:** [@muffininwinter](https://discourse.processing.org/u/muffininwinter)\
**Replies:** 2\
**Last updated:** [November 27, 2020, 8:01pm UTC](https://discourse.processing.org/t/expecting-eof-found-else/25759 "2020-11-27T20:01:41Z")

</div>

please format code with \</\> button \* homework policy \* asking questions boolean running = false; PImage imgbk; PImage imgm; PImage albert; PImage imgnote; String\[\] imageNames = { "albert0.jpg", "albert1.jpg" }; PI…

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

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