# Beginners

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

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

**Page:** 35

---

## [Why vector.nomalize() do not print 1?](https://discourse.processing.org/t/why-vector-nomalize-do-not-print-1/12770)

<div class="topic-metadata">

**Author:** [@andresobregonl](https://discourse.processing.org/u/andresobregonl)\
**Replies:** 4\
**Last updated:** [July 18, 2019, 3:53pm UTC](https://discourse.processing.org/t/why-vector-nomalize-do-not-print-1/12770 "2019-07-18T15:53:45Z")

</div>

// Ex 1.6 Normalizing a vector The Nature of Code void draw() { background(255); PVector mouse = new PVector(mouseX,mouseY); PVector center = new PVector(width/2,height/2); //sub() — subtract vectors mouse.sub(cent…

---

## [Help making code more concise](https://discourse.processing.org/t/help-making-code-more-concise/12734)

<div class="topic-metadata">

**Author:** [@r8th](https://discourse.processing.org/u/r8th)\
**Replies:** 8\
**Last updated:** [July 17, 2019, 2:56pm UTC](https://discourse.processing.org/t/help-making-code-more-concise/12734 "2019-07-17T14:56:57Z")

</div>

Dear community, I am trying to capture 2 seconds-worth of frames, every 30 minutes using a webcam. The following code works, but I feel that there must be a more concise way to write this. I’ve searched but cannot find …

---

## [Please help for very basic coding task](https://discourse.processing.org/t/please-help-for-very-basic-coding-task/12009)

<div class="topic-metadata">

**Author:** [@myhatzulu](https://discourse.processing.org/u/myhatzulu)\
**Replies:** 2\
**Last updated:** [July 15, 2019, 11:19pm UTC](https://discourse.processing.org/t/please-help-for-very-basic-coding-task/12009 "2019-07-15T23:19:35Z")

</div>

It keeps escaping me on how to do the following void setup(){ size(800,400); rect (width/2,height/2, ? , random(30,80)); } I need to make the figures body width twice the randomized body height, I don’t know how th…

---

## [Really embarrassing questions!](https://discourse.processing.org/t/really-embarrassing-questions/12676)

<div class="topic-metadata">

**Author:** [@femke.blanco](https://discourse.processing.org/u/femke.blanco)\
**Replies:** 4\
**Last updated:** [July 14, 2019, 9:39am UTC](https://discourse.processing.org/t/really-embarrassing-questions/12676 "2019-07-14T09:39:15Z")

</div>

setup(), draw() and ellipse(), for example, are all built-in functions with void return. Why do I need to write “void” before setup() and draw(), but not before ellipse()? Not writing “void” before setup() and draw() r…

---

## [A Bunch of Questions About Variables!](https://discourse.processing.org/t/a-bunch-of-questions-about-variables/12656)

<div class="topic-metadata">

**Author:** [@MoobleFloob](https://discourse.processing.org/u/MoobleFloob)\
**Replies:** 4\
**Last updated:** [July 11, 2019, 10:55am UTC](https://discourse.processing.org/t/a-bunch-of-questions-about-variables/12656 "2019-07-11T10:55:58Z")

</div>

This post is made in the hopes that some answers might be found for the following questions related to variables as a concept and in practice. This is by no means an exhaustive list of questions, but hopefully they gener…

---

## [Transform two int into one int](https://discourse.processing.org/t/transform-two-int-into-one-int/12604)

<div class="topic-metadata">

**Author:** [@hugo](https://discourse.processing.org/u/hugo)\
**Replies:** 3\
**Last updated:** [July 9, 2019, 9:54am UTC](https://discourse.processing.org/t/transform-two-int-into-one-int/12604 "2019-07-09T09:54:14Z")

</div>

Hello, I have two int variable that I would like to put end to end to form only one int variable : int a= 2, b= 3; int c=//I would like variable c to be equal to 23 Do you have an idea to solve my problem ? Thank you…

---

## [\[SOLVED\] Class problem with ArrayList](https://discourse.processing.org/t/solved-class-problem-with-arraylist/12475)

<div class="topic-metadata">

**Author:** [@Zephyr](https://discourse.processing.org/u/Zephyr)\
**Replies:** 7\
**Last updated:** [July 4, 2019, 6:14pm UTC](https://discourse.processing.org/t/solved-class-problem-with-arraylist/12475 "2019-07-04T18:14:46Z")

</div>

Hi, I’m a beginner on Processing (thanks to Coding Train btw). I love it and I’ve just achieved a prog about the Fourier decomposition (3Blue1Brown’s videos are really inspiring). I want now to “draw” in this Fourier sty…

---

## [Losing decimals](https://discourse.processing.org/t/losing-decimals/12442)

<div class="topic-metadata">

**Author:** [@Waboqueox](https://discourse.processing.org/u/Waboqueox)\
**Replies:** 2\
**Last updated:** [July 3, 2019, 7:14am UTC](https://discourse.processing.org/t/losing-decimals/12442 "2019-07-03T07:14:08Z")

</div>

Hi people!! I’m getting mad trying to get some points with a lot of decimals… Maybe this is a stupid question or I’m crazy… but I remember using lot of decimals, with float or double variable types (in java). I’m usin…

---

## [How shall I make get(mouseX, mouseY)) return RGB triplets](https://discourse.processing.org/t/how-shall-i-make-get-mousex-mousey-return-rgb-triplets/12364)

<div class="topic-metadata">

**Author:** [@andre](https://discourse.processing.org/u/andre)\
**Replies:** 2\
**Last updated:** [June 28, 2019, 6:03pm UTC](https://discourse.processing.org/t/how-shall-i-make-get-mousex-mousey-return-rgb-triplets/12364 "2019-06-28T18:03:03Z")

</div>

Tried to see pixels color using void mousePressed() { println(get(mouseX, mouseY));} It returns -1 for white spots, close to -16581375 on black spots and in between for the rest. How shall I get it as RGB triplets?

---

## [Error: cannot convert from float to int,, when I use map()](https://discourse.processing.org/t/error-cannot-convert-from-float-to-int-when-i-use-map/12315)

<div class="topic-metadata">

**Author:** [@bu.aus](https://discourse.processing.org/u/bu.aus)\
**Replies:** 2\
**Last updated:** [June 26, 2019, 6:09pm UTC](https://discourse.processing.org/t/error-cannot-convert-from-float-to-int-when-i-use-map/12315 "2019-06-26T18:09:42Z")

</div>

Hello, I am a beginner and finding a problem. I wrote the following code and had error message “cannot convert from float to int”. void serialEvent (Serial Port) { brightness = float(port.readStringUntil('\\n')); n=i…

---

## [PVector array filled with static data](https://discourse.processing.org/t/pvector-array-filled-with-static-data/12282)

<div class="topic-metadata">

**Author:** [@TTG](https://discourse.processing.org/u/TTG)\
**Replies:** 4\
**Last updated:** [June 25, 2019, 3:32pm UTC](https://discourse.processing.org/t/pvector-array-filled-with-static-data/12282 "2019-06-25T15:32:54Z")

</div>

Hi team, I have an issue regarding the correct way to assign PVector data in an array. the data is derived from earlier task (see image and code below), i only want to us the output as a PVector in an array (static co…

---

## [Array.length error](https://discourse.processing.org/t/array-length-error/12217)

<div class="topic-metadata">

**Author:** [@FlyingApple](https://discourse.processing.org/u/FlyingApple)\
**Replies:** 6\
**Last updated:** [June 21, 2019, 12:27pm UTC](https://discourse.processing.org/t/array-length-error/12217 "2019-06-21T12:27:45Z")

</div>

Whenever I do the array.length function I get the error "The global variable “length” does not exist. for (int i = 0; i \< walls.length; i++) { Wall wall = walls.get(i); wall.show(); } walls is an array of the…

---

## [Hover color change](https://discourse.processing.org/t/hover-color-change/12169)

<div class="topic-metadata">

**Author:** [@srishtiverma](https://discourse.processing.org/u/srishtiverma)\
**Replies:** 3\
**Last updated:** [June 19, 2019, 3:04pm UTC](https://discourse.processing.org/t/hover-color-change/12169 "2019-06-19T15:04:19Z")

</div>

Hello! I’m a Processing beginner. Trying to make (a few) circles and rectangles in the 100 pixel radius of the mouse coordinates change color (and maybe even move, once I have the color change down) It says “b cannot b…

---

## [Double to float](https://discourse.processing.org/t/double-to-float/12178)

<div class="topic-metadata">

**Author:** [@programmingNoob](https://discourse.processing.org/u/programmingNoob)\
**Replies:** 2\
**Last updated:** [June 19, 2019, 11:52am UTC](https://discourse.processing.org/t/double-to-float/12178 "2019-06-19T11:52:02Z")

</div>

I’m having issues with finding total velocity instead of having xVelocity and yVelocity. Would the correct strategy be to find the square root of the squares added, like with hypotenuses, or some other strategy? Here’s m…

---

## [Looks like your mixing static and active modes](https://discourse.processing.org/t/looks-like-your-mixing-static-and-active-modes/12137)

<div class="topic-metadata">

**Author:** [@er45](https://discourse.processing.org/u/er45)\
**Replies:** 2\
**Last updated:** [June 17, 2019, 8:58pm UTC](https://discourse.processing.org/t/looks-like-your-mixing-static-and-active-modes/12137 "2019-06-17T20:58:19Z")

</div>

I cannot get processing three to put text on the screen. I get "looks like your mixing static and active modes. Can any one help? Thanks! Ed Code: int rainfall\[\] = {2, 3, 5, 1, 4, 6, 7, 2, 1}; float average(int\[\] dat…

---

## [What's the symbol for "the power of 2"](https://discourse.processing.org/t/whats-the-symbol-for-the-power-of-2/12070)

<div class="topic-metadata">

**Author:** [@osibada](https://discourse.processing.org/u/osibada)\
**Replies:** 4\
**Last updated:** [June 15, 2019, 2:35pm UTC](https://discourse.processing.org/t/whats-the-symbol-for-the-power-of-2/12070 "2019-06-15T14:35:30Z")

</div>

How to print the symbol (^2) in text for Processing 3? Thanks for the help.

---

## [How to use this code with mousePressed?](https://discourse.processing.org/t/how-to-use-this-code-with-mousepressed/11925)

<div class="topic-metadata">

**Author:** [@joysaha573](https://discourse.processing.org/u/joysaha573)\
**Replies:** 4\
**Last updated:** [June 8, 2019, 6:10pm UTC](https://discourse.processing.org/t/how-to-use-this-code-with-mousepressed/11925 "2019-06-08T18:10:21Z")

</div>

I want to appear this circile when mouse is pressed only. Please help with this float angle = 0.00; float offset = 60 ; float scalar = 30; float speed = 0.05; void setup () { size (120, 120);…

---

## [Variables With Circles](https://discourse.processing.org/t/variables-with-circles/11875)

<div class="topic-metadata">

**Author:** [@Theikercf75](https://discourse.processing.org/u/Theikercf75)\
**Replies:** 1\
**Last updated:** [June 5, 2019, 9:06pm UTC](https://discourse.processing.org/t/variables-with-circles/11875 "2019-06-05T21:06:38Z")

</div>

I want to make an X with circles every 20 pixels in a box of 300 x 300 but I only get a line of circles. That I’m failing with this one. void setup() { size(300, 300); strokeWeight(20); for (int a=0 ; a\<300 ; a=a+…

---

## [nullPointerExeption](https://discourse.processing.org/t/nullpointerexeption/11741)

<div class="topic-metadata">

**Author:** [@programmingNoob](https://discourse.processing.org/u/programmingNoob)\
**Replies:** 3\
**Last updated:** [May 31, 2019, 4:59pm UTC](https://discourse.processing.org/t/nullpointerexeption/11741 "2019-05-31T16:59:04Z")

</div>

I’m working on creating bullets for a remake of diep.io, but am new to arrays. I received an error that said nullPointerExeption, and looked it up to find out what I did wrong, but found that it means my array hasn’t bee…

---

## [Importing libraries into classes](https://discourse.processing.org/t/importing-libraries-into-classes/11710)

<div class="topic-metadata">

**Author:** [@InferNova](https://discourse.processing.org/u/InferNova)\
**Replies:** 5\
**Last updated:** [May 30, 2019, 7:29pm UTC](https://discourse.processing.org/t/importing-libraries-into-classes/11710 "2019-05-30T19:29:43Z")

</div>

Hey there! I have been running into an issue where I would like to import a library into a file but when I do make the file and my own class it doesn’t recognize that the library is imported and doesn’t let me use what …

---

## [Having trouble with ArrayList cant find an answer](https://discourse.processing.org/t/having-trouble-with-arraylist-cant-find-an-answer/11546)

<div class="topic-metadata">

**Author:** [@BL4K](https://discourse.processing.org/u/BL4K)\
**Replies:** 6\
**Last updated:** [May 26, 2019, 2:23pm UTC](https://discourse.processing.org/t/having-trouble-with-arraylist-cant-find-an-answer/11546 "2019-05-26T14:23:16Z")

</div>

I am getting "The function hits() does not expect parameters for (int i=bullet.size()-1;i\>0;i--){ b.display(); b.update(); for (int j=asteroid.size()-1;j\>0;j--){ if(bullet.get(i).hits(asteroid.get(i)…

---

## [Save/restore system attribute](https://discourse.processing.org/t/save-restore-system-attribute/11364)

<div class="topic-metadata">

**Author:** [@timdoodle](https://discourse.processing.org/u/timdoodle)\
**Replies:** 5\
**Last updated:** [May 22, 2019, 12:24pm UTC](https://discourse.processing.org/t/save-restore-system-attribute/11364 "2019-05-22T12:24:02Z")

</div>

I see how to set the values for many system attributes, but I don’t see how to obtain the current value of a system attribute. For example, one can set the color to fill shapes via fill(), but how does one determine the …

---

## [Convert to array; then variable i does not exist error message](https://discourse.processing.org/t/convert-to-array-then-variable-i-does-not-exist-error-message/11426)

<div class="topic-metadata">

**Author:** [@debxyz](https://discourse.processing.org/u/debxyz)\
**Replies:** 13\
**Last updated:** [May 21, 2019, 2:22am UTC](https://discourse.processing.org/t/convert-to-array-then-variable-i-does-not-exist-error-message/11426 "2019-05-21T02:22:17Z")

</div>

I converted this from a single instance of each object to implement 2 arrays of multiple ball objects + donut objects. I get the error message the variable i does not exist. Both arrays have been initialized in setup()…

---

## [How do I stop an if-statement from carrying over to the next function](https://discourse.processing.org/t/how-do-i-stop-an-if-statement-from-carrying-over-to-the-next-function/11309)

<div class="topic-metadata">

**Author:** [@debxyz](https://discourse.processing.org/u/debxyz)\
**Replies:** 6\
**Last updated:** [May 16, 2019, 8:46pm UTC](https://discourse.processing.org/t/how-do-i-stop-an-if-statement-from-carrying-over-to-the-next-function/11309 "2019-05-16T20:46:14Z")

</div>

I would like the ball to bounce along the x-axis; the donut to bounce along the y-axis. Currently the ball movement is fine. The donut movement is following the if-statement for the ball as well as the donut. How do I…

---

## [Calculation for variables in D. Shiffman book "Learning Processing"](https://discourse.processing.org/t/calculation-for-variables-in-d-shiffman-book-learning-processing/11286)

<div class="topic-metadata">

**Author:** [@debxyz](https://discourse.processing.org/u/debxyz)\
**Replies:** 2\
**Last updated:** [May 15, 2019, 9:29pm UTC](https://discourse.processing.org/t/calculation-for-variables-in-d-shiffman-book-learning-processing/11286 "2019-05-15T21:29:35Z")

</div>

I’m trying to get a better understanding on how Dan Shiffman drew his raindrop shape via the variables below AND the starting y position. Any help is most appreciated! Text in bold placed next to the 3 areas in questio…

---

## [Unsigned types and cast](https://discourse.processing.org/t/unsigned-types-and-cast/11285)

<div class="topic-metadata">

**Author:** [@lve0200](https://discourse.processing.org/u/lve0200)\
**Replies:** 1\
**Last updated:** [May 15, 2019, 8:42pm UTC](https://discourse.processing.org/t/unsigned-types-and-cast/11285 "2019-05-15T20:42:25Z")

</div>

Hi, is there anything like unsigned, e.g. unsigned int? … or how to treat numbers which would after conversion long -\> int normally fall into minus?? Is there anything like cast e.g. int COG = (int) location.getBear…

---

## [How to detect display configuration?](https://discourse.processing.org/t/how-to-detect-display-configuration/9169)

<div class="topic-metadata">

**Author:** [@xtupof](https://discourse.processing.org/u/xtupof)\
**Replies:** 6\
**Last updated:** [May 14, 2019, 9:52pm UTC](https://discourse.processing.org/t/how-to-detect-display-configuration/9169 "2019-05-14T21:52:20Z")

</div>

Hi there, I’m switching again and again from my home station with multiple screens to my laptop… At home, I use the fullScreen(3) option, but working on my laptop screen I mostly use size(640,360). Rather than always c…

---

## [Why is my button placed like that?](https://discourse.processing.org/t/why-is-my-button-placed-like-that/11165)

<div class="topic-metadata">

**Author:** [@anna](https://discourse.processing.org/u/anna)\
**Replies:** 2\
**Last updated:** [May 12, 2019, 11:36am UTC](https://discourse.processing.org/t/why-is-my-button-placed-like-that/11165 "2019-05-12T11:36:56Z")

</div>

I have: void setup() { size(1250,800); } and I would like my button: rect(495,500,260,260,35); to be placed in the middle of the screen. So I thought I could make a button rect(button2X, buttonY, buttonSize, b…

---

## [Functions argument](https://discourse.processing.org/t/functions-argument/11010)

<div class="topic-metadata">

**Author:** [@Reggi](https://discourse.processing.org/u/Reggi)\
**Replies:** 5\
**Last updated:** [May 12, 2019, 10:14am UTC](https://discourse.processing.org/t/functions-argument/11010 "2019-05-12T10:14:31Z")

</div>

Hi how can I return two values from a void function? I have already used c++ and there you could use & in these situations. Is there something like this in processing? void example (char c, int a, int b){ if(c=='y'…

---

## [Random Images loop](https://discourse.processing.org/t/random-images-loop/11159)

<div class="topic-metadata">

**Author:** [@bkielak](https://discourse.processing.org/u/bkielak)\
**Replies:** 2\
**Last updated:** [May 12, 2019, 10:04am UTC](https://discourse.processing.org/t/random-images-loop/11159 "2019-05-12T10:04:51Z")

</div>

Hi guys, I’m a graphic designer and I’m currently working on the project in regards to the computation so I wanted to create randomized images overlap in processing. So far I made a basic code but it doesn’t really work…

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

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