# Coding Questions

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

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

**Page:** 94

---

## [keyPressed with multiple keys](https://discourse.processing.org/t/keypressed-with-multiple-keys/21040)

<div class="topic-metadata">

**Author:** [@homeCoder](https://discourse.processing.org/u/homeCoder)\
**Replies:** 3\
**Last updated:** [May 19, 2020, 1:54pm UTC](https://discourse.processing.org/t/keypressed-with-multiple-keys/21040 "2020-05-19T13:54:54Z")

</div>

Hello, i am trying to write a program which shows two arrays with numbers and if I press the number of an array element, this element should disappear and the others replace the gap. That’s function, but I wan’t to do s…

---

## [Delete an element by entering a number and the following elements must move up](https://discourse.processing.org/t/delete-an-element-by-entering-a-number-and-the-following-elements-must-move-up/20840)

<div class="topic-metadata">

**Author:** [@homeCoder](https://discourse.processing.org/u/homeCoder)\
**Replies:** 2\
**Last updated:** [May 19, 2020, 2:16am UTC](https://discourse.processing.org/t/delete-an-element-by-entering-a-number-and-the-following-elements-must-move-up/20840 "2020-05-19T02:16:06Z")

</div>

This array element (e-mails) shows up when you start the program - thats right. But I want to do something like: If I press e.g. the key ‘1’ I want that the program delete automatically the mailingListe element number 1 …

---

## [Sorting an array](https://discourse.processing.org/t/sorting-an-array/20992)

<div class="topic-metadata">

**Author:** [@Aleksi](https://discourse.processing.org/u/Aleksi)\
**Replies:** 4\
**Last updated:** [May 18, 2020, 10:40pm UTC](https://discourse.processing.org/t/sorting-an-array/20992 "2020-05-18T22:40:37Z")

</div>

I cannot see my way to sorting an array of points using a simple float comparison. Here’s the essence of what I’m seeking to do: import java.util.Collections; void setup(){ ArrayList\<Point\> points = new ArrayList();…

---

## [How to create different color for each point](https://discourse.processing.org/t/how-to-create-different-color-for-each-point/21011)

<div class="topic-metadata">

**Author:** [@DeathEater](https://discourse.processing.org/u/DeathEater)\
**Replies:** 1\
**Last updated:** [May 18, 2020, 3:27pm UTC](https://discourse.processing.org/t/how-to-create-different-color-for-each-point/21011 "2020-05-18T15:27:09Z")

</div>

import java.awt.Point; final static int N\_POINTS\_EACH= 13; float scale = 0.25f; ArrayList \<PointSet\> allpointsets; int currentset = 0; void settings() { size(700, 500); } void setup() { frameRate(60); allpo…

---

## [Autonomous agents applied to paintings](https://discourse.processing.org/t/autonomous-agents-applied-to-paintings/20978)

<div class="topic-metadata">

**Author:** [@SemAntys](https://discourse.processing.org/u/SemAntys)\
**Replies:** 3\
**Last updated:** [May 18, 2020, 9:57am UTC](https://discourse.processing.org/t/autonomous-agents-applied-to-paintings/20978 "2020-05-18T09:57:38Z")

</div>

Hi! I’ve recently discovered the work of Leonoardo Solas and I’m very interested in his Mona Rayadas drawings, here is an example: I’ve already used autonomous agents in the past, but I’m struggling to write an opera…

---

## [Trying to make a perlin noise loop into a Music visualization](https://discourse.processing.org/t/trying-to-make-a-perlin-noise-loop-into-a-music-visualization/20988)

<div class="topic-metadata">

**Author:** [@Cub](https://discourse.processing.org/u/Cub)\
**Replies:** 1\
**Last updated:** [May 18, 2020, 1:26am UTC](https://discourse.processing.org/t/trying-to-make-a-perlin-noise-loop-into-a-music-visualization/20988 "2020-05-18T01:26:55Z")

</div>

please format code with \</\> button \* homework policy \* asking questions int totalFrames = 100; int counter = 0; boolean record = false; Particle\[\] particles = new Particle\[100\]; void setup() { size(600, 600); …

---

## [Animation problem: delay](https://discourse.processing.org/t/animation-problem-delay/20973)

<div class="topic-metadata">

**Author:** [@kukukoks](https://discourse.processing.org/u/kukukoks)\
**Replies:** 3\
**Last updated:** [May 17, 2020, 4:17pm UTC](https://discourse.processing.org/t/animation-problem-delay/20973 "2020-05-17T16:17:21Z")

</div>

Hi i have a problem with my code, i have 6 png and need to load this png from 0 to 5, but when i start program i have instantly 5 PImage zero, jeden, dwa, trzy, cztery, piec; void setup() { size(200, 200); zero=loa…

---

## [createInput() for Java](https://discourse.processing.org/t/createinput-for-java/20925)

<div class="topic-metadata">

**Author:** [@patricio1979](https://discourse.processing.org/u/patricio1979)\
**Replies:** 3\
**Last updated:** [May 17, 2020, 2:43pm UTC](https://discourse.processing.org/t/createinput-for-java/20925 "2020-05-17T14:43:04Z")

</div>

Hello, looking for a way to create a number box like the Pure Data one, Any ideas please? Is a simple box with a cursor. Enter a number or change it by mouse drag.

---

## [How to gradient this color preview](https://discourse.processing.org/t/how-to-gradient-this-color-preview/19526)

<div class="topic-metadata">

**Author:** [@newbietot](https://discourse.processing.org/u/newbietot)\
**Replies:** 3\
**Last updated:** [April 8, 2020, 1:41pm UTC](https://discourse.processing.org/t/how-to-gradient-this-color-preview/19526 "2020-04-08T13:41:54Z")

</div>

i want to make my color previewer will display the gradient black at bottom the gradient white at the top right corner, once i click the color slider into red .. the top left corner will display the color that i picked…

---

## [Resize background image](https://discourse.processing.org/t/resize-background-image/20883)

<div class="topic-metadata">

**Author:** [@juanjoc](https://discourse.processing.org/u/juanjoc)\
**Replies:** 1\
**Last updated:** [May 16, 2020, 11:21pm UTC](https://discourse.processing.org/t/resize-background-image/20883 "2020-05-16T23:21:48Z")

</div>

Hi everyone, I have created an image (1920 x 1080 px) for my background. When I open the the file in another laptop that has a lower window size, then I get problems running the file. I wonder if there is a way to resiz…

---

## [Problems with translate](https://discourse.processing.org/t/problems-with-translate/20952)

<div class="topic-metadata">

**Author:** [@valeria0616](https://discourse.processing.org/u/valeria0616)\
**Replies:** 4\
**Last updated:** [May 16, 2020, 11:14pm UTC](https://discourse.processing.org/t/problems-with-translate/20952 "2020-05-16T23:14:24Z")

</div>

Hi everyone, i’m really new to processing, and I have a project that consists on doing something in 3d, so I was trying to draw the Starry Night and add the stars and houses with spheres that rotate and boxes, but when I…

---

## [Game State Management with Key Events](https://discourse.processing.org/t/game-state-management-with-key-events/19492)

<div class="topic-metadata">

**Author:** [@graysonh](https://discourse.processing.org/u/graysonh)\
**Replies:** 2\
**Last updated:** [May 16, 2020, 9:20pm UTC](https://discourse.processing.org/t/game-state-management-with-key-events/19492 "2020-05-16T21:20:08Z")

</div>

Hello all, I’m working on a Roguelike dungeon crawler and I am learning new game development/coding techniques along the way. I am having trouble creating a finite state machine that switches between states with user in…

---

## [Matrix multiplication issue](https://discourse.processing.org/t/matrix-multiplication-issue/20622)

<div class="topic-metadata">

**Author:** [@some](https://discourse.processing.org/u/some)\
**Replies:** 3\
**Last updated:** [May 16, 2020, 7:39pm UTC](https://discourse.processing.org/t/matrix-multiplication-issue/20622 "2020-05-16T19:39:36Z")

</div>

Hi i tried to perform matrix multiplication for 2d rotation. I expected result that points will rotate in place, but instead i got flicker and movement outside screen. Here is the source code: float angle=10; PVector\[…

---

## [Helping assignments](https://discourse.processing.org/t/helping-assignments/20942)

<div class="topic-metadata">

**Author:** [@tengtengloves](https://discourse.processing.org/u/tengtengloves)\
**Replies:** 2\
**Last updated:** [May 16, 2020, 6:36pm UTC](https://discourse.processing.org/t/helping-assignments/20942 "2020-05-16T18:36:00Z")

</div>

Hi, I am trying to draw a planet that keeps spinning with a little interaction with the users. I couldn’t run the data in processing and couldn’t find the error below. The users click on the planet, it will interact wit…

---

## [Creating sectors in a rotating circular image](https://discourse.processing.org/t/creating-sectors-in-a-rotating-circular-image/20781)

<div class="topic-metadata">

**Author:** [@soraiaxb](https://discourse.processing.org/u/soraiaxb)\
**Replies:** 16\
**Last updated:** [May 16, 2020, 4:49pm UTC](https://discourse.processing.org/t/creating-sectors-in-a-rotating-circular-image/20781 "2020-05-16T16:49:14Z")

</div>

Hi, I have a circular image that rotates on mouseDragged and the image has various letters around the circle, when I drag the image to a certain position, one of the letters goes on top of a box indicating i want to writ…

---

## [Neural network training](https://discourse.processing.org/t/neural-network-training/20714)

<div class="topic-metadata">

**Author:** [@Kport1](https://discourse.processing.org/u/Kport1)\
**Replies:** 5\
**Last updated:** [May 15, 2020, 11:40pm UTC](https://discourse.processing.org/t/neural-network-training/20714 "2020-05-15T23:40:23Z")

</div>

I need help with the training of my neura network. for some reason if i train it all weights always go to 0. Main tab: Network n = new Network(1, 1, 1); float lr = 0.07; float\[\] in = {0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0…

---

## [Problem with Unicode](https://discourse.processing.org/t/problem-with-unicode/20837)

<div class="topic-metadata">

**Author:** [@Arsenii](https://discourse.processing.org/u/Arsenii)\
**Replies:** 3\
**Last updated:** [May 15, 2020, 7:42pm UTC](https://discourse.processing.org/t/problem-with-unicode/20837 "2020-05-15T19:42:46Z")

</div>

I want to use Katakana symbols but i can not understand how to equate it to char variable

---

## [Rosetta Challenge! -- Reverse a String](https://discourse.processing.org/t/rosetta-challenge-reverse-a-string/20644)

<div class="topic-metadata">

**Author:** [@jeremydouglass](https://discourse.processing.org/u/jeremydouglass)\
**Replies:** 32\
**Last updated:** [May 15, 2020, 5:45pm UTC](https://discourse.processing.org/t/rosetta-challenge-reverse-a-string/20644 "2020-05-15T17:45:10Z")

</div>

This is a Rosetta Challenge. Gratefully accepting answers for Processing, p5.js, processing.js, processing.py, p5py, JRubyArt, Processing.R, et cetera – including multiple approaches in one mode. Answers may be cross-pos…

---

## [Reading files from a folder(s) ...where to start learning?](https://discourse.processing.org/t/reading-files-from-a-folder-s-where-to-start-learning/20761)

<div class="topic-metadata">

**Author:** [@Eyetoof](https://discourse.processing.org/u/Eyetoof)\
**Replies:** 3\
**Last updated:** [May 13, 2020, 7:29am UTC](https://discourse.processing.org/t/reading-files-from-a-folder-s-where-to-start-learning/20761 "2020-05-13T07:29:22Z")

</div>

Where should I start if I want to learn about writing my program to look into a folder, and any/all of it’s subfolders, understanding whats there and then doing stuff with the files? I am working with a program where I …

---

## [I dont want this line! How to remove it?](https://discourse.processing.org/t/i-dont-want-this-line-how-to-remove-it/20865)

<div class="topic-metadata">

**Author:** [@julia1312](https://discourse.processing.org/u/julia1312)\
**Replies:** 3\
**Last updated:** [May 15, 2020, 6:22am UTC](https://discourse.processing.org/t/i-dont-want-this-line-how-to-remove-it/20865 "2020-05-15T06:22:38Z")

</div>

I need to draw an electrical circuit using processing… and I am almost done. I need to draw them using some “vertex” codes. But there is a diagonally line that appeared and I can’t remove it. The lines are changing posit…

---

## [Growing and shrinking ellipse](https://discourse.processing.org/t/growing-and-shrinking-ellipse/20838)

<div class="topic-metadata">

**Author:** [@Filo96ge](https://discourse.processing.org/u/Filo96ge)\
**Replies:** 6\
**Last updated:** [May 15, 2020, 4:38am UTC](https://discourse.processing.org/t/growing-and-shrinking-ellipse/20838 "2020-05-15T04:38:08Z")

</div>

Hello! I’m working on a simple exercise but I am stuck, basically my goal is to have an animation of a ellipse growing untill touch the square’s corner and shrinking in the opposite direction untill its diameter is 0 the…

---

## [Background colour change](https://discourse.processing.org/t/background-colour-change/20855)

<div class="topic-metadata">

**Author:** [@ree311](https://discourse.processing.org/u/ree311)\
**Replies:** 2\
**Last updated:** [May 15, 2020, 4:13am UTC](https://discourse.processing.org/t/background-colour-change/20855 "2020-05-15T04:13:19Z")

</div>

Hello, I am a beginner trying to create a real-time art for an assignment in processing with true or false conditions and a mouse press. So far I have been able to play around and gain understanding with some code I fo…

---

## [Continue rotating a circular image with mouseDragged where it was left off](https://discourse.processing.org/t/continue-rotating-a-circular-image-with-mousedragged-where-it-was-left-off/20759)

<div class="topic-metadata">

**Author:** [@soraiaxb](https://discourse.processing.org/u/soraiaxb)\
**Replies:** 3\
**Last updated:** [May 15, 2020, 2:58am UTC](https://discourse.processing.org/t/continue-rotating-a-circular-image-with-mousedragged-where-it-was-left-off/20759 "2020-05-15T02:58:07Z")

</div>

Hi, I’m trying to rotate a circular image on mouseDragged and I got the image to rotate when dragging the mouse but when I stop dragging and start dragging again from a different position of the image it doesn’t continue…

---

## [How to click on a moving ellipse](https://discourse.processing.org/t/how-to-click-on-a-moving-ellipse/20864)

<div class="topic-metadata">

**Author:** [@jaiy](https://discourse.processing.org/u/jaiy)\
**Replies:** 15\
**Last updated:** [May 14, 2020, 3:00pm UTC](https://discourse.processing.org/t/how-to-click-on-a-moving-ellipse/20864 "2020-05-14T15:00:30Z")

</div>

Urgently need help on finishing my project its called the dropping ball game and everytime the ball drops you would click on it and the score would go up by 1 and vice versa but having a hard time clicking on the ellipse…

---

## [Problem with Scoreboard in game](https://discourse.processing.org/t/problem-with-scoreboard-in-game/20892)

<div class="topic-metadata">

**Author:** [@jaiy](https://discourse.processing.org/u/jaiy)\
**Replies:** 2\
**Last updated:** [May 15, 2020, 2:00am UTC](https://discourse.processing.org/t/problem-with-scoreboard-in-game/20892 "2020-05-15T02:00:11Z")

</div>

Having some issues with my scoreboard I am trying to use missed++ whenever the ellipse hits the line before the scoreboard missed should plus one every time but it does not work. If someone could help me that would be gr…

---

## [Problem with my game](https://discourse.processing.org/t/problem-with-my-game/20888)

<div class="topic-metadata">

**Author:** [@jaiy](https://discourse.processing.org/u/jaiy)\
**Replies:** 2\
**Last updated:** [May 15, 2020, 12:47am UTC](https://discourse.processing.org/t/problem-with-my-game/20888 "2020-05-15T00:47:21Z")

</div>

I am having trouble with my int missed I can’t get it to work like I want it to count as a missed as soon as it touches the line before the scoreboard and every time missed plus one the score would decrease by one. If an…

---

## [Difficulty with mouseX & mouseY](https://discourse.processing.org/t/difficulty-with-mousex-mousey/20641)

<div class="topic-metadata">

**Author:** [@Ted](https://discourse.processing.org/u/Ted)\
**Replies:** 3\
**Last updated:** [May 9, 2020, 6:23am UTC](https://discourse.processing.org/t/difficulty-with-mousex-mousey/20641 "2020-05-09T06:23:14Z")

</div>

I am VERY new to Java programming, (about a week now), and trying to complete a very simple Simon Says type game, (where you click on the colored boxes that randomly flash). My is I can’t get my mouse X & Y coordinates …

---

## [Random function and constrain](https://discourse.processing.org/t/random-function-and-constrain/20505)

<div class="topic-metadata">

**Author:** [@Filo96ge](https://discourse.processing.org/u/Filo96ge)\
**Replies:** 4\
**Last updated:** [May 14, 2020, 10:56pm UTC](https://discourse.processing.org/t/random-function-and-constrain/20505 "2020-05-14T22:56:50Z")

</div>

Hello everybody, I’m working on a small personal exercise and I cannot undestrand how to avoid the born of random ball inside of the small square. The idea is to fill only the white square and leave the pink-center squa…

---

## [Movement question?](https://discourse.processing.org/t/movement-question/20876)

<div class="topic-metadata">

**Author:** [@bscohen06](https://discourse.processing.org/u/bscohen06)\
**Replies:** 4\
**Last updated:** [May 14, 2020, 10:37pm UTC](https://discourse.processing.org/t/movement-question/20876 "2020-05-14T22:37:33Z")

</div>

So I coding movement and it works but I can not move diagonally and only do one input at once how do I fix this?

---

## [Question about loadstrings() function](https://discourse.processing.org/t/question-about-loadstrings-function/20824)

<div class="topic-metadata">

**Author:** [@David](https://discourse.processing.org/u/David)\
**Replies:** 4\
**Last updated:** [May 14, 2020, 4:48pm UTC](https://discourse.processing.org/t/question-about-loadstrings-function/20824 "2020-05-14T16:48:24Z")

</div>

Hi! Is it expected behaviour for the ‘loadstrings()’ function to skip blank or empty lines in Processing 3? The documentation doesn’t mention this, but that seems to be the case. I’m loading a small text file which has …

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

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