# Coding Questions

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

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

**Page:** 63

---

## [How to break up list of hex values?](https://discourse.processing.org/t/how-to-break-up-list-of-hex-values/27814)

<div class="topic-metadata">

**Author:** [@tea\_tree](https://discourse.processing.org/u/tea_tree)\
**Replies:** 7\
**Last updated:** [February 14, 2021, 6:05pm UTC](https://discourse.processing.org/t/how-to-break-up-list-of-hex-values/27814 "2021-02-14T18:05:36Z")

</div>

I’d like to break up a string of color values and then return it (so I can then use it in my stroke function). However, when I run the following, my code will not render. color colorDeterminer(int class) { color c = …

---

## [My for loop does not work, why?](https://discourse.processing.org/t/my-for-loop-does-not-work-why/27819)

<div class="topic-metadata">

**Author:** [@CloudyToast](https://discourse.processing.org/u/CloudyToast)\
**Replies:** 2\
**Last updated:** [February 14, 2021, 2:04pm UTC](https://discourse.processing.org/t/my-for-loop-does-not-work-why/27819 "2021-02-14T14:04:42Z")

</div>

So i have made this for loop for my game but i does not work, and i have no idea why. for (boolean Blue=true ;Blue=false;) { image(BackGround,0,0); BlueY--; image(BlueCar,282,BlueY); println("Blue For"); if(Bl…

---

## [Image() is slow](https://discourse.processing.org/t/image-is-slow/27748)

<div class="topic-metadata">

**Author:** [@molo32](https://discourse.processing.org/u/molo32)\
**Replies:** 4\
**Last updated:** [February 13, 2021, 10:58pm UTC](https://discourse.processing.org/t/image-is-slow/27748 "2021-02-13T22:58:57Z")

</div>

I made an asteroid video game, each asteroid breaking into hundreds of pieces, and those pieces breaking into hundreds of pieces. you can imagine how many fragments there are. each fragment takes a random direction. ea…

---

## [Really need help with a simple dungeon generator!](https://discourse.processing.org/t/really-need-help-with-a-simple-dungeon-generator/27795)

<div class="topic-metadata">

**Author:** [@ekay](https://discourse.processing.org/u/ekay)\
**Replies:** 4\
**Last updated:** [February 13, 2021, 9:23pm UTC](https://discourse.processing.org/t/really-need-help-with-a-simple-dungeon-generator/27795 "2021-02-13T21:23:17Z")

</div>

Hi everyone! I am trying to create a random dungeon generator. I am at a very basic stage - I have set up an array filled with 0s called ‘activities’ and I am trying to randomly generate a square/rectangle of 1s randomly…

---

## [Infinite Loops using Multithreading](https://discourse.processing.org/t/infinite-loops-using-multithreading/27760)

<div class="topic-metadata">

**Author:** [@SNICKRS](https://discourse.processing.org/u/SNICKRS)\
**Replies:** 1\
**Last updated:** [February 13, 2021, 8:12pm UTC](https://discourse.processing.org/t/infinite-loops-using-multithreading/27760 "2021-02-13T20:12:47Z")

</div>

I have a program where I open a .exe file using the Process class in java (and Runtime). The function that does this returns the output of the exe file when a command is sent. Here is the method: public String getOutp…

---

## [Function for ArrayList (ArrayList as parameter)](https://discourse.processing.org/t/function-for-arraylist-arraylist-as-parameter/27759)

<div class="topic-metadata">

**Author:** [@jensemand](https://discourse.processing.org/u/jensemand)\
**Replies:** 6\
**Last updated:** [February 13, 2021, 8:10pm UTC](https://discourse.processing.org/t/function-for-arraylist-arraylist-as-parameter/27759 "2021-02-13T20:10:17Z")

</div>

Hi, I am trying to make a function that takes an arraylist and an object as input and checks if the object is in the arraylist. My idea is something like: boolean includes(Cell\[\] grid2, Cell tjek){ for (int i=0;i\<grid…

---

## [Can someone please help me with making the ball bounce off of the black square? I have been at this for days and have gotten nowhere](https://discourse.processing.org/t/can-someone-please-help-me-with-making-the-ball-bounce-off-of-the-black-square-i-have-been-at-this-for-days-and-have-gotten-nowhere/27779)

<div class="topic-metadata">

**Author:** [@cocopuffs](https://discourse.processing.org/u/cocopuffs)\
**Replies:** 7\
**Last updated:** [February 13, 2021, 5:42pm UTC](https://discourse.processing.org/t/can-someone-please-help-me-with-making-the-ball-bounce-off-of-the-black-square-i-have-been-at-this-for-days-and-have-gotten-nowhere/27779 "2021-02-13T17:42:42Z")

</div>

int x, y, vx, vy; void setup(){ size(200,200); x = (int)random(10, 100); y = (int)random(10, 100); vx = (int)random(1, 1); vy = (int)random(1, 1); } void draw(){ background(255); fill(0); rect(0, 0, 30, 30); …

---

## [Need help with this code](https://discourse.processing.org/t/need-help-with-this-code/27791)

<div class="topic-metadata">

**Author:** [@LxnaDark](https://discourse.processing.org/u/LxnaDark)\
**Replies:** 2\
**Last updated:** [February 13, 2021, 4:28pm UTC](https://discourse.processing.org/t/need-help-with-this-code/27791 "2021-02-13T16:28:46Z")

</div>

I want the characters I type to be printed. When I press a letter key and SHIFT, I just want an upper letter to be printed. The problem is, when I press a letter key and shift, the upper version of this letter is printe…

---

## [Column values from CSV arranged in a grid](https://discourse.processing.org/t/column-values-from-csv-arranged-in-a-grid/27794)

<div class="topic-metadata">

**Author:** [@xiiixiii](https://discourse.processing.org/u/xiiixiii)\
**Replies:** 9\
**Last updated:** [February 13, 2021, 3:47pm UTC](https://discourse.processing.org/t/column-values-from-csv-arranged-in-a-grid/27794 "2021-02-13T15:47:50Z")

</div>

Hi there I’ve been using Processing for years, but am stumped by what I think might be quite simple - I have searched but with no luck. My aim is to take a list of string values from a column in a CSV and arrange them …

---

## [Draw ellipse after 2 sec](https://discourse.processing.org/t/draw-ellipse-after-2-sec/27792)

<div class="topic-metadata">

**Author:** [@vestergaard12](https://discourse.processing.org/u/vestergaard12)\
**Replies:** 2\
**Last updated:** [February 13, 2021, 3:35pm UTC](https://discourse.processing.org/t/draw-ellipse-after-2-sec/27792 "2021-02-13T15:35:20Z")

</div>

Hello Processing foundation I want my code to create new random (x,y) ellipses with an interval of 2 seconds. So when you start the code it will after two seconds draw an ellipse (at a random(x,y)), and then after anot…

---

## [Infinite, random, non-repeating 2d terrain generation](https://discourse.processing.org/t/infinite-random-non-repeating-2d-terrain-generation/27716)

<div class="topic-metadata">

**Author:** [@spaces](https://discourse.processing.org/u/spaces)\
**Replies:** 5\
**Last updated:** [February 13, 2021, 12:50pm UTC](https://discourse.processing.org/t/infinite-random-non-repeating-2d-terrain-generation/27716 "2021-02-13T12:50:46Z")

</div>

Dear programmers, I’m new to the Forum and not new to Processing Java mode. I’ve been searching on the Internet for days to find an algorithm that is able to generate 2d terrain endlessly, and randomly but also natural…

---

## [Extracting current date and time](https://discourse.processing.org/t/extracting-current-date-and-time/27754)

<div class="topic-metadata">

**Author:** [@proc8888](https://discourse.processing.org/u/proc8888)\
**Replies:** 3\
**Last updated:** [February 13, 2021, 12:42pm UTC](https://discourse.processing.org/t/extracting-current-date-and-time/27754 "2021-02-13T12:42:34Z")

</div>

How do I extract current date and current time? The ‘Time & Date’ functions in Processing org reference (online) has individual fields for year, month, day, hour etc. Instead, I would like to extract the whole current …

---

## [Need help to solve (skyscraper)](https://discourse.processing.org/t/need-help-to-solve-skyscraper/27685)

<div class="topic-metadata">

**Author:** [@Sett](https://discourse.processing.org/u/Sett)\
**Replies:** 26\
**Last updated:** [February 13, 2021, 8:00am UTC](https://discourse.processing.org/t/need-help-to-solve-skyscraper/27685 "2021-02-13T08:00:05Z")

</div>

please format code with \</\> button \* homework policy \* asking questions String storey = " “; String tokens=split(storey,”,"); int level ={0,1,2,3,4,5,6,7,8,9,10}; int j = 0; void setup() { size(1000,1000); back…

---

## [Finding problem with A\* algorithm](https://discourse.processing.org/t/finding-problem-with-a-algorithm/27773)

<div class="topic-metadata">

**Author:** [@jensemand](https://discourse.processing.org/u/jensemand)\
**Replies:** 0\
**Last updated:** [February 12, 2021, 8:50pm UTC](https://discourse.processing.org/t/finding-problem-with-a-algorithm/27773 "2021-02-12T20:50:19Z")

</div>

Hi I am trying to to make a pathfinding system with the A\* algorithm and I have tried to make my own but that didn’t seem to work so I tried to make the one from the coding challenge by The coding train. I am close to ma…

---

## [Scalable chart graphics](https://discourse.processing.org/t/scalable-chart-graphics/27763)

<div class="topic-metadata">

**Author:** [@xbix](https://discourse.processing.org/u/xbix)\
**Replies:** 4\
**Last updated:** [February 12, 2021, 5:21pm UTC](https://discourse.processing.org/t/scalable-chart-graphics/27763 "2021-02-12T17:21:35Z")

</div>

I want to create good scalable chart graphics, are there any good tutorials about this topic? Or maybe someone would like to share his ideas about this topic? Thanks a lot!

---

## [How do I calculate the width of a string in pixels?](https://discourse.processing.org/t/how-do-i-calculate-the-width-of-a-string-in-pixels/27762)

<div class="topic-metadata">

**Author:** [@xbix](https://discourse.processing.org/u/xbix)\
**Replies:** 1\
**Last updated:** [February 12, 2021, 4:14pm UTC](https://discourse.processing.org/t/how-do-i-calculate-the-width-of-a-string-in-pixels/27762 "2021-02-12T16:14:44Z")

</div>

How to calculate the width of a String in pixels in Processing? For e.g., I have a string that says “Processing”. What is its length in pixels, also considering its font family and size? Thanks in advance!

---

## [Chladni patterns & interference patterns code understanding](https://discourse.processing.org/t/chladni-patterns-interference-patterns-code-understanding/17766)

<div class="topic-metadata">

**Author:** [@Ruchi](https://discourse.processing.org/u/Ruchi)\
**Replies:** 3\
**Last updated:** [February 11, 2021, 4:35am UTC](https://discourse.processing.org/t/chladni-patterns-interference-patterns-code-understanding/17766 "2021-02-11T04:35:42Z")

</div>

Chladni Pattern Interference Pattern I am referring to these patterns code by carlos ponce in open processing. I can’t seem to understand a bit of what is actually causing pattern. Dissecting it bit by bit but intuiti…

---

## [Algorithms for penrose tiling patterns](https://discourse.processing.org/t/algorithms-for-penrose-tiling-patterns/27741)

<div class="topic-metadata">

**Author:** [@daniel.tran](https://discourse.processing.org/u/daniel.tran)\
**Replies:** 3\
**Last updated:** [February 11, 2021, 9:48pm UTC](https://discourse.processing.org/t/algorithms-for-penrose-tiling-patterns/27741 "2021-02-11T21:48:08Z")

</div>

Hello, I was hoping to restart this thread from the user spinvector: I want to ask if anyone has any experience in this. They appear to be quite tricky to generate, as they don’t have translation symmetries. So I don’…

---

## [Short 5 second .PNG animation](https://discourse.processing.org/t/short-5-second-png-animation/27664)

<div class="topic-metadata">

**Author:** [@Huber542](https://discourse.processing.org/u/Huber542)\
**Replies:** 9\
**Last updated:** [February 11, 2021, 7:42pm UTC](https://discourse.processing.org/t/short-5-second-png-animation/27664 "2021-02-11T19:42:41Z")

</div>

please format code with \</\> button \* homework policy \* asking questions Hey everyone! I’m VERY new, I’ve been assigned a small task of creating a moving animation. So what I decided I’d do is create some frames in p…

---

## [Simulate Mouse click and Key (Robot class)](https://discourse.processing.org/t/simulate-mouse-click-and-key-robot-class/27709)

<div class="topic-metadata">

**Author:** [@amarlo](https://discourse.processing.org/u/amarlo)\
**Replies:** 5\
**Last updated:** [February 11, 2021, 3:55pm UTC](https://discourse.processing.org/t/simulate-mouse-click-and-key-robot-class/27709 "2021-02-11T15:55:24Z")

</div>

Hello, I have found some information about simulate click mouse and simulate a keypressed using Robot library. I am using Processing 3 and I dont find this library. Please, can you tell me where to download and informat…

---

## [How can I make multiple objects of the same class to execute the same method at the same time?](https://discourse.processing.org/t/how-can-i-make-multiple-objects-of-the-same-class-to-execute-the-same-method-at-the-same-time/26654)

<div class="topic-metadata">

**Author:** [@SailorToei](https://discourse.processing.org/u/SailorToei)\
**Replies:** 12\
**Last updated:** [February 11, 2021, 12:22pm UTC](https://discourse.processing.org/t/how-can-i-make-multiple-objects-of-the-same-class-to-execute-the-same-method-at-the-same-time/26654 "2021-02-11T12:22:20Z")

</div>

Hello, I am working on a 3D game and in the world of the game are trees. The character class has a method, where its xPos, yPos and zPos are made equal with the variables ax, by and cz, which count for the whole program.…

---

## [JSON Objects Attribute sequence issue](https://discourse.processing.org/t/json-objects-attribute-sequence-issue/27700)

<div class="topic-metadata">

**Author:** [@Ruchi](https://discourse.processing.org/u/Ruchi)\
**Replies:** 5\
**Last updated:** [February 11, 2021, 10:41am UTC](https://discourse.processing.org/t/json-objects-attribute-sequence-issue/27700 "2021-02-11T10:41:23Z")

</div>

JSONObject json; JSONArray array; JSONObject loc; void setup() { size(800, 800); array = new JSONArray(); json = new JSONObject(); } void draw() { } void keyPressed() { if (key =='s') { for (int i=0; i\<…

---

## [How to connect points with curveVertices?](https://discourse.processing.org/t/how-to-connect-points-with-curvevertices/27719)

<div class="topic-metadata">

**Author:** [@tea\_tree](https://discourse.processing.org/u/tea_tree)\
**Replies:** 4\
**Last updated:** [February 11, 2021, 6:52am UTC](https://discourse.processing.org/t/how-to-connect-points-with-curvevertices/27719 "2021-02-11T06:52:15Z")

</div>

I’m working on a project where I’m trying to connect points with curveVertex. I’m struggling to do that because I don’t know how to tell processing how to group values. I’m using the following raw data item class dat…

---

## [(NOOB) How to keep a shape on screen after I release the mouse click?](https://discourse.processing.org/t/noob-how-to-keep-a-shape-on-screen-after-i-release-the-mouse-click/27712)

<div class="topic-metadata">

**Author:** [@abo\_shack](https://discourse.processing.org/u/abo_shack)\
**Replies:** 3\
**Last updated:** [February 10, 2021, 8:06pm UTC](https://discourse.processing.org/t/noob-how-to-keep-a-shape-on-screen-after-i-release-the-mouse-click/27712 "2021-02-10T20:06:25Z")

</div>

Hey guys, super noob here. I have a simple code where when I left click it produces a red dot, and when I right click it produces a blue dot. When I release my click the dot disappears. How do I get the dot to stay on th…

---

## [Colormap an rgb or grayscale image to spectral - effect like thermal image](https://discourse.processing.org/t/colormap-an-rgb-or-grayscale-image-to-spectral-effect-like-thermal-image/27703)

<div class="topic-metadata">

**Author:** [@dimpapadop](https://discourse.processing.org/u/dimpapadop)\
**Replies:** 4\
**Last updated:** [February 10, 2021, 4:38pm UTC](https://discourse.processing.org/t/colormap-an-rgb-or-grayscale-image-to-spectral-effect-like-thermal-image/27703 "2021-02-10T16:38:31Z")

</div>

How can i achieve a colormapping effect from a pimage rgb (or even i could first convert to grayscale) to a range near the spectral like below? - based on brightness on grayscale. or based on blue and red brightness on r…

---

## [Problems with Arrays](https://discourse.processing.org/t/problems-with-arrays/26933)

<div class="topic-metadata">

**Author:** [@SailorToei](https://discourse.processing.org/u/SailorToei)\
**Replies:** 3\
**Last updated:** [February 10, 2021, 11:19am UTC](https://discourse.processing.org/t/problems-with-arrays/26933 "2021-02-10T11:19:30Z")

</div>

Hello there, I previously asked how I can make objects of the same class to execute the same function at the same time. I think the solution to this problem is an array. Unfortuneately it does not work as intended. When…

---

## [Individually targeting shapes?](https://discourse.processing.org/t/individually-targeting-shapes/27678)

<div class="topic-metadata">

**Author:** [@wgm1](https://discourse.processing.org/u/wgm1)\
**Replies:** 1\
**Last updated:** [February 9, 2021, 12:48am UTC](https://discourse.processing.org/t/individually-targeting-shapes/27678 "2021-02-09T00:48:50Z")

</div>

link to view: https://unruly-wooden-hippopotamus.glitch.me I’m trying to individually target each ellipse and change their speeds after they hit the halfway point so they all reach the end at the same time. Right now I…

---

## [Simulate tree shadow?](https://discourse.processing.org/t/simulate-tree-shadow/27476)

<div class="topic-metadata">

**Author:** [@greeneman42](https://discourse.processing.org/u/greeneman42)\
**Replies:** 5\
**Last updated:** [February 8, 2021, 10:51am UTC](https://discourse.processing.org/t/simulate-tree-shadow/27476 "2021-02-08T10:51:33Z")

</div>

Hi, I’ve been using p5js and processing for a while now and have some experience making animations/art using sine waves, noise, etc. but I’m currently wondering how to re-create some art that I’ve found and have been a b…

---

## [How to run program for x seconds, pause for x seconds?](https://discourse.processing.org/t/how-to-run-program-for-x-seconds-pause-for-x-seconds/27661)

<div class="topic-metadata">

**Author:** [@lauren](https://discourse.processing.org/u/lauren)\
**Replies:** 1\
**Last updated:** [February 8, 2021, 12:53am UTC](https://discourse.processing.org/t/how-to-run-program-for-x-seconds-pause-for-x-seconds/27661 "2021-02-08T00:53:07Z")

</div>

Hi, I’m new to processing and I’m trying to figure out a way to run a function, pause for a certain amount of time, then continue running the program. So something like this -run function 1 for 0.1 seconds -pause for 0…

---

## [How do I move a point along a line, starting from (mouseX, mouseY), to a target](https://discourse.processing.org/t/how-do-i-move-a-point-along-a-line-starting-from-mousex-mousey-to-a-target/27637)

<div class="topic-metadata">

**Author:** [@mario60](https://discourse.processing.org/u/mario60)\
**Replies:** 7\
**Last updated:** [February 6, 2021, 7:17pm UTC](https://discourse.processing.org/t/how-do-i-move-a-point-along-a-line-starting-from-mousex-mousey-to-a-target/27637 "2021-02-06T19:17:13Z")

</div>

Hello given the code below, do you see a simple way to modify it as keep the blue ball to move along the line, when the starting point is given by (mouseX, mouseY)? thanks cheers m. float xi=50; float yi=50; float x …

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

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