# Coding Questions

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

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

**Page:** 106

---

## [Mouse wrap around monitor / extend cycle of mouse around screen](https://discourse.processing.org/t/mouse-wrap-around-monitor-extend-cycle-of-mouse-around-screen/18563)

<div class="topic-metadata">

**Author:** [@ZvivZ](https://discourse.processing.org/u/ZvivZ)\
**Replies:** 1\
**Last updated:** [March 11, 2020, 6:26am UTC](https://discourse.processing.org/t/mouse-wrap-around-monitor-extend-cycle-of-mouse-around-screen/18563 "2020-03-11T06:26:41Z")

</div>

Is there a way in Processing to make the mouse cycle around the screen and keep giving mouseX/mouseY positions? This would be for games that use a trackball or spinner. I’m able to use a third party program (CursorUS) …

---

## [SVG file throwing nullPointerException](https://discourse.processing.org/t/svg-file-throwing-nullpointerexception/18466)

<div class="topic-metadata">

**Author:** [@martinh](https://discourse.processing.org/u/martinh)\
**Replies:** 6\
**Last updated:** [March 11, 2020, 2:49am UTC](https://discourse.processing.org/t/svg-file-throwing-nullpointerexception/18466 "2020-03-11T02:49:19Z")

</div>

I was given some svg files by a colleague for incorporating a project I’m working on, but it’s throwing a nullPointerException error (Actuator.svg). snowman.svg is loading fine. Actuator was cause a style error, but I …

---

## [Different Hole Score Question](https://discourse.processing.org/t/different-hole-score-question/18575)

<div class="topic-metadata">

**Author:** [@Dr.Dremur](https://discourse.processing.org/u/Dr.Dremur)\
**Replies:** 1\
**Last updated:** [March 10, 2020, 11:32pm UTC](https://discourse.processing.org/t/different-hole-score-question/18575 "2020-03-10T23:32:30Z")

</div>

Due to other projects and not a lot of time left, my golf game for processing has been adjusting to fit time loss. My new idea for now is a golf skee ball. I have the code to throw the golf ball, but I’m trying to figure…

---

## [Updating the Collision between 2 ellipses](https://discourse.processing.org/t/updating-the-collision-between-2-ellipses/18559)

<div class="topic-metadata">

**Author:** [@Yorunoshi](https://discourse.processing.org/u/Yorunoshi)\
**Replies:** 1\
**Last updated:** [March 10, 2020, 6:48pm UTC](https://discourse.processing.org/t/updating-the-collision-between-2-ellipses/18559 "2020-03-10T18:48:40Z")

</div>

I want the ellipse from “Gegner” to collapse and kill the ellipses from “Dot” can you guys help me? This is the Code: https://codeshare.io/5zpWyr

---

## [What is happening to this Array?](https://discourse.processing.org/t/what-is-happening-to-this-array/18502)

<div class="topic-metadata">

**Author:** [@NoClue](https://discourse.processing.org/u/NoClue)\
**Replies:** 3\
**Last updated:** [March 10, 2020, 6:45am UTC](https://discourse.processing.org/t/what-is-happening-to-this-array/18502 "2020-03-10T06:45:36Z")

</div>

Hello, everybody :smiley: This will be a looong first post. And the error will be embarrassing minor… At first click trough this first code (‘s’ to start and then ‘n’ to proceed until nothing happens), then you’ll get…

---

## [Make clouds move](https://discourse.processing.org/t/make-clouds-move/18465)

<div class="topic-metadata">

**Author:** [@M.juliet](https://discourse.processing.org/u/M.juliet)\
**Replies:** 4\
**Last updated:** [March 9, 2020, 6:04pm UTC](https://discourse.processing.org/t/make-clouds-move/18465 "2020-03-09T18:04:23Z")

</div>

Hi, I’m writing some code where I’ve drawn a few clouds in a for loop. Now I want to make these clouds move like they’re coming out of the factory with a while loop. I need them to constantly be moving (not that you can …

---

## [Change Ball's Color After Collision](https://discourse.processing.org/t/change-balls-color-after-collision/18521)

<div class="topic-metadata">

**Author:** [@Nadiantara](https://discourse.processing.org/u/Nadiantara)\
**Replies:** 2\
**Last updated:** [March 9, 2020, 11:53am UTC](https://discourse.processing.org/t/change-balls-color-after-collision/18521 "2020-03-09T11:53:51Z")

</div>

Hello! I’m trying to make a simulation about hard-sphere collision with some modifications and I’ve been stuck for days. This is the output : However, I want the blue ball to turn its color to red after collided with…

---

## [Word cloud with data](https://discourse.processing.org/t/word-cloud-with-data/18514)

<div class="topic-metadata">

**Author:** [@anb97871](https://discourse.processing.org/u/anb97871)\
**Replies:** 1\
**Last updated:** [March 9, 2020, 8:15am UTC](https://discourse.processing.org/t/word-cloud-with-data/18514 "2020-03-09T08:15:31Z")

</div>

Hi. I am so new to processing and starting a project where I need to upload data from a csv and take data to display with scale and map of the data. It is simple data and have been able to upload the data. A sample of …

---

## [PShape issues with noFill()](https://discourse.processing.org/t/pshape-issues-with-nofill/18505)

<div class="topic-metadata">

**Author:** [@esc746](https://discourse.processing.org/u/esc746)\
**Replies:** 1\
**Last updated:** [March 8, 2020, 10:20pm UTC](https://discourse.processing.org/t/pshape-issues-with-nofill/18505 "2020-03-08T22:20:41Z")

</div>

When using PShape the noFill() method appears to be missing in action. The following code demonstrates a workaround. Curiously, if I try the P2D renderer, I get no circles at all. Note also the comment about setStrokeW…

---

## [I have a problem to ask](https://discourse.processing.org/t/i-have-a-problem-to-ask/18500)

<div class="topic-metadata">

**Author:** [@marika20](https://discourse.processing.org/u/marika20)\
**Replies:** 13\
**Last updated:** [March 8, 2020, 8:08pm UTC](https://discourse.processing.org/t/i-have-a-problem-to-ask/18500 "2020-03-08T20:08:06Z")

</div>

Goodmorning everyone, I have a problem with a code I’m working on but I don’t understand what’s wrong, someone who can help me out? int randomNum; //boolean contenitore \[\]; boolean\[\] contenitoreVario = new boolean \[5\]…

---

## [How to get uniform appearance of color brightness](https://discourse.processing.org/t/how-to-get-uniform-appearance-of-color-brightness/18471)

<div class="topic-metadata">

**Author:** [@ddownn](https://discourse.processing.org/u/ddownn)\
**Replies:** 4\
**Last updated:** [March 8, 2020, 5:50pm UTC](https://discourse.processing.org/t/how-to-get-uniform-appearance-of-color-brightness/18471 "2020-03-08T17:50:24Z")

</div>

Is there a formula to adjust HSB values to adjust the apparent brightness of colors? Everything except the greens and blues seem way too dark here, I was hoping for a more uniform appearance. The background is 50% gray. …

---

## [Draw a square line by line](https://discourse.processing.org/t/draw-a-square-line-by-line/18059)

<div class="topic-metadata">

**Author:** [@MichelO](https://discourse.processing.org/u/MichelO)\
**Replies:** 12\
**Last updated:** [March 8, 2020, 12:42pm UTC](https://discourse.processing.org/t/draw-a-square-line-by-line/18059 "2020-03-08T12:42:53Z")

</div>

I am trying to draw a square one line at a time, with a keypress. In other words, press “1” to draw a line, turn 90 degrees, press “1” to draw a line, turn 90 degrees, etc. I know about the rectangle function. This is ju…

---

## [How can i make it a 2 player game](https://discourse.processing.org/t/how-can-i-make-it-a-2-player-game/18418)

<div class="topic-metadata">

**Author:** [@KristianChannel](https://discourse.processing.org/u/KristianChannel)\
**Replies:** 2\
**Last updated:** [March 7, 2020, 11:48pm UTC](https://discourse.processing.org/t/how-can-i-make-it-a-2-player-game/18418 "2020-03-07T23:48:10Z")

</div>

Im am working on this project and can’t seem to understand how i can make the ball react to the second paddle aswell as the first. Have in mind that im a beginner and don’t understand a lot of code. Translation: Fart =…

---

## [Creating a Maze Game (Walls Not Working)](https://discourse.processing.org/t/creating-a-maze-game-walls-not-working/18392)

<div class="topic-metadata">

**Author:** [@burakkuboido](https://discourse.processing.org/u/burakkuboido)\
**Replies:** 3\
**Last updated:** [March 7, 2020, 10:37pm UTC](https://discourse.processing.org/t/creating-a-maze-game-walls-not-working/18392 "2020-03-07T22:37:44Z")

</div>

Hey guys, I’ve recently tried making a maze game using 2d arrays. I know this might not be the best way but I’m trying to keep doing this way. Could anyone help me understand why the first wall in the array is registere…

---

## [Hitbox around a triangle?](https://discourse.processing.org/t/hitbox-around-a-triangle/18473)

<div class="topic-metadata">

**Author:** [@anon94203042](https://discourse.processing.org/u/anon94203042)\
**Replies:** 6\
**Last updated:** [March 7, 2020, 9:55pm UTC](https://discourse.processing.org/t/hitbox-around-a-triangle/18473 "2020-03-07T21:55:56Z")

</div>

Is there an accurate way to create a hitbox (for collision detection) around a triangle?

---

## [Turn many subclass specific methods into one](https://discourse.processing.org/t/turn-many-subclass-specific-methods-into-one/18463)

<div class="topic-metadata">

**Author:** [@creepercrack](https://discourse.processing.org/u/creepercrack)\
**Replies:** 1\
**Last updated:** [March 6, 2020, 10:45pm UTC](https://discourse.processing.org/t/turn-many-subclass-specific-methods-into-one/18463 "2020-03-06T22:45:20Z")

</div>

Hello I have 4 different methods to get different objects that derive from a superclass, I want to be able to call a method passing a class as a parameter and getting an ArrayList This are the 4 methods: ArrayList\<Cam…

---

## [Fxml-file integrate in processing?](https://discourse.processing.org/t/fxml-file-integrate-in-processing/18325)

<div class="topic-metadata">

**Author:** [@em\_sha](https://discourse.processing.org/u/em_sha)\
**Replies:** 11\
**Last updated:** [March 7, 2020, 5:43pm UTC](https://discourse.processing.org/t/fxml-file-integrate-in-processing/18325 "2020-03-07T17:43:08Z")

</div>

Hi :slight\_smile: Is there a possibility to integrate a fxml-file in processing? If there is one, could somebody give me an example? Thanks. M.

---

## [Reliable way to make smooth 3D objects?](https://discourse.processing.org/t/reliable-way-to-make-smooth-3d-objects/18322)

<div class="topic-metadata">

**Author:** [@BennyHacker](https://discourse.processing.org/u/BennyHacker)\
**Replies:** 4\
**Last updated:** [March 7, 2020, 5:21pm UTC](https://discourse.processing.org/t/reliable-way-to-make-smooth-3d-objects/18322 "2020-03-07T17:21:54Z")

</div>

Is there a way to make 3D objects in Processing that don’t appear as polygonal? Currently I make 3D shapes by using functions such as beginShape(TRIANGLE\_STRIP), but I would like to learn the more technical aspects. If …

---

## [Getting Swing and Processing to work together](https://discourse.processing.org/t/getting-swing-and-processing-to-work-together/18486)

<div class="topic-metadata">

**Author:** [@Dinoswarleafs](https://discourse.processing.org/u/Dinoswarleafs)\
**Replies:** 0\
**Last updated:** [March 7, 2020, 4:58pm UTC](https://discourse.processing.org/t/getting-swing-and-processing-to-work-together/18486 "2020-03-07T16:58:44Z")

</div>

Hey, Right now I’m creating an application with Swing and Processing in separate windows. I’ve verified the Processing methods I call are functional, so I believe the following issues occur because Processing and Swing …

---

## [Water flow simulation](https://discourse.processing.org/t/water-flow-simulation/18225)

<div class="topic-metadata">

**Author:** [@LuckSmith](https://discourse.processing.org/u/LuckSmith)\
**Replies:** 5\
**Last updated:** [March 6, 2020, 7:12pm UTC](https://discourse.processing.org/t/water-flow-simulation/18225 "2020-03-06T19:12:37Z")

</div>

Hi, guys, it’s been a while :slight\_smile: Please take a look at https://www.openprocessing.org/sketch/845420 Please be sure to run it not from the browser, because it’s slow. In shortly, what it does: Creates a hig…

---

## [Want My Own Shape for this code](https://discourse.processing.org/t/want-my-own-shape-for-this-code/18366)

<div class="topic-metadata">

**Author:** [@heelaries](https://discourse.processing.org/u/heelaries)\
**Replies:** 2\
**Last updated:** [March 6, 2020, 6:06pm UTC](https://discourse.processing.org/t/want-my-own-shape-for-this-code/18366 "2020-03-06T18:06:55Z")

</div>

I want to add my own image/shape to this code. This is the code from processing I want to add the image to: int num = 50; int\[\] x = new int\[num\]; int\[\] y = new int\[num\]; void setup() { size(100, 100); noStroke(); …

---

## [Rotate sun keyPressed](https://discourse.processing.org/t/rotate-sun-keypressed/18429)

<div class="topic-metadata">

**Author:** [@M.juliet](https://discourse.processing.org/u/M.juliet)\
**Replies:** 3\
**Last updated:** [March 6, 2020, 7:49am UTC](https://discourse.processing.org/t/rotate-sun-keypressed/18429 "2020-03-06T07:49:47Z")

</div>

Hi, I’m writing some code for a animation project and I want to let ellipses move around a sun. I have four ellipses that move four times around the sun and I want to let them move around when you press the up or the dow…

---

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

<div class="topic-metadata">

**Author:** [@Vickydcl](https://discourse.processing.org/u/Vickydcl)\
**Replies:** 2\
**Last updated:** [March 5, 2020, 9:53pm UTC](https://discourse.processing.org/t/processing-js-html-and-php-issue/18372 "2020-03-05T21:53:12Z")

</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…

---

## [Pixel sorting (time and pixel increment)](https://discourse.processing.org/t/pixel-sorting-time-and-pixel-increment/18321)

<div class="topic-metadata">

**Author:** [@Alexx](https://discourse.processing.org/u/Alexx)\
**Replies:** 1\
**Last updated:** [March 5, 2020, 7:42pm UTC](https://discourse.processing.org/t/pixel-sorting-time-and-pixel-increment/18321 "2020-03-05T19:42:14Z")

</div>

Hi! In this sketch by Kim Asendorf a pixel sorting is performed only once. Is it possible to give movement to this pixel sorting? And most importantly, how can you increase this pixel sorting? int mode = 1; PImage b…

---

## [Why can't I use the back button in state 2?](https://discourse.processing.org/t/why-cant-i-use-the-back-button-in-state-2/18360)

<div class="topic-metadata">

**Author:** [@MonteliaRO](https://discourse.processing.org/u/MonteliaRO)\
**Replies:** 23\
**Last updated:** [March 3, 2020, 8:43pm UTC](https://discourse.processing.org/t/why-cant-i-use-the-back-button-in-state-2/18360 "2020-03-03T20:43:14Z")

</div>

I want to go back to start 0 when I’m in start 2, why is that not possible? Code::point\_down: float mainx1 = 300; float mainy1 = 400; float mainw1 = 500; float mainh1 = 250; float mainx2 = 900; float mainy2 = 400; floa…

---

## [Dist from mouse to ellipse](https://discourse.processing.org/t/dist-from-mouse-to-ellipse/18157)

<div class="topic-metadata">

**Author:** [@NotConsumable](https://discourse.processing.org/u/NotConsumable)\
**Replies:** 2\
**Last updated:** [March 3, 2020, 6:55pm UTC](https://discourse.processing.org/t/dist-from-mouse-to-ellipse/18157 "2020-03-03T18:55:17Z")

</div>

i am trying to make 4 different circles appear around my mouse depending how far away i am from a randomly occurring ellipse and i was wondering how i would implement a dist function within an if statement in order to ma…

---

## [Change color of one rect in grid](https://discourse.processing.org/t/change-color-of-one-rect-in-grid/18349)

<div class="topic-metadata">

**Author:** [@Roy1825](https://discourse.processing.org/u/Roy1825)\
**Replies:** 3\
**Last updated:** [March 3, 2020, 4:10pm UTC](https://discourse.processing.org/t/change-color-of-one-rect-in-grid/18349 "2020-03-03T16:10:39Z")

</div>

Hi everyone! I created a grid of rects using a 2d array. I now want to be able to click on a rect and have it change its color. With the code I have now, all rects change color when clicked. What am I doing wrong? int …

---

## [How to get next vertex from array](https://discourse.processing.org/t/how-to-get-next-vertex-from-array/18284)

<div class="topic-metadata">

**Author:** [@ddownn](https://discourse.processing.org/u/ddownn)\
**Replies:** 1\
**Last updated:** [March 2, 2020, 2:09pm UTC](https://discourse.processing.org/t/how-to-get-next-vertex-from-array/18284 "2020-03-02T14:09:48Z")

</div>

I have an array of points, and in a loop through them I want to get a reference to the next point that is a vertex. It seems like I’m close here but what am I doing wrong? nVertices is intended to represent the vertices…

---

## [Boids nearest 7 neighbours](https://discourse.processing.org/t/boids-nearest-7-neighbours/18272)

<div class="topic-metadata">

**Author:** [@Blackclo](https://discourse.processing.org/u/Blackclo)\
**Replies:** 4\
**Last updated:** [March 3, 2020, 12:24pm UTC](https://discourse.processing.org/t/boids-nearest-7-neighbours/18272 "2020-03-03T12:24:29Z")

</div>

I’m trying to adapt https://www.processing.org/examples/flocking.html limiting the number of neighbours a boid can see to 7 based on closest distance. But I am struggling can someone help

---

## [Vertical Pixel Sorting on image](https://discourse.processing.org/t/vertical-pixel-sorting-on-image/17419)

<div class="topic-metadata">

**Author:** [@Alexx](https://discourse.processing.org/u/Alexx)\
**Replies:** 7\
**Last updated:** [March 3, 2020, 9:50am UTC](https://discourse.processing.org/t/vertical-pixel-sorting-on-image/17419 "2020-03-03T09:50:40Z")

</div>

Hi. I’m new to Processing. Hope someone is able to help me. I have two answer: In my sketch the pixel sorting work on width, but I I need it to be vertical non horizontal … how? The pixel sorting start and finishing a…

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

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