# Coding Questions

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

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

**Page:** 113

---

## [Turning randomly placed buttons off and on via boolean switch](https://discourse.processing.org/t/turning-randomly-placed-buttons-off-and-on-via-boolean-switch/16917)

<div class="topic-metadata">

**Author:** [@debxyz](https://discourse.processing.org/u/debxyz)\
**Replies:** 3\
**Last updated:** [January 6, 2020, 11:03pm UTC](https://discourse.processing.org/t/turning-randomly-placed-buttons-off-and-on-via-boolean-switch/16917 "2020-01-06T23:03:14Z")

</div>

I think this is a question about program flow and how to enable user interaction. Currently working on a problem in Shiffman book. I want to create multiple buttons (currently 2 buttons in this version) via object cla…

---

## [How to draw a curve using its equation?](https://discourse.processing.org/t/how-to-draw-a-curve-using-its-equation/16870)

<div class="topic-metadata">

**Author:** [@Anelim](https://discourse.processing.org/u/Anelim)\
**Replies:** 6\
**Last updated:** [January 6, 2020, 8:18pm UTC](https://discourse.processing.org/t/how-to-draw-a-curve-using-its-equation/16870 "2020-01-06T20:18:22Z")

</div>

Hi. I am new in using Processing and, also, new asking something here :slightly\_smiling\_face: I hope that will get some help here and solve my problem. There is an equation of elliptic curve that I would like to draw …

---

## [Light emitting outwards from a sphere](https://discourse.processing.org/t/light-emitting-outwards-from-a-sphere/16904)

<div class="topic-metadata">

**Author:** [@olsxn](https://discourse.processing.org/u/olsxn)\
**Replies:** 2\
**Last updated:** [January 6, 2020, 7:54pm UTC](https://discourse.processing.org/t/light-emitting-outwards-from-a-sphere/16904 "2020-01-06T19:54:55Z")

</div>

I have created a small representation of the solar system and, at the moment, I have an ambient light and directional light in the scene. However, I would like to have the light emitting from the “Sun” outwards in all d…

---

## [How to make 3D out of this assignment?](https://discourse.processing.org/t/how-to-make-3d-out-of-this-assignment/16885)

<div class="topic-metadata">

**Author:** [@nuhic](https://discourse.processing.org/u/nuhic)\
**Replies:** 4\
**Last updated:** [January 6, 2020, 5:44pm UTC](https://discourse.processing.org/t/how-to-make-3d-out-of-this-assignment/16885 "2020-01-06T17:44:46Z")

</div>

Hi, I am new to this, so maybe I am not supposed to send it like this… I would be very grateful if someone could help me to make a 3D out of this project that I have, I am stuck. When you start it, you’ll see what happe…

---

## [Grid-based Particle Movement „Formula“ works incorrectly](https://discourse.processing.org/t/grid-based-particle-movement-formula-works-incorrectly/16794)

<div class="topic-metadata">

**Author:** [@Lexyth](https://discourse.processing.org/u/Lexyth)\
**Replies:** 11\
**Last updated:** [January 5, 2020, 10:19pm UTC](https://discourse.processing.org/t/grid-based-particle-movement-formula-works-incorrectly/16794 "2020-01-05T22:19:21Z")

</div>

I‘ve been having a bit of trouble with this for a while and finally found a solution (more or less). What i‘m trying to achieve is basically something like a Grid-based Wave Simulation (only that waves would propagate i…

---

## [Feedback on expandible digit display](https://discourse.processing.org/t/feedback-on-expandible-digit-display/16838)

<div class="topic-metadata">

**Author:** [@SWijnen](https://discourse.processing.org/u/SWijnen)\
**Replies:** 7\
**Last updated:** [January 5, 2020, 4:44am UTC](https://discourse.processing.org/t/feedback-on-expandible-digit-display/16838 "2020-01-05T04:44:32Z")

</div>

Hello everyone, I made an expandable digit display and I am wondering what you think of it. (As you can maybe see) I am new to coding and made this myself. I did not copy anything from the internet. Does anyone has any …

---

## [My program keeps crashing; STRING (file) to INT](https://discourse.processing.org/t/my-program-keeps-crashing-string-file-to-int/16872)

<div class="topic-metadata">

**Author:** [@CodeMasterX](https://discourse.processing.org/u/CodeMasterX)\
**Replies:** 2\
**Last updated:** [January 5, 2020, 3:53am UTC](https://discourse.processing.org/t/my-program-keeps-crashing-string-file-to-int/16872 "2020-01-05T03:53:10Z")

</div>

the first segment of code is the issue, without it, it works fine. I have tried int(string), Intiger.valueOf and Intiger.ParseInt. If you have any ideas pls tell me. (btw i saw no issue with the file, if you want i can l…

---

## [Save command in void?](https://discourse.processing.org/t/save-command-in-void/16863)

<div class="topic-metadata">

**Author:** [@Optyfen\_met\_Eenden](https://discourse.processing.org/u/Optyfen_met_Eenden)\
**Replies:** 4\
**Last updated:** [January 4, 2020, 7:03pm UTC](https://discourse.processing.org/t/save-command-in-void/16863 "2020-01-04T19:03:50Z")

</div>

Hi! I’m new to Processing and also to this forum. I got some trouble with the void command; I couldn’t use a save(""); in a void. See an example below, when I execute it, it will say “ArrayIndexOutOfBoundsException: Coo…

---

## [Sketch does not always have focus on start up](https://discourse.processing.org/t/sketch-does-not-always-have-focus-on-start-up/16834)

<div class="topic-metadata">

**Author:** [@rhole](https://discourse.processing.org/u/rhole)\
**Replies:** 6\
**Last updated:** [January 4, 2020, 3:57pm UTC](https://discourse.processing.org/t/sketch-does-not-always-have-focus-on-start-up/16834 "2020-01-04T15:57:18Z")

</div>

I have a sketch which frequently does not gain focus at start-up. I was able to solve this: boolean \_focusConfirmed= false; void draw(){ // ensure focus comes to this sketch on start-up if (millis() \< 20000 && !\_focu…

---

## [Creating a moving snake on a predefined grid](https://discourse.processing.org/t/creating-a-moving-snake-on-a-predefined-grid/16854)

<div class="topic-metadata">

**Author:** [@Reynaert98](https://discourse.processing.org/u/Reynaert98)\
**Replies:** 2\
**Last updated:** [January 4, 2020, 11:30am UTC](https://discourse.processing.org/t/creating-a-moving-snake-on-a-predefined-grid/16854 "2020-01-04T11:30:04Z")

</div>

I’m working on a game on which a snake/ centipede can move on a grid by mouseclicking on grid spaces next to it. Its body consists of 10 pieces which all follow the previous locations of its head. My question is, where d…

---

## [Where can I find rules for different cellular automata?](https://discourse.processing.org/t/where-can-i-find-rules-for-different-cellular-automata/16827)

<div class="topic-metadata">

**Author:** [@Ruchi](https://discourse.processing.org/u/Ruchi)\
**Replies:** 3\
**Last updated:** [January 4, 2020, 5:23am UTC](https://discourse.processing.org/t/where-can-i-find-rules-for-different-cellular-automata/16827 "2020-01-04T05:23:26Z")

</div>

https://www.conwaylife.com/wiki/List\_of\_Life-like\_cellular\_automata This site mentions list of various cellular automata. But no description further of the rules. Any reference as to where I can find the rules?

---

## [Move background](https://discourse.processing.org/t/move-background/16818)

<div class="topic-metadata">

**Author:** [@nati1704](https://discourse.processing.org/u/nati1704)\
**Replies:** 3\
**Last updated:** [January 4, 2020, 4:09am UTC](https://discourse.processing.org/t/move-background/16818 "2020-01-04T04:09:15Z")

</div>

Hi I try to make a little game where the background has to move. I´ve made an own background with photohop beforehand, which has a larger width than the sketch. Now I wanted to know HOW can I insert an photo,which has…

---

## [hint(ENABLE\_DEPTH\_SORT) issues](https://discourse.processing.org/t/hint-enable-depth-sort-issues/16804)

<div class="topic-metadata">

**Author:** [@iofthebeholder](https://discourse.processing.org/u/iofthebeholder)\
**Replies:** 4\
**Last updated:** [January 2, 2020, 7:46pm UTC](https://discourse.processing.org/t/hint-enable-depth-sort-issues/16804 "2020-01-02T19:46:05Z")

</div>

working on a P3D sketch with many semi-transparent, moving geometries distributed in space. finding transparency renders as desired on when i use hint(ENABLE\_DEPTH\_SORT); however, there seems to be some kind of bufferi…

---

## [How to Find Percentage of a Quiz On Processing](https://discourse.processing.org/t/how-to-find-percentage-of-a-quiz-on-processing/15910)

<div class="topic-metadata">

**Author:** [@seerhallow12247](https://discourse.processing.org/u/seerhallow12247)\
**Replies:** 11\
**Last updated:** [January 2, 2020, 4:45pm UTC](https://discourse.processing.org/t/how-to-find-percentage-of-a-quiz-on-processing/15910 "2020-01-02T16:45:23Z")

</div>

Hi. I am making a quiz using processing. Our teacher instructed us to create the function findPercent, which will find the percent of the quiz using the variable totalCorrect (represents the answers the user got correct …

---

## [Creating woven patterns ... beginner](https://discourse.processing.org/t/creating-woven-patterns-beginner/16788)

<div class="topic-metadata">

**Author:** [@Lee14](https://discourse.processing.org/u/Lee14)\
**Replies:** 3\
**Last updated:** [January 2, 2020, 1:42pm UTC](https://discourse.processing.org/t/creating-woven-patterns-beginner/16788 "2020-01-02T13:42:54Z")

</div>

I am looking to create a sketch which draws a woven pattern … that is, mimics woven cloth … so with warp and weft. I would like to do it, as a beginner coder, using pixels to draw it … but am a bit confused. I have been …

---

## [CODE CRASHED PLEASE HELP (21 sticks game / AI CRASHES)](https://discourse.processing.org/t/code-crashed-please-help-21-sticks-game-ai-crashes/16802)

<div class="topic-metadata">

**Author:** [@pothead](https://discourse.processing.org/u/pothead)\
**Replies:** 13\
**Last updated:** [January 2, 2020, 11:53am UTC](https://discourse.processing.org/t/code-crashed-please-help-21-sticks-game-ai-crashes/16802 "2020-01-02T11:53:59Z")

</div>

So far here is my code Pretty Much there is 21 sticks in the beginning the player gets choice between picking 1 or 2 sticks and the AI gets to pick the Sticks when its turn,The one who is forced to pick the last stick l…

---

## [Hi, I have a error in my code please help project due (MEMORY GAME)](https://discourse.processing.org/t/hi-i-have-a-error-in-my-code-please-help-project-due-memory-game/16749)

<div class="topic-metadata">

**Author:** [@pothead](https://discourse.processing.org/u/pothead)\
**Replies:** 10\
**Last updated:** [January 2, 2020, 7:44am UTC](https://discourse.processing.org/t/hi-i-have-a-error-in-my-code-please-help-project-due-memory-game/16749 "2020-01-02T07:44:43Z")

</div>

So I am trying to make a memory game with an AI that chooses cards after my turn and when you find pair of cards that matches, it deletes and moves it to the side. I am having ARRAY OUT OF BOUNDS on my code if someon…

---

## [How do I detect collision with the background color in Processing 3 (java)?](https://discourse.processing.org/t/how-do-i-detect-collision-with-the-background-color-in-processing-3-java/16779)

<div class="topic-metadata">

**Author:** [@CharmanderProgrammer](https://discourse.processing.org/u/CharmanderProgrammer)\
**Replies:** 1\
**Last updated:** [January 2, 2020, 1:04am UTC](https://discourse.processing.org/t/how-do-i-detect-collision-with-the-background-color-in-processing-3-java/16779 "2020-01-02T01:04:50Z")

</div>

I am creating a basic dungeon game where you spawn into a randomly generated dungeon and you need to fight monsters. I just did a random generator where it will move a simulated character around the screen and draw a pa…

---

## [Java Reflections cheatsheet for processing](https://discourse.processing.org/t/java-reflections-cheatsheet-for-processing/16778)

<div class="topic-metadata">

**Author:** [@paulgoux](https://discourse.processing.org/u/paulgoux)\
**Replies:** 5\
**Last updated:** [January 1, 2020, 10:34pm UTC](https://discourse.processing.org/t/java-reflections-cheatsheet-for-processing/16778 "2020-01-01T22:34:40Z")

</div>

Hi I am trying to create a cheatsheet for most things reflections in java, however I am currently struggling with some aspects of the code. Please note the code is not mine, original code can be found here. …

---

## [Brick Breaker Game - Problem with brick and ball interactions](https://discourse.processing.org/t/brick-breaker-game-problem-with-brick-and-ball-interactions/16763)

<div class="topic-metadata">

**Author:** [@shadowfire\_elite](https://discourse.processing.org/u/shadowfire_elite)\
**Replies:** 4\
**Last updated:** [January 1, 2020, 8:02pm UTC](https://discourse.processing.org/t/brick-breaker-game-problem-with-brick-and-ball-interactions/16763 "2020-01-01T20:02:00Z")

</div>

I’ve been trying for a long time to make a successful brick breaker game, but I’m still stuck on how to make the ball and bricks to interact. Can someone help me figure out a way for one brick to disappear when the ball …

---

## [Get Two Maximum values from array of numbers](https://discourse.processing.org/t/get-two-maximum-values-from-array-of-numbers/16517)

<div class="topic-metadata">

**Author:** [@tiarnola](https://discourse.processing.org/u/tiarnola)\
**Replies:** 2\
**Last updated:** [January 1, 2020, 3:52pm UTC](https://discourse.processing.org/t/get-two-maximum-values-from-array-of-numbers/16517 "2020-01-01T15:52:06Z")

</div>

Hi, I’ve got an array of numbers that looks like this: int \[\] numbers = { 2, 3, 8, 1, 8, 9, 6 }; I need to write a function that identifies 8 & 9 as the highest integers. I’ve seen plenty of solutions for returning on…

---

## [Loadpixels not working with forloop into pgraphic layer1](https://discourse.processing.org/t/loadpixels-not-working-with-forloop-into-pgraphic-layer1/16769)

<div class="topic-metadata">

**Author:** [@xrispy](https://discourse.processing.org/u/xrispy)\
**Replies:** 1\
**Last updated:** [January 1, 2020, 7:53am UTC](https://discourse.processing.org/t/loadpixels-not-working-with-forloop-into-pgraphic-layer1/16769 "2020-01-01T07:53:50Z")

</div>

Hi! I am attempting to load an image into a Pgraphic with creategraphics named layer 1 The intent is to be able to load an image, distort the r,g,b and update the pixels into the layer1 create graphic thus clipping the …

---

## [Prevent pause during FOR loops?](https://discourse.processing.org/t/prevent-pause-during-for-loops/16735)

<div class="topic-metadata">

**Author:** [@jetjaguar](https://discourse.processing.org/u/jetjaguar)\
**Replies:** 3\
**Last updated:** [December 31, 2019, 10:13pm UTC](https://discourse.processing.org/t/prevent-pause-during-for-loops/16735 "2019-12-31T22:13:42Z")

</div>

Hello everyone. I am using FOR loops to load CSV datasets from URLs in the draw whenever the end user wants the data loaded. It takes the program about 5 seconds to load/parse/display the data during which time the sket…

---

## [Iterating through an array with a timer - almost there?](https://discourse.processing.org/t/iterating-through-an-array-with-a-timer-almost-there/16726)

<div class="topic-metadata">

**Author:** [@juss](https://discourse.processing.org/u/juss)\
**Replies:** 11\
**Last updated:** [December 31, 2019, 1:38pm UTC](https://discourse.processing.org/t/iterating-through-an-array-with-a-timer-almost-there/16726 "2019-12-31T13:38:32Z")

</div>

Hi everyone! I am a beginner with Processing and currently trying to use an array filled with data in my sketch. I would like to iterate through the array so that the objects (circles) are drawn one by one. With my curr…

---

## [Trying to convert 2D flat image to 3D plane via rotateX](https://discourse.processing.org/t/trying-to-convert-2d-flat-image-to-3d-plane-via-rotatex/16719)

<div class="topic-metadata">

**Author:** [@johnfischbeck](https://discourse.processing.org/u/johnfischbeck)\
**Replies:** 1\
**Last updated:** [December 30, 2019, 12:38pm UTC](https://discourse.processing.org/t/trying-to-convert-2d-flat-image-to-3d-plane-via-rotatex/16719 "2019-12-30T12:38:24Z")

</div>

I’m trying to convert an equirectangular svg image with plotted lines that are bezier curves and text to a 3D plane so the arch lines rise up and I can move in and around once all is plotted. Trying to achieve an effect…

---

## [Arc length parametrization example interpolation understanding](https://discourse.processing.org/t/arc-length-parametrization-example-interpolation-understanding/16638)

<div class="topic-metadata">

**Author:** [@Ruchi](https://discourse.processing.org/u/Ruchi)\
**Replies:** 4\
**Last updated:** [December 30, 2019, 6:47am UTC](https://discourse.processing.org/t/arc-length-parametrization-example-interpolation-understanding/16638 "2019-12-30T06:47:06Z")

</div>

https://github.com/processing/processing-docs/blob/master/content/examples/Topics/Curves/ArcLengthParametrization/BezierCurve.pde I am having trouble understanding the interpolation of two surrounding indexes in equidis…

---

## [Creating your own complex Pimage](https://discourse.processing.org/t/creating-your-own-complex-pimage/16596)

<div class="topic-metadata">

**Author:** [@paulgoux](https://discourse.processing.org/u/paulgoux)\
**Replies:** 6\
**Last updated:** [December 29, 2019, 9:08pm UTC](https://discourse.processing.org/t/creating-your-own-complex-pimage/16596 "2019-12-29T21:08:39Z")

</div>

Not sure if this is a thing, but I like how processing allows you to manipulate pixels using loadPixels, and updatePixels. I understand that this topic probably treads on the domain of shaders, but as I have yet to grasp…

---

## [Float value to Byte array](https://discourse.processing.org/t/float-value-to-byte-array/16698)

<div class="topic-metadata">

**Author:** [@GeorgeJava](https://discourse.processing.org/u/GeorgeJava)\
**Replies:** 6\
**Last updated:** [December 29, 2019, 8:24pm UTC](https://discourse.processing.org/t/float-value-to-byte-array/16698 "2019-12-29T20:24:47Z")

</div>

Hello there how to convert float val to byte array ? i have this function that work in oposite way, it converts Byte array to Float value: public float byteArrayToFloat(byte test\[\]) { int MASK = 0xff; int bits = 0; …

---

## [Unable to open .dxf file](https://discourse.processing.org/t/unable-to-open-dxf-file/16703)

<div class="topic-metadata">

**Author:** [@bp396](https://discourse.processing.org/u/bp396)\
**Replies:** 8\
**Last updated:** [December 29, 2019, 7:54pm UTC](https://discourse.processing.org/t/unable-to-open-dxf-file/16703 "2019-12-29T19:54:59Z")

</div>

I am trying to save a sketch output as a dsx file. Am using this because I am looking to save a sketch using 3D bezier curves. Although the file appears to be saving, it will not open properly using Adobe Illustrator o…

---

## [Getting errors working with String Arrays](https://discourse.processing.org/t/getting-errors-working-with-string-arrays/16701)

<div class="topic-metadata">

**Author:** [@Salttt](https://discourse.processing.org/u/Salttt)\
**Replies:** 14\
**Last updated:** [December 29, 2019, 5:50pm UTC](https://discourse.processing.org/t/getting-errors-working-with-string-arrays/16701 "2019-12-29T17:50:10Z")

</div>

Beginner here, I get an error code whenever I try to run this small part of my code. Could someone help, I am trying to load an integer in string form loaded in hs.txt and only replace it when the highscore in the sessio…

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

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