# Coding Questions

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

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

**Page:** 118

---

## [Accumulate rotation with snapping](https://discourse.processing.org/t/accumulate-rotation-with-snapping/15609)

<div class="topic-metadata">

**Author:** [@ddownn](https://discourse.processing.org/u/ddownn)\
**Replies:** 30\
**Last updated:** [November 30, 2019, 7:55pm UTC](https://discourse.processing.org/t/accumulate-rotation-with-snapping/15609 "2019-11-30T19:55:47Z")

</div>

For a few weeks I have been having trouble finding a clean way to measure the accumulated angle of a circular drag while snapping the result to seconds on a clock. This is as close as I have come but it is still not wor…

---

## [Fill function in an array of objects](https://discourse.processing.org/t/fill-function-in-an-array-of-objects/15925)

<div class="topic-metadata">

**Author:** [@Kasdal](https://discourse.processing.org/u/Kasdal)\
**Replies:** 3\
**Last updated:** [November 29, 2019, 9:19pm UTC](https://discourse.processing.org/t/fill-function-in-an-array-of-objects/15925 "2019-11-29T21:19:14Z")

</div>

import javax.swing.\*; Ball \[\] balls; PVector wind = new PVector(0.03, 3); PVector gravity = new PVector(0.1, 0.1); void setup() { size(800, 600); smooth(); background(255); int ballCount = Integer.parseInt( …

---

## [How to append to a 2 dimensional array?](https://discourse.processing.org/t/how-to-append-to-a-2-dimensional-array/15936)

<div class="topic-metadata">

**Author:** [@JoeyPeluka](https://discourse.processing.org/u/JoeyPeluka)\
**Replies:** 5\
**Last updated:** [November 29, 2019, 9:28am UTC](https://discourse.processing.org/t/how-to-append-to-a-2-dimensional-array/15936 "2019-11-29T09:28:05Z")

</div>

Hello, I’m having trouble finding an answer to this problem. How would you append an array to an array. One of the ways I have tried doing this: int\[\]\[\] array; for (int i=1; i\<=20; i++) { append(array,{0,0,…

---

## [Issue with deciding to place background in draw() or set()](https://discourse.processing.org/t/issue-with-deciding-to-place-background-in-draw-or-set/15933)

<div class="topic-metadata">

**Author:** [@Miaomelette](https://discourse.processing.org/u/Miaomelette)\
**Replies:** 1\
**Last updated:** [November 29, 2019, 2:16am UTC](https://discourse.processing.org/t/issue-with-deciding-to-place-background-in-draw-or-set/15933 "2019-11-29T02:16:24Z")

</div>

Hi, I’m currently making a “sandwich creator” minigame, where the programs start with an intro of one slice of bread dropping down, and the user can click to put shapes on it as “toppings”. The issue I’m running into is …

---

## [Visualize cannon firing (launch vehicle) simulation](https://discourse.processing.org/t/visualize-cannon-firing-launch-vehicle-simulation/15521)

<div class="topic-metadata">

**Author:** [@O-O](https://discourse.processing.org/u/O-O)\
**Replies:** 4\
**Last updated:** [November 28, 2019, 10:13pm UTC](https://discourse.processing.org/t/visualize-cannon-firing-launch-vehicle-simulation/15521 "2019-11-28T22:13:48Z")

</div>

As I said before, I have to use processing to create project that visualizes and introduces concepts and various examples of math and science. The idea that I’m thinking about is that if you shoot a cannon from a cannon …

---

## [Increasement with ONE on keypress](https://discourse.processing.org/t/increasement-with-one-on-keypress/15906)

<div class="topic-metadata">

**Author:** [@vanoevelenstef](https://discourse.processing.org/u/vanoevelenstef)\
**Replies:** 6\
**Last updated:** [November 28, 2019, 10:13pm UTC](https://discourse.processing.org/t/increasement-with-one-on-keypress/15906 "2019-11-28T22:13:45Z")

</div>

Hey everyone. I’ve founded this code online I’m reworking it, so I come to my needs but now I’ve hit a bump. This is only a section of my code, so I don’t know if this enough to have this work. In the original code int …

---

## [Moving object with noLoop()](https://discourse.processing.org/t/moving-object-with-noloop/15841)

<div class="topic-metadata">

**Author:** [@San](https://discourse.processing.org/u/San)\
**Replies:** 15\
**Last updated:** [November 28, 2019, 9:07pm UTC](https://discourse.processing.org/t/moving-object-with-noloop/15841 "2019-11-28T21:07:52Z")

</div>

Hey! I made this code: Grid 40x60 with 10 red blocks and 1 yellow block. And I can move the yellow block with the w-a-s-d keys. But the red blocks keep getting a new position. That problem is fixed when I add the noLoo…

---

## [Adding text field to my calculator homework](https://discourse.processing.org/t/adding-text-field-to-my-calculator-homework/15916)

<div class="topic-metadata">

**Author:** [@bcas](https://discourse.processing.org/u/bcas)\
**Replies:** 1\
**Last updated:** [November 28, 2019, 7:54pm UTC](https://discourse.processing.org/t/adding-text-field-to-my-calculator-homework/15916 "2019-11-28T19:54:06Z")

</div>

Hi all. First post here. I have to make a calculator as a homework assignment. What I have so far is working buttons with results displayed in the terminal using a println. What I am trying to achieve is to display the r…

---

## [Movement script continues moving diagonally](https://discourse.processing.org/t/movement-script-continues-moving-diagonally/15854)

<div class="topic-metadata">

**Author:** [@madbrine](https://discourse.processing.org/u/madbrine)\
**Replies:** 5\
**Last updated:** [November 28, 2019, 7:26pm UTC](https://discourse.processing.org/t/movement-script-continues-moving-diagonally/15854 "2019-11-28T19:26:27Z")

</div>

So I’m working on a movement script for a game, but when I go from diagonal to just one direction, it continues moving diagonally. PImage pS\[\]; //Allocating a spot for Player sprites Player p; //Creates the player //Ke…

---

## [Random() firsts random](https://discourse.processing.org/t/random-firsts-random/15914)

<div class="topic-metadata">

**Author:** [@vanoevelenstef](https://discourse.processing.org/u/vanoevelenstef)\
**Replies:** 1\
**Last updated:** [November 28, 2019, 6:39pm UTC](https://discourse.processing.org/t/random-firsts-random/15914 "2019-11-28T18:39:51Z")

</div>

I’m using 3 floats for R G B color and if I run my code. The first variable is always black and once I press the button to randomize the colors again it will change. Can I make it that by running to program its start wi…

---

## [Error when zoom in and out](https://discourse.processing.org/t/error-when-zoom-in-and-out/15856)

<div class="topic-metadata">

**Author:** [@thefso](https://discourse.processing.org/u/thefso)\
**Replies:** 3\
**Last updated:** [November 28, 2019, 11:05am UTC](https://discourse.processing.org/t/error-when-zoom-in-and-out/15856 "2019-11-28T11:05:29Z")

</div>

I want to only use the wheel to zoom in and out and the center of our view is where the new dot is draw, but I fail to do so, anybody an idea how to solve that? float sFactor = 1.0; float transX = 0.0; float transY = 0.…

---

## [Vertical Text Align Question](https://discourse.processing.org/t/vertical-text-align-question/15892)

<div class="topic-metadata">

**Author:** [@Ladan](https://discourse.processing.org/u/Ladan)\
**Replies:** 2\
**Last updated:** [November 28, 2019, 6:26am UTC](https://discourse.processing.org/t/vertical-text-align-question/15892 "2019-11-28T06:26:28Z")

</div>

Hello! I am trying to Align my text: “QUIZ”, vertically, but the “I” and the text in general just looks bad, can somebody help me, to make it better? void draw\_quiz\_text() { fill(184, 18, 18); textSize(150); s…

---

## [Help with grid game](https://discourse.processing.org/t/help-with-grid-game/15888)

<div class="topic-metadata">

**Author:** [@ihatearrays](https://discourse.processing.org/u/ihatearrays)\
**Replies:** 2\
**Last updated:** [November 27, 2019, 6:12pm UTC](https://discourse.processing.org/t/help-with-grid-game/15888 "2019-11-27T18:12:32Z")

</div>

I’m involved in a team project in college. the objective is to make a game for kids and the foundation is there. but when the mouse hover code works i have the other 8 squares in my 3x3 grid set to white. i want it to be…

---

## [Receiving int data as IntList](https://discourse.processing.org/t/receiving-int-data-as-intlist/15826)

<div class="topic-metadata">

**Author:** [@24stevek](https://discourse.processing.org/u/24stevek)\
**Replies:** 9\
**Last updated:** [November 27, 2019, 2:03pm UTC](https://discourse.processing.org/t/receiving-int-data-as-intlist/15826 "2019-11-27T14:03:41Z")

</div>

Hi! I am making a code for drawing a graph. I am receiving data(int) in an IntList form, and something is not going right. It is supposed to get data like First, enter the title. Enter the number of rows. Then enter a…

---

## [On the last flag the text is not visible, why?](https://discourse.processing.org/t/on-the-last-flag-the-text-is-not-visible-why/15834)

<div class="topic-metadata">

**Author:** [@CyberDodo](https://discourse.processing.org/u/CyberDodo)\
**Replies:** 5\
**Last updated:** [November 27, 2019, 12:09pm UTC](https://discourse.processing.org/t/on-the-last-flag-the-text-is-not-visible-why/15834 "2019-11-27T12:09:08Z")

</div>

I tried to put this text (Das war’s Danke für’s mitmachen) on flag 3 but it did not work, why? int flag = 0; // 3 parallel arrays String\[\] text1 = { "1. Aussage:", "2. Aussage:", "3. Aussage:", "4. Auss…

---

## [How to increase Processing's processing power?](https://discourse.processing.org/t/how-to-increase-processings-processing-power/15851)

<div class="topic-metadata">

**Author:** [@mrwizard487](https://discourse.processing.org/u/mrwizard487)\
**Replies:** 2\
**Last updated:** [November 27, 2019, 11:14am UTC](https://discourse.processing.org/t/how-to-increase-processings-processing-power/15851 "2019-11-27T11:14:33Z")

</div>

Hey guys, so I'm currently working on a game in Processing 3 on my 2018 macbook pro. This game involves drawing a lot of rectangles, and despite my best optimization efforts, the game suffers from frame rates dropping t…

---

## [Interactivity, mouseDragged(), two discs](https://discourse.processing.org/t/interactivity-mousedragged-two-discs/15664)

<div class="topic-metadata">

**Author:** [@paulstgeorge](https://discourse.processing.org/u/paulstgeorge)\
**Replies:** 38\
**Last updated:** [November 26, 2019, 10:23pm UTC](https://discourse.processing.org/t/interactivity-mousedragged-two-discs/15664 "2019-11-26T22:23:21Z")

</div>

The disc (see below) moves when it is dragged. That is fine. How do I have two discs and have them move independently? So if I drag disc1 it moves, and disc2 does not move and if I drag disc2 that moves and disc1 does n…

---

## [Help with Painting Program](https://discourse.processing.org/t/help-with-painting-program/15840)

<div class="topic-metadata">

**Author:** [@keeg23](https://discourse.processing.org/u/keeg23)\
**Replies:** 2\
**Last updated:** [November 26, 2019, 9:18pm UTC](https://discourse.processing.org/t/help-with-painting-program/15840 "2019-11-26T21:18:05Z")

</div>

When I use the save function it changes the background to red and erases what is painted, Wondering how I can save without it going away and background staying orange. Also need help with creating a way to have the other…

---

## [Why this rectangle disappear?](https://discourse.processing.org/t/why-this-rectangle-disappear/15812)

<div class="topic-metadata">

**Author:** [@kkxxbdm](https://discourse.processing.org/u/kkxxbdm)\
**Replies:** 3\
**Last updated:** [November 25, 2019, 10:02pm UTC](https://discourse.processing.org/t/why-this-rectangle-disappear/15812 "2019-11-25T22:02:46Z")

</div>

void setup(){ size(1000,1000,P3D); } void draw(){ noStroke(); fill(0, 20); rect(0, 0, width, height); pushMatrix(); pushStyle(); translate(500, 500); rotate(PI/2 + PI/2); …

---

## [Mouse inside a triangle checker](https://discourse.processing.org/t/mouse-inside-a-triangle-checker/15727)

<div class="topic-metadata">

**Author:** [@SimoneBatistini](https://discourse.processing.org/u/SimoneBatistini)\
**Replies:** 18\
**Last updated:** [November 25, 2019, 6:51pm UTC](https://discourse.processing.org/t/mouse-inside-a-triangle-checker/15727 "2019-11-25T18:51:40Z")

</div>

I’m trying to make a program that will detect if the mouse is inside a triangle or not. It has to be any type of triangle. My idea is taking a triangle ABC and the mouse point K and calculating the areas Aabc Aabk Aakc A…

---

## [Text input for choosing Colour](https://discourse.processing.org/t/text-input-for-choosing-colour/15772)

<div class="topic-metadata">

**Author:** [@paulstgeorge](https://discourse.processing.org/u/paulstgeorge)\
**Replies:** 2\
**Last updated:** [November 25, 2019, 7:16am UTC](https://discourse.processing.org/t/text-input-for-choosing-colour/15772 "2019-11-25T07:16:31Z")

</div>

Hi, I want to choose a colour by typing the hex (or the RGB) into a field. Is my rough sketch (see below) the way to go? Later, I will add a value for the Alpha to the string rather than type it into the text field and …

---

## [Trouble on array's \[COMPLICATED\]](https://discourse.processing.org/t/trouble-on-arrays-complicated/15496)

<div class="topic-metadata">

**Author:** [@IsaiahZ](https://discourse.processing.org/u/IsaiahZ)\
**Replies:** 27\
**Last updated:** [November 25, 2019, 3:39pm UTC](https://discourse.processing.org/t/trouble-on-arrays-complicated/15496 "2019-11-25T15:39:03Z")

</div>

I’m making a palette where when I press on a square it will change to whatever color I have selected from the palette. Right now I’m having trouble with two things: Making the array that when I select a circle or multi…

---

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

<div class="topic-metadata">

**Author:** [@Leyonad](https://discourse.processing.org/u/Leyonad)\
**Replies:** 2\
**Last updated:** [November 24, 2019, 8:09pm UTC](https://discourse.processing.org/t/i-need-help-with-a-problem/15687 "2019-11-24T20:09:15Z")

</div>

Hello, Does anyone know how to solve this problem? “Determine the letter with the largest gap. A gap is the number of letters that is different from the letter that is determined.” If someone could help me, I would b…

---

## [Difference between two times (measuring time)](https://discourse.processing.org/t/difference-between-two-times-measuring-time/15728)

<div class="topic-metadata">

**Author:** [@Chrisir](https://discourse.processing.org/u/Chrisir)\
**Replies:** 6\
**Last updated:** [November 25, 2019, 1:30am UTC](https://discourse.processing.org/t/difference-between-two-times-measuring-time/15728 "2019-11-25T01:30:21Z")

</div>

Hello all, \[Edited\] let’s say I have times like 00:36:04 and 03:16:05 as Strings (which is an actual time and not a duration). How can I have the difference (duration) between the two times like “4h, 23min, 13sec” or…

---

## [How to separately animate characters in a string after scaling and centering](https://discourse.processing.org/t/how-to-separately-animate-characters-in-a-string-after-scaling-and-centering/15663)

<div class="topic-metadata">

**Author:** [@jimather](https://discourse.processing.org/u/jimather)\
**Replies:** 3\
**Last updated:** [November 24, 2019, 10:22pm UTC](https://discourse.processing.org/t/how-to-separately-animate-characters-in-a-string-after-scaling-and-centering/15663 "2019-11-24T22:22:20Z")

</div>

Hi, What I’m trying to do is animate the characters in a string independently of one another and have them all “home” into a centred and scaled position as one final string allowing the OS to adjust for different screen…

---

## [Hi I'm new to Processing and struggling](https://discourse.processing.org/t/hi-im-new-to-processing-and-struggling/15774)

<div class="topic-metadata">

**Author:** [@ousmm](https://discourse.processing.org/u/ousmm)\
**Replies:** 9\
**Last updated:** [November 24, 2019, 9:12pm UTC](https://discourse.processing.org/t/hi-im-new-to-processing-and-struggling/15774 "2019-11-24T21:12:46Z")

</div>

Hi i’m new to processing and coding in general , i have a project that is due in 6 hours and i have problems everywhere in my code , i keep looking of them and cant find anything and i’m very desperate.can you guys help…

---

## [Ball on platforms \[School project\]](https://discourse.processing.org/t/ball-on-platforms-school-project/15764)

<div class="topic-metadata">

**Author:** [@alltimedreamcatcher](https://discourse.processing.org/u/alltimedreamcatcher)\
**Replies:** 5\
**Last updated:** [November 24, 2019, 1:28pm UTC](https://discourse.processing.org/t/ball-on-platforms-school-project/15764 "2019-11-24T13:28:43Z")

</div>

Hi ! Sorry if this is a bit random, I’ve never actually asked a question on here and english isn’t my first language but anyway, I have to do this project for school and I did like 85% of it no problem but I still have …

---

## [Random lines emanating from a sphere in 3D](https://discourse.processing.org/t/random-lines-emanating-from-a-sphere-in-3d/15707)

<div class="topic-metadata">

**Author:** [@nicnut](https://discourse.processing.org/u/nicnut)\
**Replies:** 2\
**Last updated:** [November 24, 2019, 12:05am UTC](https://discourse.processing.org/t/random-lines-emanating-from-a-sphere-in-3d/15707 "2019-11-24T00:05:38Z")

</div>

Hi, I am still pretty new to processing. There are a few things I don’t really have a great grasp on yet, including arrays and 3d space. I am trying to have a Sphere in 3D that has lines emanating from the sphere in r…

---

## [Is this realizable in Processing?](https://discourse.processing.org/t/is-this-realizable-in-processing/15544)

<div class="topic-metadata">

**Author:** [@ImDaGr3en](https://discourse.processing.org/u/ImDaGr3en)\
**Replies:** 4\
**Last updated:** [November 23, 2019, 3:08pm UTC](https://discourse.processing.org/t/is-this-realizable-in-processing/15544 "2019-11-23T15:08:50Z")

</div>

Hi folks! I just need your help for a simple question. I’m about on doing a sort of mini-game in which you can choose between playing against the CPU or another player… but I don’t know how! In fact, I need to have a “…

---

## [Trouble with box transparency](https://discourse.processing.org/t/trouble-with-box-transparency/15708)

<div class="topic-metadata">

**Author:** [@graysonh](https://discourse.processing.org/u/graysonh)\
**Replies:** 4\
**Last updated:** [November 23, 2019, 12:37pm UTC](https://discourse.processing.org/t/trouble-with-box-transparency/15708 "2019-11-23T12:37:14Z")

</div>

I am drawing boxes with color from 0-255 with the same value for alpha. It appears that each box being drawn is only visible from certain angles. The images show the sketch rotating to the left and as it rotates the boxe…

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

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