# Beginners

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

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

**Page:** 27

---

## [Overloading functions: is there anyway to overload functions if they take arraylists?](https://discourse.processing.org/t/overloading-functions-is-there-anyway-to-overload-functions-if-they-take-arraylists/22169)

<div class="topic-metadata">

**Author:** [@paulgoux](https://discourse.processing.org/u/paulgoux)\
**Replies:** 1\
**Last updated:** [June 26, 2020, 2:16am UTC](https://discourse.processing.org/t/overloading-functions-is-there-anyway-to-overload-functions-if-they-take-arraylists/22169 "2020-06-26T02:16:17Z")

</div>

the following fails at compile time and says they’res a duplicate function, void saveData(ArrayList\<String\> a){ if(click){ for(int i=0;i\<a.size();i++) output.println(a.get(i)); saveTo(); } …

---

## [Shiffman Learning Processing EXERCISE Answers?](https://discourse.processing.org/t/shiffman-learning-processing-exercise-answers/19395)

<div class="topic-metadata">

**Author:** [@Eyetoof](https://discourse.processing.org/u/Eyetoof)\
**Replies:** 7\
**Last updated:** [June 24, 2020, 8:13pm UTC](https://discourse.processing.org/t/shiffman-learning-processing-exercise-answers/19395 "2020-06-24T20:13:10Z")

</div>

Hello I am using D Shifmans Learning Processing text. I know I can find all the sketches on line, but I wonder if anyone has posted answers to the exersizes throughout the book? I suppose if it works, its the right an…

---

## [Pshape ... not in shape](https://discourse.processing.org/t/pshape-not-in-shape/22125)

<div class="topic-metadata">

**Author:** [@klap](https://discourse.processing.org/u/klap)\
**Replies:** 1\
**Last updated:** [June 24, 2020, 7:59pm UTC](https://discourse.processing.org/t/pshape-not-in-shape/22125 "2020-06-24T19:59:49Z")

</div>

Why is the droplet working with the code which is commented out and not in the Pshape version? //fill(0, 0, 255); //beginShape(); //vertex(50, 10); //bezierVertex(50, 10, 5, 50, 50, 60); //bezierVertex(70, 50, 70, 30, …

---

## [Game or Animation with my char](https://discourse.processing.org/t/game-or-animation-with-my-char/22109)

<div class="topic-metadata">

**Author:** [@Helix1221](https://discourse.processing.org/u/Helix1221)\
**Replies:** 1\
**Last updated:** [June 23, 2020, 8:50pm UTC](https://discourse.processing.org/t/game-or-animation-with-my-char/22109 "2020-06-23T20:50:20Z")

</div>

Hey guys can you help me make a game or a animation with my char, i just need a simple game and small in termes of coding. tks a lot my char code ; float DarkzeroX = 300; float DarkzeroY = 300; //start size(900, 80…

---

## [Mouse inside custome shape](https://discourse.processing.org/t/mouse-inside-custome-shape/22110)

<div class="topic-metadata">

**Author:** [@jensemand](https://discourse.processing.org/u/jensemand)\
**Replies:** 2\
**Last updated:** [June 23, 2020, 6:05pm UTC](https://discourse.processing.org/t/mouse-inside-custome-shape/22110 "2020-06-23T18:05:03Z")

</div>

Hi, i’m trying to get into programming again and a stubbled upon a little problem. I was trying to create a hexagon but I can’t figure out a smart way to detect when my mouse is inside of the shape. Any good ideas? voi…

---

## [Why doesn't this work?](https://discourse.processing.org/t/why-doesnt-this-work/22097)

<div class="topic-metadata">

**Author:** [@mirthe24](https://discourse.processing.org/u/mirthe24)\
**Replies:** 1\
**Last updated:** [June 23, 2020, 4:27pm UTC](https://discourse.processing.org/t/why-doesnt-this-work/22097 "2020-06-23T16:27:24Z")

</div>

import processing.serial.\*; import processing.sound.\*; SoundFile file; Serial myPort; // Create object from Serial class String val; // Data received from the serial port //String antwoord = "A"; void setup() { s…

---

## [Can anyone explain why this doesn't work?](https://discourse.processing.org/t/can-anyone-explain-why-this-doesnt-work/22092)

<div class="topic-metadata">

**Author:** [@qewer3322](https://discourse.processing.org/u/qewer3322)\
**Replies:** 7\
**Last updated:** [June 23, 2020, 2:12pm UTC](https://discourse.processing.org/t/can-anyone-explain-why-this-doesnt-work/22092 "2020-06-23T14:12:38Z")

</div>

Hey! I’m new to java and processing. I decided to follow a snake game tutorial for processing on youtube. After making it, I added some stuff myself and I also want to add a pause screen. So wrote thes to pause the game …

---

## [Find only specific colors in a given range](https://discourse.processing.org/t/find-only-specific-colors-in-a-given-range/22090)

<div class="topic-metadata">

**Author:** [@Morzin](https://discourse.processing.org/u/Morzin)\
**Replies:** 1\
**Last updated:** [June 23, 2020, 12:44pm UTC](https://discourse.processing.org/t/find-only-specific-colors-in-a-given-range/22090 "2020-06-23T12:44:44Z")

</div>

Hi, I’m trying to make a program that only finds and selects pixels from a specific palette. I came up with the idea that the program should only take into account pixels with an H value of 20 ° - 55 ° (I mean yellow) …

---

## [Why is contour not working here](https://discourse.processing.org/t/why-is-contour-not-working-here/22038)

<div class="topic-metadata">

**Author:** [@klap](https://discourse.processing.org/u/klap)\
**Replies:** 1\
**Last updated:** [June 21, 2020, 6:09pm UTC](https://discourse.processing.org/t/why-is-contour-not-working-here/22038 "2020-06-21T18:09:50Z")

</div>

why is contour not working here? I would expect to see a cutout. size(100, 100); background(0); stroke(255); strokeWeight(2); line(33, 0, 85, 100); noStroke(); fill(102); beginShape(); vertex(10, 10); vertex(10, 100); v…

---

## [Making a shape move](https://discourse.processing.org/t/making-a-shape-move/22026)

<div class="topic-metadata">

**Author:** [@klap](https://discourse.processing.org/u/klap)\
**Replies:** 1\
**Last updated:** [June 20, 2020, 2:58pm UTC](https://discourse.processing.org/t/making-a-shape-move/22026 "2020-06-20T14:58:50Z")

</div>

I wonder why my plane is not moving. Lockdown for planes is over isn’t it? :wink: //noStroke(); //50 float planeX; float planeY; void setup() { size(1000,700); planeX = width/32; planeY = height/18; } v…

---

## [Extending classes](https://discourse.processing.org/t/extending-classes/21973)

<div class="topic-metadata">

**Author:** [@FurryNightShade](https://discourse.processing.org/u/FurryNightShade)\
**Replies:** 1\
**Last updated:** [June 18, 2020, 3:05am UTC](https://discourse.processing.org/t/extending-classes/21973 "2020-06-18T03:05:54Z")

</div>

So, let’s say, I have classes ExternalClass, OutterClass and InnerClass in a sketch called TestProject: public class ExternalClass{ ExternalClass(){ } } final static public class OutterClass{ final static pu…

---

## [Who is learning to code using JavaScript and p5.js? What can you say about your experience?](https://discourse.processing.org/t/who-is-learning-to-code-using-javascript-and-p5-js-what-can-you-say-about-your-experience/21903)

<div class="topic-metadata">

**Author:** [@codeguppy](https://discourse.processing.org/u/codeguppy)\
**Replies:** 1\
**Last updated:** [June 17, 2020, 1:51pm UTC](https://discourse.processing.org/t/who-is-learning-to-code-using-javascript-and-p5-js-what-can-you-say-about-your-experience/21903 "2020-06-17T13:51:47Z")

</div>

Who is learning to code using JavaScript and p5.js? What can you say about your experience? How old are you? What are your programming goals?

---

## [Problem with transparent png](https://discourse.processing.org/t/problem-with-transparent-png/21930)

<div class="topic-metadata">

**Author:** [@MartinGo](https://discourse.processing.org/u/MartinGo)\
**Replies:** 3\
**Last updated:** [June 16, 2020, 11:02pm UTC](https://discourse.processing.org/t/problem-with-transparent-png/21930 "2020-06-16T23:02:22Z")

</div>

Hi, I’m trying to draw something with “image” wich in other programs (like Photoshop or others) looks with soft borders but when I draw it inside Processing it looks with jagged edges. What is wrong?

---

## [Trouble running the IDE and file placement](https://discourse.processing.org/t/trouble-running-the-ide-and-file-placement/21922)

<div class="topic-metadata">

**Author:** [@dmazzoni](https://discourse.processing.org/u/dmazzoni)\
**Replies:** 1\
**Last updated:** [June 16, 2020, 9:11pm UTC](https://discourse.processing.org/t/trouble-running-the-ide-and-file-placement/21922 "2020-06-16T21:11:39Z")

</div>

I’m having a heck of a time trying to get I3 running consistently. I thought I figured out the required directory structure, but now nothing works. I’m trying to run examples in Chapter 3 of the book. Today, however, all…

---

## [Wrong language or a syntax error? (axidraw)](https://discourse.processing.org/t/wrong-language-or-a-syntax-error-axidraw/21727)

<div class="topic-metadata">

**Author:** [@slashwreck](https://discourse.processing.org/u/slashwreck)\
**Replies:** 10\
**Last updated:** [June 13, 2020, 12:49pm UTC](https://discourse.processing.org/t/wrong-language-or-a-syntax-error-axidraw/21727 "2020-06-13T12:49:30Z")

</div>

As an axidraw user, I was very interested in LingDong’s procedurally-generated plotter landscape. He includes the source code at the end of the page. I believe he did this in processing. I’m using Processing v3 in pyt…

---

## [Output window pixels very small](https://discourse.processing.org/t/output-window-pixels-very-small/21790)

<div class="topic-metadata">

**Author:** [@R1S8K](https://discourse.processing.org/u/R1S8K)\
**Replies:** 3\
**Last updated:** [June 12, 2020, 4:30pm UTC](https://discourse.processing.org/t/output-window-pixels-very-small/21790 "2020-06-12T16:30:10Z")

</div>

Hi, I want to use processing to simulate LCD output with C code. I did a test loading a .bmp file and it worked but the output window is too small. How to increase the size of the overall output window ? I think the …

---

## [The first random value is always the same when using randomSeed](https://discourse.processing.org/t/the-first-random-value-is-always-the-same-when-using-randomseed/21700)

<div class="topic-metadata">

**Author:** [@Reva](https://discourse.processing.org/u/Reva)\
**Replies:** 5\
**Last updated:** [June 12, 2020, 1:21pm UTC](https://discourse.processing.org/t/the-first-random-value-is-always-the-same-when-using-randomseed/21700 "2020-06-12T13:21:41Z")

</div>

I’ve found that no matter how I change the seed, the first random value is always the same when using randomSeed(). Here is the a really simple test: void draw() { randomSeed(frameCount); println(frameCount + ": " +…

---

## [Why doesn't processing recognize the key? (keyReleased)](https://discourse.processing.org/t/why-doesnt-processing-recognize-the-key-keyreleased/21777)

<div class="topic-metadata">

**Author:** [@Moritz](https://discourse.processing.org/u/Moritz)\
**Replies:** 3\
**Last updated:** [June 11, 2020, 7:13pm UTC](https://discourse.processing.org/t/why-doesnt-processing-recognize-the-key-keyreleased/21777 "2020-06-11T19:13:45Z")

</div>

Hi guys, why doesn’t Processing recognize the ‘e’ key when the ‘s’ and ‘d’ or ‘w’ and ‘d’ keys are already pressed? // Click on the image to give it focus, // and then press any key. int value = 0; void draw() { fi…

---

## [ArrayList size gives a nullPointerException, while data is stored](https://discourse.processing.org/t/arraylist-size-gives-a-nullpointerexception-while-data-is-stored/21712)

<div class="topic-metadata">

**Author:** [@BadGameDeveloper](https://discourse.processing.org/u/BadGameDeveloper)\
**Replies:** 10\
**Last updated:** [June 10, 2020, 7:56am UTC](https://discourse.processing.org/t/arraylist-size-gives-a-nullpointerexception-while-data-is-stored/21712 "2020-06-10T07:56:27Z")

</div>

Hi, I have a problem. My arraylist called spawns gives a NullPointerException on spawns.size. This happens in the constructor. I tried it with IntLists, but the same thing happened. The ArrayList should be read here. …

---

## [Using a 2D Array in a Class Object - NullPointerException?](https://discourse.processing.org/t/using-a-2d-array-in-a-class-object-nullpointerexception/21606)

<div class="topic-metadata">

**Author:** [@RetProf](https://discourse.processing.org/u/RetProf)\
**Replies:** 10\
**Last updated:** [June 6, 2020, 3:10am UTC](https://discourse.processing.org/t/using-a-2d-array-in-a-class-object-nullpointerexception/21606 "2020-06-06T03:10:45Z")

</div>

The following is a short sketch with a single new Class. In the class I’m trying to develop a 2D array in the Constructor and then use it in a method in the class. The method recognizes a variable in the constructor but …

---

## [X =width/2 not plotting to the middle of the sketch window](https://discourse.processing.org/t/x-width-2-not-plotting-to-the-middle-of-the-sketch-window/21585)

<div class="topic-metadata">

**Author:** [@BackTo](https://discourse.processing.org/u/BackTo)\
**Replies:** 4\
**Last updated:** [June 5, 2020, 6:16pm UTC](https://discourse.processing.org/t/x-width-2-not-plotting-to-the-middle-of-the-sketch-window/21585 "2020-06-05T18:16:58Z")

</div>

Hello, I have a very basic question. When I set the X coordinate to width/2 and the Y coordinate to height/2, the coordinate, plotted never ends up in the middle of the screen. Is there some coding syntax I’m missing? …

---

## [Odd TableSaving Behavoir](https://discourse.processing.org/t/odd-tablesaving-behavoir/21586)

<div class="topic-metadata">

**Author:** [@TheEternalDragon](https://discourse.processing.org/u/TheEternalDragon)\
**Replies:** 1\
**Last updated:** [June 5, 2020, 10:43am UTC](https://discourse.processing.org/t/odd-tablesaving-behavoir/21586 "2020-06-05T10:43:26Z")

</div>

I’m trying to save the data of a few objects to a table, this includes their position as a vector and their current size so that it can be used when reopening the program. However when using the code below, instead of ge…

---

## [Processing Array size](https://discourse.processing.org/t/processing-array-size/21569)

<div class="topic-metadata">

**Author:** [@philspitler](https://discourse.processing.org/u/philspitler)\
**Replies:** 4\
**Last updated:** [June 5, 2020, 12:01am UTC](https://discourse.processing.org/t/processing-array-size/21569 "2020-06-05T00:01:43Z")

</div>

I have a Processing sketch that reads folders of images and displays them. It has been working great but it seems that as soon as the folder got over 500 images I get an error. My code is pretty straight forward. I de…

---

## [About public voids / functions](https://discourse.processing.org/t/about-public-voids-functions/21469)

<div class="topic-metadata">

**Author:** [@SouSageYa](https://discourse.processing.org/u/SouSageYa)\
**Replies:** 4\
**Last updated:** [June 1, 2020, 2:04pm UTC](https://discourse.processing.org/t/about-public-voids-functions/21469 "2020-06-01T14:04:34Z")

</div>

Hi. Do I have to place Public Voids into void draw if I want to use it repeatedly ??

---

## [PImage object from current sketch state](https://discourse.processing.org/t/pimage-object-from-current-sketch-state/21433)

<div class="topic-metadata">

**Author:** [@arcadeperfect](https://discourse.processing.org/u/arcadeperfect)\
**Replies:** 4\
**Last updated:** [June 1, 2020, 3:26am UTC](https://discourse.processing.org/t/pimage-object-from-current-sketch-state/21433 "2020-06-01T03:26:58Z")

</div>

Hi, Can I create a PImage object from the pixels in the sketch rather than by loading an image from disk? Thanks

---

## [Randomly pick one variable](https://discourse.processing.org/t/randomly-pick-one-variable/21304)

<div class="topic-metadata">

**Author:** [@Adi](https://discourse.processing.org/u/Adi)\
**Replies:** 14\
**Last updated:** [May 29, 2020, 12:04am UTC](https://discourse.processing.org/t/randomly-pick-one-variable/21304 "2020-05-29T00:04:16Z")

</div>

Is there a way to randomly pick between two values. For example, randomly pick a or b, not anything in between, and if possible, do this when a = -1 and b = 1?

---

## [What do I put in the HTML file?](https://discourse.processing.org/t/what-do-i-put-in-the-html-file/21373)

<div class="topic-metadata">

**Author:** [@Rahul](https://discourse.processing.org/u/Rahul)\
**Replies:** 10\
**Last updated:** [May 28, 2020, 2:49pm UTC](https://discourse.processing.org/t/what-do-i-put-in-the-html-file/21373 "2020-05-28T14:49:13Z")

</div>

I’m learning Processing and want to be able to write it in a text editor on my computer. I downloaded processing.js and have written a quick sketch called program.pde: void setup() { size(200, 200); fill(200); …

---

## [Use random() in static method](https://discourse.processing.org/t/use-random-in-static-method/21358)

<div class="topic-metadata">

**Author:** [@FallingSloth](https://discourse.processing.org/u/FallingSloth)\
**Replies:** 1\
**Last updated:** [May 28, 2020, 3:06am UTC](https://discourse.processing.org/t/use-random-in-static-method/21358 "2020-05-28T03:06:19Z")

</div>

I have a static method where I would like to use the random function, however, I get the error Cannot make a static reference to the non-static method random(float) from the type PApplet I’ve tried to google for the …

---

## [Why transformations and shapes can't be used within beginShape()](https://discourse.processing.org/t/why-transformations-and-shapes-cant-be-used-within-beginshape/20997)

<div class="topic-metadata">

**Author:** [@alikaikai](https://discourse.processing.org/u/alikaikai)\
**Replies:** 4\
**Last updated:** [May 21, 2020, 5:49am UTC](https://discourse.processing.org/t/why-transformations-and-shapes-cant-be-used-within-beginshape/20997 "2020-05-21T05:49:07Z")

</div>

Hello everyone! I recently started using Processing and I learned from the reference page that transformations such as translate() rotate() as well as other shapes do not work within beginShape(). So why is that happen…

---

## [Adding an image to shape?](https://discourse.processing.org/t/adding-an-image-to-shape/21105)

<div class="topic-metadata">

**Author:** [@rkk16](https://discourse.processing.org/u/rkk16)\
**Replies:** 2\
**Last updated:** [May 20, 2020, 9:54pm UTC](https://discourse.processing.org/t/adding-an-image-to-shape/21105 "2020-05-20T21:54:02Z")

</div>

How do you add a background for a shape? ie instead of filling a circle with a colour, fill it with an image?

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

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