# Coding Questions

**URL:** https://discourse.processing.org/c/processing/processing-questions/15.md?page=116

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

**Page:** 117

---

## [Renaming PDF generated files](https://discourse.processing.org/t/renaming-pdf-generated-files/16164)

<div class="topic-metadata">

**Author:** [@debxyz](https://discourse.processing.org/u/debxyz)\
**Replies:** 3\
**Last updated:** [December 5, 2019, 9:34pm UTC](https://discourse.processing.org/t/renaming-pdf-generated-files/16164 "2019-12-05T21:34:28Z")

</div>

Unable to find the answer to this in REFERENCE section. I have a very simple program to generate random color block overlaps. Currently set up to record a PDF of each instance when code runs. How do I generate a new n…

---

## [Color Selecting](https://discourse.processing.org/t/color-selecting/16144)

<div class="topic-metadata">

**Author:** [@keeg23](https://discourse.processing.org/u/keeg23)\
**Replies:** 5\
**Last updated:** [December 5, 2019, 9:52am UTC](https://discourse.processing.org/t/color-selecting/16144 "2019-12-05T09:52:32Z")

</div>

I am currently running into trouble having the color being selected and drawing… The colors will not work when pressed on? Not exactly sure why it is not working PImage myElonStart, myMonroe, myLennon, myBlueCan, myR…

---

## [How to randomize colors](https://discourse.processing.org/t/how-to-randomize-colors/16136)

<div class="topic-metadata">

**Author:** [@masterU](https://discourse.processing.org/u/masterU)\
**Replies:** 3\
**Last updated:** [December 5, 2019, 1:58am UTC](https://discourse.processing.org/t/how-to-randomize-colors/16136 "2019-12-05T01:58:47Z")

</div>

Hello all, I am doing a recreation of Pink Floyd’s famous album with a twist - I want every time the mouse is pressed, the colors on the spectrum random and change. This is what I have so far: PImage img; PFont helvetic…

---

## [Making rect stop offset movement if the rect is touched by the mouse](https://discourse.processing.org/t/making-rect-stop-offset-movement-if-the-rect-is-touched-by-the-mouse/16103)

<div class="topic-metadata">

**Author:** [@Adrian1998](https://discourse.processing.org/u/Adrian1998)\
**Replies:** 5\
**Last updated:** [December 4, 2019, 8:12pm UTC](https://discourse.processing.org/t/making-rect-stop-offset-movement-if-the-rect-is-touched-by-the-mouse/16103 "2019-12-04T20:12:08Z")

</div>

So i am currently trying to make my rectangles stop when a mouse touches a rectangle. Right now it only stop if the mouse reaches a certain Y axis. How can I make it stop when the mouse only touches the square. int b =…

---

## [Writing out sentences with mouse](https://discourse.processing.org/t/writing-out-sentences-with-mouse/16080)

<div class="topic-metadata">

**Author:** [@tkelly4](https://discourse.processing.org/u/tkelly4)\
**Replies:** 10\
**Last updated:** [December 4, 2019, 6:21pm UTC](https://discourse.processing.org/t/writing-out-sentences-with-mouse/16080 "2019-12-04T18:21:16Z")

</div>

Hello, I am not a programmer in any way, so I barely know anything about coding. We are doing a code based imagery project for my art class using Java coding. We are supposed to eventually turn it into a drawing app and …

---

## [PApplet second win exit, create ... RAM overfill](https://discourse.processing.org/t/papplet-second-win-exit-create-ram-overfill/16090)

<div class="topic-metadata">

**Author:** [@GeorgeJava](https://discourse.processing.org/u/GeorgeJava)\
**Replies:** 4\
**Last updated:** [December 4, 2019, 5:22pm UTC](https://discourse.processing.org/t/papplet-second-win-exit-create-ram-overfill/16090 "2019-12-04T17:22:16Z")

</div>

Helo, i want to exit second window of the PApplet and create another, but i want to clear it absolutely from RAM, becouse its getting takes a lot of RAM, the value getting only higher… how to delete PApplet in all ? PWi…

---

## [New to Processing, I need HELP!](https://discourse.processing.org/t/new-to-processing-i-need-help/16116)

<div class="topic-metadata">

**Author:** [@ihatearrays](https://discourse.processing.org/u/ihatearrays)\
**Replies:** 2\
**Last updated:** [December 4, 2019, 3:38pm UTC](https://discourse.processing.org/t/new-to-processing-i-need-help/16116 "2019-12-04T15:38:21Z")

</div>

Hi, I’m new to Processing, I’m making a 3x3 grid game that makes users mousehover over to a target square that is one of the 9 squares. I’m trying to create a function called getNextSquare that picks a random number betw…

---

## [Factorial not working "cannot convert from float to int"](https://discourse.processing.org/t/factorial-not-working-cannot-convert-from-float-to-int/16115)

<div class="topic-metadata">

**Author:** [@tsunii](https://discourse.processing.org/u/tsunii)\
**Replies:** 1\
**Last updated:** [December 4, 2019, 2:45pm UTC](https://discourse.processing.org/t/factorial-not-working-cannot-convert-from-float-to-int/16115 "2019-12-04T14:45:25Z")

</div>

I’m trying to make a simple 2d application for the “Traveller Salesmanship Problem” i’m configuring the program, i was working on everything in int, but i thougth float would be more accurate, even since i’m working with…

---

## [Difficulty in understanding noise turbulence code from processing book creating organic textures](https://discourse.processing.org/t/difficulty-in-understanding-noise-turbulence-code-from-processing-book-creating-organic-textures/16075)

<div class="topic-metadata">

**Author:** [@Ruchi](https://discourse.processing.org/u/Ruchi)\
**Replies:** 2\
**Last updated:** [December 4, 2019, 6:48am UTC](https://discourse.processing.org/t/difficulty-in-understanding-noise-turbulence-code-from-processing-book-creating-organic-textures/16075 "2019-12-04T06:48:37Z")

</div>

float power=6; //TURBULENCE POWER float d=8; //TURBULENCE DENSITY noStroke(); for (int y=0; y\<height; y++) { for (int x=0; x\<width; x++) { float total=0.0; for (float i=d; i\>=1; i=i/2.0) { t…

---

## [How do I move multiple objects in a circle in order](https://discourse.processing.org/t/how-do-i-move-multiple-objects-in-a-circle-in-order/16101)

<div class="topic-metadata">

**Author:** [@DudVudAura](https://discourse.processing.org/u/DudVudAura)\
**Replies:** 4\
**Last updated:** [December 4, 2019, 6:35am UTC](https://discourse.processing.org/t/how-do-i-move-multiple-objects-in-a-circle-in-order/16101 "2019-12-04T06:35:12Z")

</div>

This is the code I have int cx = 250; int cy = 250; int r = 100; int cq = 250; int ce = 250; int d = 150; void setup() { size(500, 500); } void draw() { background(0); noStroke(); fill(random(0,255),random(0,255…

---

## [Exporting as .gif, the Explode effect, and many more problems](https://discourse.processing.org/t/exporting-as-gif-the-explode-effect-and-many-more-problems/15802)

<div class="topic-metadata">

**Author:** [@vogelstraussk](https://discourse.processing.org/u/vogelstraussk)\
**Replies:** 3\
**Last updated:** [December 3, 2019, 7:35pm UTC](https://discourse.processing.org/t/exporting-as-gif-the-explode-effect-and-many-more-problems/15802 "2019-12-03T19:35:34Z")

</div>

Hello, clever people! First things first, I am a design student who just started teaching herself Processing a week ago, so I have NO knowledge beyond The Coding Train tutorials. (It’s fun! But at the same time I am ju…

---

## [I am creating a floor plan and I want to know how to constraint certain areas to not draw in](https://discourse.processing.org/t/i-am-creating-a-floor-plan-and-i-want-to-know-how-to-constraint-certain-areas-to-not-draw-in/16081)

<div class="topic-metadata">

**Author:** [@elcougario](https://discourse.processing.org/u/elcougario)\
**Replies:** 1\
**Last updated:** [December 3, 2019, 5:05pm UTC](https://discourse.processing.org/t/i-am-creating-a-floor-plan-and-i-want-to-know-how-to-constraint-certain-areas-to-not-draw-in/16081 "2019-12-03T17:05:33Z")

</div>

Hey guys, I am working on an abstract floor plan using processing. I am making a grid with random rectangles and small ellipses. I have some voids on the four corners and one in the middle. Right now I am just covering u…

---

## [How can I restart the program with keypress](https://discourse.processing.org/t/how-can-i-restart-the-program-with-keypress/15446)

<div class="topic-metadata">

**Author:** [@Kitty](https://discourse.processing.org/u/Kitty)\
**Replies:** 26\
**Last updated:** [November 22, 2019, 7:18pm UTC](https://discourse.processing.org/t/how-can-i-restart-the-program-with-keypress/15446 "2019-11-22T19:18:31Z")

</div>

I want the key “Q” to restart the program, but the reset function isn’t working.

---

## [Processing JS and HTML + PHP](https://discourse.processing.org/t/processing-js-and-html-php/16046)

<div class="topic-metadata">

**Author:** [@Vickydcl](https://discourse.processing.org/u/Vickydcl)\
**Replies:** 0\
**Last updated:** [December 2, 2019, 4:11pm UTC](https://discourse.processing.org/t/processing-js-and-html-php/16046 "2019-12-02T16:11:08Z")

</div>

I’ve made a processing sketch that I had upload on my website (localhost). But the buttons that I programmed doesn’t work because i’m using the “selectInput” function that is not avaible in web. So, I guess I need to mak…

---

## [Rotations and translations in real time](https://discourse.processing.org/t/rotations-and-translations-in-real-time/15490)

<div class="topic-metadata">

**Author:** [@Waboqueox](https://discourse.processing.org/u/Waboqueox)\
**Replies:** 2\
**Last updated:** [December 2, 2019, 11:13am UTC](https://discourse.processing.org/t/rotations-and-translations-in-real-time/15490 "2019-12-02T11:13:50Z")

</div>

Hi guys, I know there are many topics about this theme, but I’m getting mad with this :woozy\_face:… I have the UTM coordinates and orientation of my state, at the same time, I have coordinates of the objects that surrou…

---

## [Processing js - html and php](https://discourse.processing.org/t/processing-js-html-and-php/16034)

<div class="topic-metadata">

**Author:** [@dawn](https://discourse.processing.org/u/dawn)\
**Replies:** 3\
**Last updated:** [December 2, 2019, 11:05am UTC](https://discourse.processing.org/t/processing-js-html-and-php/16034 "2019-12-02T11:05:17Z")

</div>

Hello, I have to run a sketch on a website but I can’t make it appear. I only can run some examples if they are inside the examples folder but when I want to link them on my webpage (HTML) they don’t work. Below some cod…

---

## [Convert color notation in an array](https://discourse.processing.org/t/convert-color-notation-in-an-array/15972)

<div class="topic-metadata">

**Author:** [@stupidquestion](https://discourse.processing.org/u/stupidquestion)\
**Replies:** 6\
**Last updated:** [December 2, 2019, 9:28am UTC](https://discourse.processing.org/t/convert-color-notation-in-an-array/15972 "2019-12-02T09:28:36Z")

</div>

so, i want to take an inventory of a bunch of my pixels in an array, and loadPixels() seems to generate that array fine, but I can’t figure out how to read that data, much less use it with other code. any idea how to co…

---

## [Detect double click inside class](https://discourse.processing.org/t/detect-double-click-inside-class/15793)

<div class="topic-metadata">

**Author:** [@Thomas](https://discourse.processing.org/u/Thomas)\
**Replies:** 12\
**Last updated:** [December 2, 2019, 9:26am UTC](https://discourse.processing.org/t/detect-double-click-inside-class/15793 "2019-12-02T09:26:35Z")

</div>

Hello, I would like to detect a double mouse click from within a class. If a double click is detected, some event has to be executed. I would like the code to be modular, so the mouseClicked() or mousePressed() functions…

---

## [Adding Color and music to Ripple effect](https://discourse.processing.org/t/adding-color-and-music-to-ripple-effect/16009)

<div class="topic-metadata">

**Author:** [@Swagific](https://discourse.processing.org/u/Swagific)\
**Replies:** 4\
**Last updated:** [December 1, 2019, 6:37pm UTC](https://discourse.processing.org/t/adding-color-and-music-to-ripple-effect/16009 "2019-12-01T18:37:57Z")

</div>

Hi im trying to create a ripple using mouse dragged. i have the code but i dont know how to change the color im hopping to have it be random whenever its dragged across, and for it to play music and stop once the mouse …

---

## [I have my coordinates, can I zoom in?](https://discourse.processing.org/t/i-have-my-coordinates-can-i-zoom-in/16013)

<div class="topic-metadata">

**Author:** [@libensvivit](https://discourse.processing.org/u/libensvivit)\
**Replies:** 3\
**Last updated:** [December 1, 2019, 3:48pm UTC](https://discourse.processing.org/t/i-have-my-coordinates-can-i-zoom-in/16013 "2019-12-01T15:48:19Z")

</div>

Hi everyone… I’m using discrete fourier transform to draw epicycles with processing library in Java. It looks like this : It is basically bunch of circles rotating in harmony to draw something. I have an ArrayList p…

---

## [Best way to make selection options](https://discourse.processing.org/t/best-way-to-make-selection-options/15993)

<div class="topic-metadata">

**Author:** [@keeg23](https://discourse.processing.org/u/keeg23)\
**Replies:** 4\
**Last updated:** [December 1, 2019, 3:30pm UTC](https://discourse.processing.org/t/best-way-to-make-selection-options/15993 "2019-12-01T15:30:47Z")

</div>

I need help with coding my paint program so I am able to switch between colors. But not sure the best way to set it up. Anything will help.

---

## [\[SOLVED\] Use the keyboard to make a design appear](https://discourse.processing.org/t/solved-use-the-keyboard-to-make-a-design-appear/16004)

<div class="topic-metadata">

**Author:** [@P3t3R08](https://discourse.processing.org/u/P3t3R08)\
**Replies:** 7\
**Last updated:** [December 1, 2019, 5:23am UTC](https://discourse.processing.org/t/solved-use-the-keyboard-to-make-a-design-appear/16004 "2019-12-01T05:23:41Z")

</div>

Hello, I am trying to write a program where if I press the letter ‘c’ on the keyboard a design similar to one that is already programmed for, will appear and continue to go in a circle. The only issue is that the design…

---

## [Objects not disappearing when new screen selected](https://discourse.processing.org/t/objects-not-disappearing-when-new-screen-selected/15778)

<div class="topic-metadata">

**Author:** [@unique\_username](https://discourse.processing.org/u/unique_username)\
**Replies:** 12\
**Last updated:** [December 1, 2019, 2:39am UTC](https://discourse.processing.org/t/objects-not-disappearing-when-new-screen-selected/15778 "2019-12-01T02:39:38Z")

</div>

I’m a bit new to processing, and I’m trying to make a game using multiple levels. Levels are either locked or unlocked, and are represented by either a button or a lock. When a button is pressed, the background does inde…

---

## [Random rectangle](https://discourse.processing.org/t/random-rectangle/16000)

<div class="topic-metadata">

**Author:** [@elcougario](https://discourse.processing.org/u/elcougario)\
**Replies:** 1\
**Last updated:** [November 30, 2019, 11:33pm UTC](https://discourse.processing.org/t/random-rectangle/16000 "2019-11-30T23:33:49Z")

</div>

Hey guys. Im trying to make rectangles be inside a quad shape I’ve created. How do we do this. I would want them not to touch as well (like not overlap). I’ve though of using a Boolean or and array but I cant figure it o…

---

## [10 Random red blocks on a grid](https://discourse.processing.org/t/10-random-red-blocks-on-a-grid/15814)

<div class="topic-metadata">

**Author:** [@San](https://discourse.processing.org/u/San)\
**Replies:** 6\
**Last updated:** [November 30, 2019, 9:06pm UTC](https://discourse.processing.org/t/10-random-red-blocks-on-a-grid/15814 "2019-11-30T21:06:24Z")

</div>

Hey! I made this 60x40 grid and I am trying to make 10 of the squares red. And it has to be 10 random squares each time I run the program. I have tried a lot but can’t figure it out… Can anyone please tell me who to do…

---

## [ABOUT.... solar system simulation](https://discourse.processing.org/t/about-solar-system-simulation/15969)

<div class="topic-metadata">

**Author:** [@O-O](https://discourse.processing.org/u/O-O)\
**Replies:** 3\
**Last updated:** [November 30, 2019, 9:01pm UTC](https://discourse.processing.org/t/about-solar-system-simulation/15969 "2019-11-30T21:01:18Z")

</div>

Planet\[\] planets=new Planet\[8\]; void setup(){ size(200,200); for(int i=0;i\<planets.length;i++){ planets\[i\]=new Planet(20+i\*10,i+8); } } void draw(){ background(255); pushMatrix(); translate(width/2,height…

---

## [Background Image won't load](https://discourse.processing.org/t/background-image-wont-load/15964)

<div class="topic-metadata">

**Author:** [@thegoodnunes](https://discourse.processing.org/u/thegoodnunes)\
**Replies:** 2\
**Last updated:** [November 30, 2019, 8:55pm UTC](https://discourse.processing.org/t/background-image-wont-load/15964 "2019-11-30T20:55:00Z")

</div>

Hi All- I’m attempting to get this fork process, to run over the top of a background image, instead of the default neutral single color. I’ve loaded the image into the sketch data file, and attempted to set it up and d…

---

## [\[SOLVED\] Using the keyboard to change the direction a moving circle](https://discourse.processing.org/t/solved-using-the-keyboard-to-change-the-direction-a-moving-circle/15991)

<div class="topic-metadata">

**Author:** [@P3t3R08](https://discourse.processing.org/u/P3t3R08)\
**Replies:** 2\
**Last updated:** [November 30, 2019, 8:28pm UTC](https://discourse.processing.org/t/solved-using-the-keyboard-to-change-the-direction-a-moving-circle/15991 "2019-11-30T20:28:24Z")

</div>

Hello, I am trying to write a program that causes the circle to go in one direction but when I press the letter ‘a’ on the keyboard it will go the opposite direction. Additionally, if the circle reaches a boundary it wi…

---

## [Draw rectangles with the mouse, background refresh](https://discourse.processing.org/t/draw-rectangles-with-the-mouse-background-refresh/15961)

<div class="topic-metadata">

**Author:** [@antang](https://discourse.processing.org/u/antang)\
**Replies:** 4\
**Last updated:** [November 30, 2019, 8:21pm UTC](https://discourse.processing.org/t/draw-rectangles-with-the-mouse-background-refresh/15961 "2019-11-30T20:21:17Z")

</div>

hello everybody, I’m new to processing. I am looking to write a program in which I select an area of an image ( like “rect selection” in Photoshop for example…), this area has a red stroke and is slightly opaque, once t…

---

## [Circle/ Square Packing Tips](https://discourse.processing.org/t/circle-square-packing-tips/15929)

<div class="topic-metadata">

**Author:** [@K3N](https://discourse.processing.org/u/K3N)\
**Replies:** 5\
**Last updated:** [November 30, 2019, 8:07pm UTC](https://discourse.processing.org/t/circle-square-packing-tips/15929 "2019-11-30T20:07:16Z")

</div>

Hello I am new here so I hope I follow the rules and am able to get some help :stuck\_out\_tongue: I have this code from my Prof that was originally for circle packing and i just slightly adjusted it to be square packing …

[Previous page](https://discourse.processing.org/c/processing/processing-questions/15.md?page=115)

[Next page](https://discourse.processing.org/c/processing/processing-questions/15.md?page=117)
