# Coding Questions

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

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

**Page:** 71

---

## [Newbie Question: Use Json file to show a list of names one by one](https://discourse.processing.org/t/newbie-question-use-json-file-to-show-a-list-of-names-one-by-one/25837)

<div class="topic-metadata">

**Author:** [@denis](https://discourse.processing.org/u/denis)\
**Replies:** 10\
**Last updated:** [December 7, 2020, 12:03pm UTC](https://discourse.processing.org/t/newbie-question-use-json-file-to-show-a-list-of-names-one-by-one/25837 "2020-12-07T12:03:20Z")

</div>

Hi, I am trying to automate a list of names so that they appear to me one by one when I move my mouse. At first I did it with an array of images with the names inside and it worked. Now I am trying to convert it to a Jso…

---

## [I want to modify my resistor code to do something cool](https://discourse.processing.org/t/i-want-to-modify-my-resistor-code-to-do-something-cool/25904)

<div class="topic-metadata">

**Author:** [@DijaAngel](https://discourse.processing.org/u/DijaAngel)\
**Replies:** 6\
**Last updated:** [December 7, 2020, 11:28am UTC](https://discourse.processing.org/t/i-want-to-modify-my-resistor-code-to-do-something-cool/25904 "2020-12-07T11:28:30Z")

</div>

int bandValue=0;//defines bandvalue int countClicks=0;//defines countclicks int firstBand=0;//defines firstband int secondBand=0;//defines secondband int thirdBand=0;//defines thirdband int resistor\_value=0;//define…

---

## [Make rect when clicked](https://discourse.processing.org/t/make-rect-when-clicked/25987)

<div class="topic-metadata">

**Author:** [@Tyler](https://discourse.processing.org/u/Tyler)\
**Replies:** 3\
**Last updated:** [December 7, 2020, 3:21am UTC](https://discourse.processing.org/t/make-rect-when-clicked/25987 "2020-12-07T03:21:04Z")

</div>

I’ve been making a drawing project and I wanted the boxes on the left to change the colour of the ellipse and for the boxes on the right to change the colour of the background. It doesn’t matter if the background removes…

---

## [Optimizing for memory with images](https://discourse.processing.org/t/optimizing-for-memory-with-images/25772)

<div class="topic-metadata">

**Author:** [@SheCurvesMobius](https://discourse.processing.org/u/SheCurvesMobius)\
**Replies:** 11\
**Last updated:** [December 6, 2020, 9:23pm UTC](https://discourse.processing.org/t/optimizing-for-memory-with-images/25772 "2020-12-06T21:23:21Z")

</div>

Hi all, I’m working on a sketch that will require hundreds of thousands of large (3200 x 5000px) images to be drawn. However, I am just beginning to build the code and I am referencing only 15 images (not thousands), an…

---

## [Create pencil sketch from photo](https://discourse.processing.org/t/create-pencil-sketch-from-photo/25997)

<div class="topic-metadata">

**Author:** [@mikemcsharry](https://discourse.processing.org/u/mikemcsharry)\
**Replies:** 1\
**Last updated:** [December 6, 2020, 6:03pm UTC](https://discourse.processing.org/t/create-pencil-sketch-from-photo/25997 "2020-12-06T18:03:58Z")

</div>

Hello, I’m trying to make a pencil sketch from a jpeg image, I found this code using python libraries, but know nothing about Python. Is there a way to do this in processing, also is there a way to do it without alway…

---

## [System for saving objects](https://discourse.processing.org/t/system-for-saving-objects/25935)

<div class="topic-metadata">

**Author:** [@Rafsing](https://discourse.processing.org/u/Rafsing)\
**Replies:** 9\
**Last updated:** [December 5, 2020, 1:26am UTC](https://discourse.processing.org/t/system-for-saving-objects/25935 "2020-12-05T01:26:40Z")

</div>

I want to create a system for saving objects. I have three classes, that I want to save, to json format, but I don’t want to write by hand every variables. Is there any way that I can move the entire object to json form…

---

## [Passing (boolean) values from cell to cell in a grid](https://discourse.processing.org/t/passing-boolean-values-from-cell-to-cell-in-a-grid/25967)

<div class="topic-metadata">

**Author:** [@Namrad](https://discourse.processing.org/u/Namrad)\
**Replies:** 1\
**Last updated:** [December 4, 2020, 10:38pm UTC](https://discourse.processing.org/t/passing-boolean-values-from-cell-to-cell-in-a-grid/25967 "2020-12-04T22:38:56Z")

</div>

Hello, I’m having trouble solving a problem which I don’t think should be very difficult, yet I haven’t been able to come close to how to figure it out. The simplified version of my idea starts with a grid of objects, …

---

## [I need help with a project](https://discourse.processing.org/t/i-need-help-with-a-project/25952)

<div class="topic-metadata">

**Author:** [@psn](https://discourse.processing.org/u/psn)\
**Replies:** 2\
**Last updated:** [December 4, 2020, 8:00pm UTC](https://discourse.processing.org/t/i-need-help-with-a-project/25952 "2020-12-04T20:00:28Z")

</div>

Hello! I have made a sketch with bouncing balls, where every time i click, a new ball appears. I want every new ball to have a random colour. Thank you! //GLOBAL VARIABLES Ball myBall; Text myText; Cursor myCursor; fina…

---

## [Button with changing fading text](https://discourse.processing.org/t/button-with-changing-fading-text/25926)

<div class="topic-metadata">

**Author:** [@jenk](https://discourse.processing.org/u/jenk)\
**Replies:** 2\
**Last updated:** [December 4, 2020, 4:01pm UTC](https://discourse.processing.org/t/button-with-changing-fading-text/25926 "2020-12-04T16:01:31Z")

</div>

Hi. I know there’s something blindingly obvious wrong with this - but I’m too blind to know what it is. Would love some help if you can spare the time. The objective is for a button to have text that fades in and out …

---

## [How can I make a program that hits balls in processing?](https://discourse.processing.org/t/how-can-i-make-a-program-that-hits-balls-in-processing/25893)

<div class="topic-metadata">

**Author:** [@hahahajayden](https://discourse.processing.org/u/hahahajayden)\
**Replies:** 4\
**Last updated:** [December 4, 2020, 12:00am UTC](https://discourse.processing.org/t/how-can-i-make-a-program-that-hits-balls-in-processing/25893 "2020-12-04T00:00:29Z")

</div>

please format code with \</\> button \* homework policy \* asking questions hello! I am a novice processing programmer living in Korea. I used Google Translator, so I hope you understand even if the words are strange. T…

---

## [Help a newbie create a particle system that follows my player movement](https://discourse.processing.org/t/help-a-newbie-create-a-particle-system-that-follows-my-player-movement/25905)

<div class="topic-metadata">

**Author:** [@Cal\_codes](https://discourse.processing.org/u/Cal_codes)\
**Replies:** 0\
**Last updated:** [December 2, 2020, 10:43pm UTC](https://discourse.processing.org/t/help-a-newbie-create-a-particle-system-that-follows-my-player-movement/25905 "2020-12-02T22:43:32Z")

</div>

Hey guys, I am making a geometrical game for some fun right now and have been pondering for a while how to make sure my “users” would be able to see the direction they are moving in. Right now I have a line that shows t…

---

## [Convert String to Integer](https://discourse.processing.org/t/convert-string-to-integer/2430)

<div class="topic-metadata">

**Author:** [@jarlook](https://discourse.processing.org/u/jarlook)\
**Replies:** 11\
**Last updated:** [December 2, 2020, 11:40am UTC](https://discourse.processing.org/t/convert-string-to-integer/2430 "2020-12-02T11:40:31Z")

</div>

How can I convert a string to integer? I have a string that contains a set of values, some are text, but some are actually numeric values, all separated by commas. I can use split(string,",") to get any particular valu…

---

## [Help with placing a shape on grid for tic tac toe. My code is shown below](https://discourse.processing.org/t/help-with-placing-a-shape-on-grid-for-tic-tac-toe-my-code-is-shown-below/25846)

<div class="topic-metadata">

**Author:** [@seannyb2000](https://discourse.processing.org/u/seannyb2000)\
**Replies:** 2\
**Last updated:** [December 2, 2020, 12:51am UTC](https://discourse.processing.org/t/help-with-placing-a-shape-on-grid-for-tic-tac-toe-my-code-is-shown-below/25846 "2020-12-02T00:51:04Z")

</div>

please format code with \</\> button \* homework policy \* asking questions char player=‘X’+‘O’; // inputs 2 players int cols=3; int rows=3; Cell board= new Cell\[cols\]\[rows\]; void setup() { size(600,600); for(int i…

---

## [Array index out of bounds question](https://discourse.processing.org/t/array-index-out-of-bounds-question/25870)

<div class="topic-metadata">

**Author:** [@karenben](https://discourse.processing.org/u/karenben)\
**Replies:** 4\
**Last updated:** [December 1, 2020, 10:46pm UTC](https://discourse.processing.org/t/array-index-out-of-bounds-question/25870 "2020-12-01T22:46:51Z")

</div>

What’s causing the ArrayIndexOutOfBoundsException: 5? I want to make each bounce have a function that increases the value of the counter per ball. If the counter is greater than 10, stop drawing the ball int bounces = …

---

## [Creating a grid for art](https://discourse.processing.org/t/creating-a-grid-for-art/25874)

<div class="topic-metadata">

**Author:** [@Matrix](https://discourse.processing.org/u/Matrix)\
**Replies:** 1\
**Last updated:** [December 1, 2020, 10:14pm UTC](https://discourse.processing.org/t/creating-a-grid-for-art/25874 "2020-12-01T22:14:16Z")

</div>

Hi, I’m trying to create grid that makes it so the rectangles that are created by my mouse clicks are lined up perfectly on either the x or y axis. This is all so I can make pixel art that’s consistent. This is what I ha…

---

## [Join crosses with random lines](https://discourse.processing.org/t/join-crosses-with-random-lines/25395)

<div class="topic-metadata">

**Author:** [@Dimdimtri](https://discourse.processing.org/u/Dimdimtri)\
**Replies:** 23\
**Last updated:** [December 1, 2020, 9:20pm UTC](https://discourse.processing.org/t/join-crosses-with-random-lines/25395 "2020-12-01T21:20:58Z")

</div>

Hi everyone, I have a simple question but which one I’m blocking on. I would like to join by a line the center of two crosses at random. I’m still new to processing. I’ve understood that line (x + 23, y + 23, random (…

---

## [How to create a reverse fill? Possible?](https://discourse.processing.org/t/how-to-create-a-reverse-fill-possible/25842)

<div class="topic-metadata">

**Author:** [@dgoren1](https://discourse.processing.org/u/dgoren1)\
**Replies:** 1\
**Last updated:** [December 1, 2020, 8:53pm UTC](https://discourse.processing.org/t/how-to-create-a-reverse-fill-possible/25842 "2020-12-01T20:53:10Z")

</div>

Hello! I am trying to figure out how to create a reverse fill of this shape that I have drawn. The purpose of the reverse fill will be to block out some other shapes that I’m drawing outside the borders of this original…

---

## [(Delete) Any Image Created Through Clicks](https://discourse.processing.org/t/delete-any-image-created-through-clicks/25867)

<div class="topic-metadata">

**Author:** [@Matrix](https://discourse.processing.org/u/Matrix)\
**Replies:** 1\
**Last updated:** [December 1, 2020, 7:16pm UTC](https://discourse.processing.org/t/delete-any-image-created-through-clicks/25867 "2020-12-01T19:16:09Z")

</div>

Hi, I’m trying to create a program that makes it so every new click reveals a rectangle in a specific region. When all of the clicks are done, then all the rectangles will be revealed- showing an image. Basically pixel a…

---

## [A moving ball which bounces off the sides](https://discourse.processing.org/t/a-moving-ball-which-bounces-off-the-sides/25860)

<div class="topic-metadata">

**Author:** [@thedarklord](https://discourse.processing.org/u/thedarklord)\
**Replies:** 1\
**Last updated:** [December 1, 2020, 3:25pm UTC](https://discourse.processing.org/t/a-moving-ball-which-bounces-off-the-sides/25860 "2020-12-01T15:25:10Z")

</div>

I wanna make a ball move and bounce off the walls. Can anyoune help me? thanks in advance

---

## [How do I change the color of a rectangle once clicked?](https://discourse.processing.org/t/how-do-i-change-the-color-of-a-rectangle-once-clicked/5536)

<div class="topic-metadata">

**Author:** [@CodingBoy](https://discourse.processing.org/u/CodingBoy)\
**Replies:** 3\
**Last updated:** [December 1, 2020, 12:28am UTC](https://discourse.processing.org/t/how-do-i-change-the-color-of-a-rectangle-once-clicked/5536 "2020-12-01T00:28:01Z")

</div>

Hello! I was trying to create many squares with different colors on them. I succeeded in doing so, but one thing I wanted to do is that once you click on a colored square, the color of that square would change into anoth…

---

## [Binary numbers with length and charAt function](https://discourse.processing.org/t/binary-numbers-with-length-and-charat-function/25817)

<div class="topic-metadata">

**Author:** [@Ellie98](https://discourse.processing.org/u/Ellie98)\
**Replies:** 5\
**Last updated:** [November 30, 2020, 12:56pm UTC](https://discourse.processing.org/t/binary-numbers-with-length-and-charat-function/25817 "2020-11-30T12:56:55Z")

</div>

Hello, I have to get the binary numbers from 0-32. The tutors just gave us the solution by trying, but I didn’t really understand what is happening. Could someone explain this code to me? How am I able to do a loop unt…

---

## [How to change String order and position and keep char order of each String?!](https://discourse.processing.org/t/how-to-change-string-order-and-position-and-keep-char-order-of-each-string/23656)

<div class="topic-metadata">

**Author:** [@lolonulu](https://discourse.processing.org/u/lolonulu)\
**Replies:** 21\
**Last updated:** [November 30, 2020, 6:59pm UTC](https://discourse.processing.org/t/how-to-change-string-order-and-position-and-keep-char-order-of-each-string/23656 "2020-11-30T18:59:29Z")

</div>

Hello, I got some amazing help from the great @jeremydouglass for my sketch, but I am stuck now. Jeremy wrote me this below, but I don’t find the solution to write properly the function he suggested to me. Blockquote …

---

## [mousePressed stays true after any JOptionPane.showMessageDialog](https://discourse.processing.org/t/mousepressed-stays-true-after-any-joptionpane-showmessagedialog/25828)

<div class="topic-metadata">

**Author:** [@RSV](https://discourse.processing.org/u/RSV)\
**Replies:** 1\
**Last updated:** [November 30, 2020, 12:56pm UTC](https://discourse.processing.org/t/mousepressed-stays-true-after-any-joptionpane-showmessagedialog/25828 "2020-11-30T12:56:08Z")

</div>

Hello, I am encountering a problem with one of my programs where I use the JOptionPane.showMessageDialog. After the message dialog the mousePressed stays true causing unwanted actions. code below. Even running the JOp…

---

## [How to spawn a rectangle when mouse is clicked (however many times you want) and make it do the same functions as my code can](https://discourse.processing.org/t/how-to-spawn-a-rectangle-when-mouse-is-clicked-however-many-times-you-want-and-make-it-do-the-same-functions-as-my-code-can/25820)

<div class="topic-metadata">

**Author:** [@0w3n928](https://discourse.processing.org/u/0w3n928)\
**Replies:** 1\
**Last updated:** [November 30, 2020, 8:35am UTC](https://discourse.processing.org/t/how-to-spawn-a-rectangle-when-mouse-is-clicked-however-many-times-you-want-and-make-it-do-the-same-functions-as-my-code-can/25820 "2020-11-30T08:35:07Z")

</div>

Code: float rectx,recty,xspeed=7,yspeed=7; void setup() { fullScreen(); } void draw() { background(0); rect(rectx,recty,300,150); fill(0,255,0); if(mousePressed==true); rect(recty,rectx,300,150); if(sideCollis…

---

## [Processing Confirmation Window](https://discourse.processing.org/t/processing-confirmation-window/25816)

<div class="topic-metadata">

**Author:** [@Idris](https://discourse.processing.org/u/Idris)\
**Replies:** 1\
**Last updated:** [November 30, 2020, 5:46am UTC](https://discourse.processing.org/t/processing-confirmation-window/25816 "2020-11-30T05:46:13Z")

</div>

Hey guys!. Can you all please help me of how to make a confirmation window before exiting the sketch with the options ‘Yes’ and ‘No’ in Processing 3.0 Java? Here is my simple code: boolean correct\[\] = {false,false}; vo…

---

## [How to move an Object at x and y simultaneously?](https://discourse.processing.org/t/how-to-move-an-object-at-x-and-y-simultaneously/25801)

<div class="topic-metadata">

**Author:** [@corken](https://discourse.processing.org/u/corken)\
**Replies:** 4\
**Last updated:** [November 30, 2020, 1:02am UTC](https://discourse.processing.org/t/how-to-move-an-object-at-x-and-y-simultaneously/25801 "2020-11-30T01:02:03Z")

</div>

Hello I dont quite understand how to move an object on the x and on the y at the same time. It would be nice if someone could give me an example. Also here is the code im working on right now. If you want to correct i…

---

## [A timer which activates by pressing a button](https://discourse.processing.org/t/a-timer-which-activates-by-pressing-a-button/25818)

<div class="topic-metadata">

**Author:** [@thedarklord](https://discourse.processing.org/u/thedarklord)\
**Replies:** 1\
**Last updated:** [November 29, 2020, 11:20pm UTC](https://discourse.processing.org/t/a-timer-which-activates-by-pressing-a-button/25818 "2020-11-29T23:20:42Z")

</div>

I’m trying to make a timer which starts by pressing a button. I’ve tried millis() but it starts counting as soon as I start the program.

---

## [How to animate an Image?](https://discourse.processing.org/t/how-to-animate-an-image/25819)

<div class="topic-metadata">

**Author:** [@corken](https://discourse.processing.org/u/corken)\
**Replies:** 1\
**Last updated:** [November 29, 2020, 10:56pm UTC](https://discourse.processing.org/t/how-to-animate-an-image/25819 "2020-11-29T22:56:03Z")

</div>

Hello, my question is how to animate an moving object. In my code I can move Mario and added the animation. But it is at 60 fps by default so its really fast. When I cap the FPS the animation obviously is slower but als…

---

## [How to sort words alphabetically from a String?](https://discourse.processing.org/t/how-to-sort-words-alphabetically-from-a-string/12767)

<div class="topic-metadata">

**Author:** [@lolonulu](https://discourse.processing.org/u/lolonulu)\
**Replies:** 119\
**Last updated:** [November 29, 2020, 10:26pm UTC](https://discourse.processing.org/t/how-to-sort-words-alphabetically-from-a-string/12767 "2020-11-29T22:26:10Z")

</div>

Hello, The code below compiles, but the way the words are displayed is really strange (last word on the left and then the other words on its right…) how come ?!! I want to sort the words in alphabetical order and chang…

---

## [String to base64 and vice versa](https://discourse.processing.org/t/string-to-base64-and-vice-versa/25690)

<div class="topic-metadata">

**Author:** [@papaboo](https://discourse.processing.org/u/papaboo)\
**Replies:** 4\
**Last updated:** [November 29, 2020, 5:14pm UTC](https://discourse.processing.org/t/string-to-base64-and-vice-versa/25690 "2020-11-29T17:14:45Z")

</div>

Hi, I’ve searched through the forum but seen base64 applied only for images. Is it possible convert a string to base64 and decrypt base64 to plain text? In Javascript I think it’s done with “atob” “btoa”, what about in…

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

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