# Beginners

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

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

**Page:** 29

---

## [Datatype for color](https://discourse.processing.org/t/datatype-for-color/19427)

<div class="topic-metadata">

**Author:** [@hartelius](https://discourse.processing.org/u/hartelius)\
**Replies:** 1\
**Last updated:** [April 5, 2020, 11:43am UTC](https://discourse.processing.org/t/datatype-for-color/19427 "2020-04-05T11:43:42Z")

</div>

Why does this print FF000000 and not 000000? color setC = color(0, 0, 0); println(hex(setC));

---

## [Print Ordered Numbers in Program](https://discourse.processing.org/t/print-ordered-numbers-in-program/19386)

<div class="topic-metadata">

**Author:** [@TeaTea](https://discourse.processing.org/u/TeaTea)\
**Replies:** 3\
**Last updated:** [April 5, 2020, 10:06am UTC](https://discourse.processing.org/t/print-ordered-numbers-in-program/19386 "2020-04-05T10:06:09Z")

</div>

hello anyone who reads this :smile: i’m new to coding, i am trying to create things to practice coding, so i went to this page : http://www.beginwithjava.com/java/loops/questions.html because i saw that in processing,…

---

## [Rotating objects inside the canvas](https://discourse.processing.org/t/rotating-objects-inside-the-canvas/19387)

<div class="topic-metadata">

**Author:** [@eltrem](https://discourse.processing.org/u/eltrem)\
**Replies:** 3\
**Last updated:** [April 4, 2020, 3:44pm UTC](https://discourse.processing.org/t/rotating-objects-inside-the-canvas/19387 "2020-04-04T15:44:04Z")

</div>

I’m missuderstanding the combination of translate(), rotate(), pushmatrix() and popmatrix(); In the example, I’m trying to rotate the sinus functions after translating the matrix to its origin, but obviosuly there’s ma…

---

## [Self made class, not returning when it a loop?](https://discourse.processing.org/t/self-made-class-not-returning-when-it-a-loop/19220)

<div class="topic-metadata">

**Author:** [@Aldiery](https://discourse.processing.org/u/Aldiery)\
**Replies:** 2\
**Last updated:** [April 4, 2020, 2:04am UTC](https://discourse.processing.org/t/self-made-class-not-returning-when-it-a-loop/19220 "2020-04-04T02:04:36Z")

</div>

Ship findShip(int\[\] coordinates){ for (int i = 0; i \< ships.size();i++){ Ship ship = ships.get(i); int shipX = ship.x; int shipY = ship.y; for (int tile = 0; tile \< ship.size; tile++){ if (ship.ro…

---

## [What does add() do?](https://discourse.processing.org/t/what-does-add-do/19356)

<div class="topic-metadata">

**Author:** [@Cybernet](https://discourse.processing.org/u/Cybernet)\
**Replies:** 3\
**Last updated:** [April 3, 2020, 3:04am UTC](https://discourse.processing.org/t/what-does-add-do/19356 "2020-04-03T03:04:07Z")

</div>

So I have a code: class Projectile extends PVector { PVector velocity; Projectile(PVector loc, PVector vel) { super(loc.x, loc.y); velocity = vel; } void Display() { add(velocity); // what…

---

## [ArrayList of Arrays for Interactive Shapes](https://discourse.processing.org/t/arraylist-of-arrays-for-interactive-shapes/19336)

<div class="topic-metadata">

**Author:** [@jaschag](https://discourse.processing.org/u/jaschag)\
**Replies:** 6\
**Last updated:** [April 2, 2020, 4:46pm UTC](https://discourse.processing.org/t/arraylist-of-arrays-for-interactive-shapes/19336 "2020-04-02T16:46:18Z")

</div>

I have created an ArrayList of arrays. Each array in the ArrayList should contain the mouseX and mouseY positions for one drawing frame. The ArrayList is to be expanded by one element(array) each frame. However, when ac…

---

## [Quit program from JOptionpane](https://discourse.processing.org/t/quit-program-from-joptionpane/18396)

<div class="topic-metadata">

**Author:** [@NotConsumable](https://discourse.processing.org/u/NotConsumable)\
**Replies:** 1\
**Last updated:** [March 5, 2020, 12:46am UTC](https://discourse.processing.org/t/quit-program-from-joptionpane/18396 "2020-03-05T00:46:44Z")

</div>

I am wondering if it is an if statement or a loop along side a pre determined string in order to make the exit(); function run specifically when a certain phrase is typed into the message box in JOptionpane.showInputDia…

---

## [Is text align local?](https://discourse.processing.org/t/is-text-align-local/19158)

<div class="topic-metadata">

**Author:** [@Cybernet](https://discourse.processing.org/u/Cybernet)\
**Replies:** 6\
**Last updated:** [April 1, 2020, 10:20am UTC](https://discourse.processing.org/t/is-text-align-local/19158 "2020-04-01T10:20:22Z")

</div>

So if I put textAlign(LEFT) inside a function, will it only be that function, or the entire code? void Function() { textAlign(LEFT); }

---

## [How do I save this as a video, without background?](https://discourse.processing.org/t/how-do-i-save-this-as-a-video-without-background/19174)

<div class="topic-metadata">

**Author:** [@noa\_noa](https://discourse.processing.org/u/noa_noa)\
**Replies:** 2\
**Last updated:** [March 31, 2020, 7:57am UTC](https://discourse.processing.org/t/how-do-i-save-this-as-a-video-without-background/19174 "2020-03-31T07:57:20Z")

</div>

This is My code (where do i add the saveFrames()? or what do I add?: void setup() { background(600); size(800, 800); } void draw() { background(255); stroke(0); strokeWeight(1.4); scale(0.8); translat…

---

## [Mousepressed variable does not exist?](https://discourse.processing.org/t/mousepressed-variable-does-not-exist/19144)

<div class="topic-metadata">

**Author:** [@rozer](https://discourse.processing.org/u/rozer)\
**Replies:** 5\
**Last updated:** [March 29, 2020, 4:47pm UTC](https://discourse.processing.org/t/mousepressed-variable-does-not-exist/19144 "2020-03-29T16:47:12Z")

</div>

Hello, When using the code below, the IDE marks mousePressed red and the error message is "expecting LPAREN, found ‘mousePressed’ Looking around did not help me so far. I am using version 3.5.4. Thanks, Stephan if (…

---

## [App to Draw Straight Lines](https://discourse.processing.org/t/app-to-draw-straight-lines/19139)

<div class="topic-metadata">

**Author:** [@Tizzer](https://discourse.processing.org/u/Tizzer)\
**Replies:** 1\
**Last updated:** [March 29, 2020, 3:12pm UTC](https://discourse.processing.org/t/app-to-draw-straight-lines/19139 "2020-03-29T15:12:24Z")

</div>

Hi, I’m trying to write some code that will allow me to draw straight lines based on when I press (mousePressed) and release or drag the mouse. (Any of you who have used say AutoCad or similar will know the type of func…

---

## [My decimal is too small](https://discourse.processing.org/t/my-decimal-is-too-small/19041)

<div class="topic-metadata">

**Author:** [@Cybernet](https://discourse.processing.org/u/Cybernet)\
**Replies:** 8\
**Last updated:** [March 27, 2020, 9:06am UTC](https://discourse.processing.org/t/my-decimal-is-too-small/19041 "2020-03-27T09:06:12Z")

</div>

Here is my example of my code: value = -1 / (value1 - value2); println(xdirection); It is very simple. I am trying to take the negative reciprocal of a value. But the number is too small, and when I try to print the v…

---

## [ArrayIndexOutOfBoundsException: 168270](https://discourse.processing.org/t/arrayindexoutofboundsexception-168270/19057)

<div class="topic-metadata">

**Author:** [@jojo1515](https://discourse.processing.org/u/jojo1515)\
**Replies:** 2\
**Last updated:** [March 26, 2020, 10:07pm UTC](https://discourse.processing.org/t/arrayindexoutofboundsexception-168270/19057 "2020-03-26T22:07:06Z")

</div>

Hey guys I have been trying to manipulate pixels on an image, following the youtube tutorial: https://www.youtube.com/watch?v=j-ZLDEnhT3Q by the Coding Train. I can’t seem to get it to work. Error code reads… ArrayInde…

---

## [If statements within an array of digits](https://discourse.processing.org/t/if-statements-within-an-array-of-digits/18507)

<div class="topic-metadata">

**Author:** [@MichelO](https://discourse.processing.org/u/MichelO)\
**Replies:** 6\
**Last updated:** [March 26, 2020, 7:54pm UTC](https://discourse.processing.org/t/if-statements-within-an-array-of-digits/18507 "2020-03-26T19:54:40Z")

</div>

I am trying to have different things happen depending on what digit is called in an array–in this case, different colored lines. I am not sure how to code the if statement to recognize a particular digit. This is what I …

---

## [Order of using mult(0) & add() for vectors in processing](https://discourse.processing.org/t/order-of-using-mult-0-add-for-vectors-in-processing/18925)

<div class="topic-metadata">

**Author:** [@Ruchi](https://discourse.processing.org/u/Ruchi)\
**Replies:** 3\
**Last updated:** [March 24, 2020, 8:31am UTC](https://discourse.processing.org/t/order-of-using-mult-0-add-for-vectors-in-processing/18925 "2020-03-24T08:31:45Z")

</div>

I am sorry in advance if this is a trivial question as I am confused with the output displayed. void setup(){ size(800,800); } void draw(){ background(0); //PVector v = PVector.fromAngle(PI); PVector v = new …

---

## [Byte array contains ints?](https://discourse.processing.org/t/byte-array-contains-ints/18902)

<div class="topic-metadata">

**Author:** [@yes](https://discourse.processing.org/u/yes)\
**Replies:** 1\
**Last updated:** [March 22, 2020, 3:40pm UTC](https://discourse.processing.org/t/byte-array-contains-ints/18902 "2020-03-22T15:40:35Z")

</div>

When I run this code, Processing thinks that some of these are ints when they are bytes. How can I fix this? byte\[\] logo = {0xCE, 0xED, 0x66, 0x66, 0xCC, 0x0D, 0x00, 0x0B, 0x03, 0x73, 0x00, 0x83, 0x00, 0x0C, 0x00, 0x0D,…

---

## [Ask simple questions about arrays~~thinks~~](https://discourse.processing.org/t/ask-simple-questions-about-arrays-thinks/18675)

<div class="topic-metadata">

**Author:** [@KEEP](https://discourse.processing.org/u/KEEP)\
**Replies:** 16\
**Last updated:** [March 22, 2020, 3:09am UTC](https://discourse.processing.org/t/ask-simple-questions-about-arrays-thinks/18675 "2020-03-22T03:09:34Z")

</div>

QUESTION\_1：Why does this code work out to be 0000000000，it isn’t 46810… :thinking: int \[\] values\_1 = new int \[10\]; for (int i = 1; i \< values\_1.length; i++){ values\_1\[i\] = values\_1\[i\] \* 2; print(values\_1\[i\]); } QUE…

---

## [Return an array of values from a loop](https://discourse.processing.org/t/return-an-array-of-values-from-a-loop/18857)

<div class="topic-metadata">

**Author:** [@mrbro](https://discourse.processing.org/u/mrbro)\
**Replies:** 4\
**Last updated:** [March 21, 2020, 9:42am UTC](https://discourse.processing.org/t/return-an-array-of-values-from-a-loop/18857 "2020-03-21T09:42:55Z")

</div>

Hi there! I just started using processing, and I am very new to coding. I am struggling with scope or arrays, im not even sure. I create an array of points, and paint them by using Perlin Noise. However, I want to us…

---

## [Help creating an ArrayList of color values](https://discourse.processing.org/t/help-creating-an-arraylist-of-color-values/18475)

<div class="topic-metadata">

**Author:** [@Eyetoof](https://discourse.processing.org/u/Eyetoof)\
**Replies:** 24\
**Last updated:** [March 19, 2020, 8:49pm UTC](https://discourse.processing.org/t/help-creating-an-arraylist-of-color-values/18475 "2020-03-19T20:49:14Z")

</div>

Hello - I am trying to create an ArrayList of color values so I can utilize the features it has for dynamically slotting values in and out at various places. But as color is a primitive data type, it will not work in an…

---

## [Not sure why interface and implementation is not working](https://discourse.processing.org/t/not-sure-why-interface-and-implementation-is-not-working/18736)

<div class="topic-metadata">

**Author:** [@jeromepayne](https://discourse.processing.org/u/jeromepayne)\
**Replies:** 4\
**Last updated:** [March 18, 2020, 2:22pm UTC](https://discourse.processing.org/t/not-sure-why-interface-and-implementation-is-not-working/18736 "2020-03-18T14:22:20Z")

</div>

Can you all take a look at my code and tell me where I am going wrong? interface IBeacon { // Determines whether beacon is within range of truck Boolean isPresent(); // Determines how for beacon is from truck int g…

---

## [Spawn a shape or object whenever the initial object reaches a specific locaton](https://discourse.processing.org/t/spawn-a-shape-or-object-whenever-the-initial-object-reaches-a-specific-locaton/18737)

<div class="topic-metadata">

**Author:** [@NotConsumable](https://discourse.processing.org/u/NotConsumable)\
**Replies:** 2\
**Last updated:** [March 17, 2020, 3:45pm UTC](https://discourse.processing.org/t/spawn-a-shape-or-object-whenever-the-initial-object-reaches-a-specific-locaton/18737 "2020-03-17T15:45:20Z")

</div>

I have an ellipse moving across the screen with ellipse(redBallX,redBallY,40,40); redBallX = redBallX +1; I was wondering how I would make it so that when the X value of the ball hits 50 pixels across the screen as the…

---

## [If equality not workin properly](https://discourse.processing.org/t/if-equality-not-workin-properly/18627)

<div class="topic-metadata">

**Author:** [@LixoEletronico](https://discourse.processing.org/u/LixoEletronico)\
**Replies:** 3\
**Last updated:** [March 17, 2020, 12:41am UTC](https://discourse.processing.org/t/if-equality-not-workin-properly/18627 "2020-03-17T00:41:39Z")

</div>

i can’t find anything wrong here

---

## [Combining sketches](https://discourse.processing.org/t/combining-sketches/18265)

<div class="topic-metadata">

**Author:** [@GKBeginner](https://discourse.processing.org/u/GKBeginner)\
**Replies:** 3\
**Last updated:** [March 8, 2020, 11:23pm UTC](https://discourse.processing.org/t/combining-sketches/18265 "2020-03-08T23:23:40Z")

</div>

Is there an easy way to combine sketches if the canvas size and background are the same?

---

## [How to round numbers to two decimal points?](https://discourse.processing.org/t/how-to-round-numbers-to-two-decimal-points/18506)

<div class="topic-metadata">

**Author:** [@anon94203042](https://discourse.processing.org/u/anon94203042)\
**Replies:** 1\
**Last updated:** [March 8, 2020, 6:13pm UTC](https://discourse.processing.org/t/how-to-round-numbers-to-two-decimal-points/18506 "2020-03-08T18:13:42Z")

</div>

Is there a way to do that? I need it for money transactions. For example: 10 -\> 10.00 10.5 -\> 10.50 10.55 -\> 10.55 10.555 -\> 10.56 10.554 -\> 10.55

---

## [Error in my code :(](https://discourse.processing.org/t/error-in-my-code/18468)

<div class="topic-metadata">

**Author:** [@noahgabeschaun](https://discourse.processing.org/u/noahgabeschaun)\
**Replies:** 4\
**Last updated:** [March 7, 2020, 10:38pm UTC](https://discourse.processing.org/t/error-in-my-code/18468 "2020-03-07T22:38:53Z")

</div>

I’ve just recently started coding and it says “unexcpected token: void” what’s up with my code? (it’s not finished yet, i’m just trying to run it) Star\[\] stars = new Star\[100\] void setup() { size(400,400); for (int i…

---

## [Constant rounding](https://discourse.processing.org/t/constant-rounding/18449)

<div class="topic-metadata">

**Author:** [@immorom](https://discourse.processing.org/u/immorom)\
**Replies:** 1\
**Last updated:** [March 6, 2020, 2:17pm UTC](https://discourse.processing.org/t/constant-rounding/18449 "2020-03-06T14:17:27Z")

</div>

Why does this happen?

---

## [Animated prototype of interface](https://discourse.processing.org/t/animated-prototype-of-interface/18409)

<div class="topic-metadata">

**Author:** [@eugenie](https://discourse.processing.org/u/eugenie)\
**Replies:** 5\
**Last updated:** [March 5, 2020, 6:49pm UTC](https://discourse.processing.org/t/animated-prototype-of-interface/18409 "2020-03-05T18:49:18Z")

</div>

Hello everybody :slight\_smile: Sory for my English For my internship, I have to try to present different animated prototypes interface. I was advised to use “processing” to design these prototypes. The point is that I …

---

## [Text(); questions. Color and other](https://discourse.processing.org/t/text-questions-color-and-other/18174)

<div class="topic-metadata">

**Author:** [@NoName](https://discourse.processing.org/u/NoName)\
**Replies:** 5\
**Last updated:** [March 4, 2020, 8:30pm UTC](https://discourse.processing.org/t/text-questions-color-and-other/18174 "2020-03-04T20:30:35Z")

</div>

Hello. Just a few questions. I know that you can paste text to a new line in text (); But I could not figure out how to do this? Can a simple example, I’ll figure it out. The question is also about text (); Is …

---

## ["active" and "static" mode on simple code](https://discourse.processing.org/t/active-and-static-mode-on-simple-code/18151)

<div class="topic-metadata">

**Author:** [@gillian](https://discourse.processing.org/u/gillian)\
**Replies:** 7\
**Last updated:** [March 4, 2020, 7:57pm UTC](https://discourse.processing.org/t/active-and-static-mode-on-simple-code/18151 "2020-03-04T19:57:46Z")

</div>

I have a student who is getting the active and static mode error screen. I retyped the same code into my own computer, and it runs fine. It’s the most basic program, but I’m at a complete loss on how to help. I had he…

---

## [Trying to use coordinates from an array to draw an ellipse gives "The method ellipse(float, float, float, float) in the type PApplet is not applicable for the arguments (float\[\], float\[\], float, float)"](https://discourse.processing.org/t/trying-to-use-coordinates-from-an-array-to-draw-an-ellipse-gives-the-method-ellipse-float-float-float-float-in-the-type-papplet-is-not-applicable-for-the-arguments-float-float-float-float/18306)

<div class="topic-metadata">

**Author:** [@Dadagnos](https://discourse.processing.org/u/Dadagnos)\
**Replies:** 5\
**Last updated:** [March 3, 2020, 9:17pm UTC](https://discourse.processing.org/t/trying-to-use-coordinates-from-an-array-to-draw-an-ellipse-gives-the-method-ellipse-float-float-float-float-in-the-type-papplet-is-not-applicable-for-the-arguments-float-float-float-float/18306 "2020-03-03T21:17:22Z")

</div>

So at school we are learning to program now using processing, and one of the homework assignments is to draw several ellipses using a preformatted piece of code: int\[\]\[\] circles = { {10, 15}, {100, 130}, {77, 43}, {30, …

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

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