# Coding Questions

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

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

**Page:** 163

---

## [Gradient background immediately fades away?](https://discourse.processing.org/t/gradient-background-immediately-fades-away/6006)

<div class="topic-metadata">

**Author:** [@francium401](https://discourse.processing.org/u/francium401)\
**Replies:** 3\
**Last updated:** [November 27, 2018, 11:25pm UTC](https://discourse.processing.org/t/gradient-background-immediately-fades-away/6006 "2018-11-27T23:25:49Z")

</div>

I’m very new to processing, and did try to follow some tutorials as to how to add a background gradient. However for some reason when I hit play, the gradient is visible but only for a split second at the start. It fades…

---

## [Begin a shape according to time](https://discourse.processing.org/t/begin-a-shape-according-to-time/5970)

<div class="topic-metadata">

**Author:** [@Chloe65](https://discourse.processing.org/u/Chloe65)\
**Replies:** 2\
**Last updated:** [November 27, 2018, 11:28pm UTC](https://discourse.processing.org/t/begin-a-shape-according-to-time/5970 "2018-11-27T23:28:25Z")

</div>

Hi everyone ! I am making an animation and I would like to start a shape a few seconds after launching my animation, but I don’t know if it is possible. I looked on forums, lessons, examples but I didn’t find anything… …

---

## [SaveString() overwrite text in .txt file](https://discourse.processing.org/t/savestring-overwrite-text-in-txt-file/5996)

<div class="topic-metadata">

**Author:** [@polispace](https://discourse.processing.org/u/polispace)\
**Replies:** 28\
**Last updated:** [November 27, 2018, 10:02pm UTC](https://discourse.processing.org/t/savestring-overwrite-text-in-txt-file/5996 "2018-11-27T22:02:32Z")

</div>

Hi everyone. I receive single words form a microphone input that I will like to save in a text file. I manage to save one word in the text file, but when i say a new word the old one get overwritten. How can I add the…

---

## [Collision detection with circle and square test](https://discourse.processing.org/t/collision-detection-with-circle-and-square-test/5859)

<div class="topic-metadata">

**Author:** [@blankbleak](https://discourse.processing.org/u/blankbleak)\
**Replies:** 5\
**Last updated:** [November 27, 2018, 6:50pm UTC](https://discourse.processing.org/t/collision-detection-with-circle-and-square-test/5859 "2018-11-27T18:50:40Z")

</div>

Hi, I am struggling with learning how to use colission detection in processing, and i would really appreciate some help, I have tried everything in my power to figure it out, but I just can’t do it. For a project in my c…

---

## [Edit/Transform rect() together with the video beneath it?](https://discourse.processing.org/t/edit-transform-rect-together-with-the-video-beneath-it/5990)

<div class="topic-metadata">

**Author:** [@kratskcinnay](https://discourse.processing.org/u/kratskcinnay)\
**Replies:** 1\
**Last updated:** [November 27, 2018, 6:06pm UTC](https://discourse.processing.org/t/edit-transform-rect-together-with-the-video-beneath-it/5990 "2018-11-27T18:06:28Z")

</div>

Hey everyone, I’m pretty sure this should be fairly easy but I couldn’t figure out a way to do it and didn’t find anything online (probably because it’s to obvious :D). I am using using a video that i am cutting and cr…

---

## [NoSuchMethodException using reflection](https://discourse.processing.org/t/nosuchmethodexception-using-reflection/5976)

<div class="topic-metadata">

**Author:** [@clankill3r](https://discourse.processing.org/u/clankill3r)\
**Replies:** 6\
**Last updated:** [November 27, 2018, 2:01pm UTC](https://discourse.processing.org/t/nosuchmethodexception-using-reflection/5976 "2018-11-27T14:01:47Z")

</div>

I wan’t to use the protected method colorCalc in the PGraphics object. I get a NoSuchMethodException and I have no clue why. Can someone help? import java.lang.reflect.\*; void setup() { int c = g\_color(g, 128); } …

---

## [How to visualize forces of a particle system?](https://discourse.processing.org/t/how-to-visualize-forces-of-a-particle-system/5751)

<div class="topic-metadata">

**Author:** [@Lexyth](https://discourse.processing.org/u/Lexyth)\
**Replies:** 20\
**Last updated:** [November 27, 2018, 9:15am UTC](https://discourse.processing.org/t/how-to-visualize-forces-of-a-particle-system/5751 "2018-11-27T09:15:16Z")

</div>

I’ve got a particle system with particles that attract and repel each other based on their distance. What i need now is a way to make the forces of those particles visible. Something like a magnetic field visualization. …

---

## [Adding a stopwatch to a clock](https://discourse.processing.org/t/adding-a-stopwatch-to-a-clock/5973)

<div class="topic-metadata">

**Author:** [@yamiyugi](https://discourse.processing.org/u/yamiyugi)\
**Replies:** 1\
**Last updated:** [November 27, 2018, 5:31am UTC](https://discourse.processing.org/t/adding-a-stopwatch-to-a-clock/5973 "2018-11-27T05:31:09Z")

</div>

Hi! I’m trying to add a stopwatch to my clock. When I start the program the clock shows the current time and I want to add a stopwatch that starts when the mouse is clicked. The clock itself works but I can’t get my sto…

---

## [Question about OOP](https://discourse.processing.org/t/question-about-oop/5960)

<div class="topic-metadata">

**Author:** [@vjjv](https://discourse.processing.org/u/vjjv)\
**Replies:** 1\
**Last updated:** [November 27, 2018, 12:15am UTC](https://discourse.processing.org/t/question-about-oop/5960 "2018-11-27T00:15:42Z")

</div>

hello! i\`ve a deep question: imagine that you have objects (maybe an ellipse) and differents behaviors (move up, down, left, rigth) what would be the best way to program in a OOP paradigm? using interfaces? i mean, i wou…

---

## [How to add a trail particle effect to a moving circle?](https://discourse.processing.org/t/how-to-add-a-trail-particle-effect-to-a-moving-circle/5967)

<div class="topic-metadata">

**Author:** [@francium401](https://discourse.processing.org/u/francium401)\
**Replies:** 1\
**Last updated:** [November 26, 2018, 9:09pm UTC](https://discourse.processing.org/t/how-to-add-a-trail-particle-effect-to-a-moving-circle/5967 "2018-11-26T21:09:30Z")

</div>

Basically what I have here is a circle orbiting another (very tinier) circle. What I’ve been trying to figure out is how to add a trail particle effect to the orbiting circle, where the end of the trail fades from white…

---

## [Debugging Game P5js](https://discourse.processing.org/t/debugging-game-p5js/5966)

<div class="topic-metadata">

**Author:** [@shoneyjosh](https://discourse.processing.org/u/shoneyjosh)\
**Replies:** 1\
**Last updated:** [November 26, 2018, 8:17pm UTC](https://discourse.processing.org/t/debugging-game-p5js/5966 "2018-11-26T20:17:35Z")

</div>

It is a game where you avoid the incoming enemies. Uncaught TypeError: Cannot read property ‘x’ of undefined (sketch: line 62) whenever the enemy hits the player //loop through all enemies for(var i = 0; i \< enemies…

---

## [Collision between two ArrayList elements](https://discourse.processing.org/t/collision-between-two-arraylist-elements/5932)

<div class="topic-metadata">

**Author:** [@Rangerz132](https://discourse.processing.org/u/Rangerz132)\
**Replies:** 10\
**Last updated:** [November 26, 2018, 7:27pm UTC](https://discourse.processing.org/t/collision-between-two-arraylist-elements/5932 "2018-11-26T19:27:52Z")

</div>

Hi everyone! I’m currently at University in Multimedia and I’m learning Processing (which is pretty cool). For my lastest project, I need to do a game where there is some collisions. The problem is that I know how to d…

---

## [Fixed size with scroll](https://discourse.processing.org/t/fixed-size-with-scroll/5947)

<div class="topic-metadata">

**Author:** [@HelaRua](https://discourse.processing.org/u/HelaRua)\
**Replies:** 1\
**Last updated:** [November 26, 2018, 12:40pm UTC](https://discourse.processing.org/t/fixed-size-with-scroll/5947 "2018-11-26T12:40:15Z")

</div>

Hi :slight\_smile: I’m very new to processing. —noob alert— For my college project I’m trying to create a background with a fixed size at first glance (2560x1600) but is in reality bigger than that (3840x3200), allowing…

---

## [Processing to draw NACA 4 digit airfoils](https://discourse.processing.org/t/processing-to-draw-naca-4-digit-airfoils/5739)

<div class="topic-metadata">

**Author:** [@HackinHarry](https://discourse.processing.org/u/HackinHarry)\
**Replies:** 5\
**Last updated:** [November 21, 2018, 5:32am UTC](https://discourse.processing.org/t/processing-to-draw-naca-4-digit-airfoils/5739 "2018-11-21T05:32:32Z")

</div>

I want to use processing to draw NACA 4 digit airfoils. Ive been to lots of NASA websites, read a few papers, found some python code, messed with a java applet and still got NADA. I understand basically how they are ge…

---

## [Background of Triangular objects](https://discourse.processing.org/t/background-of-triangular-objects/5857)

<div class="topic-metadata">

**Author:** [@jbott](https://discourse.processing.org/u/jbott)\
**Replies:** 5\
**Last updated:** [November 26, 2018, 1:25am UTC](https://discourse.processing.org/t/background-of-triangular-objects/5857 "2018-11-26T01:25:58Z")

</div>

Hey guys! I’ve been playing around with processing as of yesterday and am stuck on creating a background of triangular objects for my project. The idea of the project is to have triangles in the background so that I can…

---

## [PVector.rotate() rounding bug?](https://discourse.processing.org/t/pvector-rotate-rounding-bug/5929)

<div class="topic-metadata">

**Author:** [@JOW](https://discourse.processing.org/u/JOW)\
**Replies:** 7\
**Last updated:** [November 25, 2018, 6:22pm UTC](https://discourse.processing.org/t/pvector-rotate-rounding-bug/5929 "2018-11-25T18:22:34Z")

</div>

I was rotating some vectors and got some strange behaviour.It seems like the PVector.rotate() implementation has some rounding error bug in it, as it scales the vector as it rotates it. I wrote a simple program/snippet …

---

## [I need help is to make an easy game but i have some problem now](https://discourse.processing.org/t/i-need-help-is-to-make-an-easy-game-but-i-have-some-problem-now/5803)

<div class="topic-metadata">

**Author:** [@nhghi](https://discourse.processing.org/u/nhghi)\
**Replies:** 2\
**Last updated:** [November 25, 2018, 5:23pm UTC](https://discourse.processing.org/t/i-need-help-is-to-make-an-easy-game-but-i-have-some-problem-now/5803 "2018-11-25T17:23:00Z")

</div>

my basic idea is to draw a small planet (ellipse code) and then make it move. But I want to minimize where it can go. like I will make a boolean ( kinda hitbox) wich smaller than my planet, if the hitbox touches the rea…

---

## [A simplified version of a Yahtzee game](https://discourse.processing.org/t/a-simplified-version-of-a-yahtzee-game/5922)

<div class="topic-metadata">

**Author:** [@James](https://discourse.processing.org/u/James)\
**Replies:** 2\
**Last updated:** [November 25, 2018, 5:20pm UTC](https://discourse.processing.org/t/a-simplified-version-of-a-yahtzee-game/5922 "2018-11-25T17:20:13Z")

</div>

Hello y’all I’m trying to make a simplified version of a Yahtzee game I am stuck trying to display the frequencies of each number(1 to 6) and returning the result as an array of the Sides on the Dice in integers. It i…

---

## [\[SOLVED\] P3D ellipse rotation problem](https://discourse.processing.org/t/solved-p3d-ellipse-rotation-problem/5908)

<div class="topic-metadata">

**Author:** [@megagoose](https://discourse.processing.org/u/megagoose)\
**Replies:** 4\
**Last updated:** [November 25, 2018, 3:09pm UTC](https://discourse.processing.org/t/solved-p3d-ellipse-rotation-problem/5908 "2018-11-25T15:09:25Z")

</div>

Hello there fellow coders! Let’s say I want to rotate an ellipse around it’s axis. I came up with the following code, but it is not doing what I want. float alpha = 0; int r = 200; void setup() { size(500, 500, P3D)…

---

## [Questions about BouncyBubbles example](https://discourse.processing.org/t/questions-about-bouncybubbles-example/5883)

<div class="topic-metadata">

**Author:** [@amundsen](https://discourse.processing.org/u/amundsen)\
**Replies:** 26\
**Last updated:** [November 25, 2018, 12:02pm UTC](https://discourse.processing.org/t/questions-about-bouncybubbles-example/5883 "2018-11-25T12:02:07Z")

</div>

Hello, I am trying to fully understand the Java BouncyBubbles example. Here’s the code: int numBalls = 12; float spring = 0.05; float gravity = 0.03; float friction = -0.9; Ball\[\] balls = new Ball\[numBalls\]; void set…

---

## [Detecting when the mouse enters / exits sketch window](https://discourse.processing.org/t/detecting-when-the-mouse-enters-exits-sketch-window/5798)

<div class="topic-metadata">

**Author:** [@quark](https://discourse.processing.org/u/quark)\
**Replies:** 7\
**Last updated:** [November 25, 2018, 9:34am UTC](https://discourse.processing.org/t/detecting-when-the-mouse-enters-exits-sketch-window/5798 "2018-11-25T09:34:40Z")

</div>

I am interested in creating a new feature for G4P but I need to detect when the mouse enters and exits the client area (drawing area) of the sketch. Since Processing does not generate these events I am trying to do this…

---

## [Exe Patching Problem](https://discourse.processing.org/t/exe-patching-problem/5909)

<div class="topic-metadata">

**Author:** [@Odermonicon](https://discourse.processing.org/u/Odermonicon)\
**Replies:** 0\
**Last updated:** [November 25, 2018, 5:55am UTC](https://discourse.processing.org/t/exe-patching-problem/5909 "2018-11-25T05:55:17Z")

</div>

I get so many errors for no reason… (Reason: i did not initilaze a custom class :man\_facepalming:) CodeMain: byte\[\] bExe; String\[\] midpatch; Patch finpatch; void setup() { selectOutput("Save the output file:&q…

---

## [Digital dashboard](https://discourse.processing.org/t/digital-dashboard/5861)

<div class="topic-metadata">

**Author:** [@processing1234](https://discourse.processing.org/u/processing1234)\
**Replies:** 7\
**Last updated:** [November 25, 2018, 12:37am UTC](https://discourse.processing.org/t/digital-dashboard/5861 "2018-11-25T00:37:36Z")

</div>

hey, for an assignment we have to create a digital dashboard which shows speed in Km/hr, fuel level in liters, RPM. This is the code I’ve done so far. I’d really appreciate any help. Thanks in advance. I’m really new to …

---

## [User Input from KeyBoard](https://discourse.processing.org/t/user-input-from-keyboard/5904)

<div class="topic-metadata">

**Author:** [@alexac692](https://discourse.processing.org/u/alexac692)\
**Replies:** 1\
**Last updated:** [November 24, 2018, 11:51pm UTC](https://discourse.processing.org/t/user-input-from-keyboard/5904 "2018-11-24T23:51:03Z")

</div>

I am trying to write a code that will return a string as a result of the user pressing 1, 2, or 3 on their keyboard. This is what I have so far but when i press keys nothing happens. What is wrong with my code? String c…

---

## [Looping different class instances](https://discourse.processing.org/t/looping-different-class-instances/5843)

<div class="topic-metadata">

**Author:** [@Aleksi](https://discourse.processing.org/u/Aleksi)\
**Replies:** 10\
**Last updated:** [November 24, 2018, 10:33pm UTC](https://discourse.processing.org/t/looping-different-class-instances/5843 "2018-11-24T22:33:41Z")

</div>

I’ve kind of painted myself into a corner. I need to be able to loop through instances of different classes to run methods of a class they all instantiate. I know something like this is a good candidate for an Interface…

---

## [Updating Squares](https://discourse.processing.org/t/updating-squares/5849)

<div class="topic-metadata">

**Author:** [@oscie24](https://discourse.processing.org/u/oscie24)\
**Replies:** 3\
**Last updated:** [November 24, 2018, 9:37pm UTC](https://discourse.processing.org/t/updating-squares/5849 "2018-11-24T21:37:42Z")

</div>

This is for a project but i’m currently in a little oh cock moment. My aim is to make a tessellator. Where you click on a small grid and that pattern tesselates on a bigger grid. the problem i’m having is that i don’t k…

---

## [Programme processing](https://discourse.processing.org/t/programme-processing/5797)

<div class="topic-metadata">

**Author:** [@carotte](https://discourse.processing.org/u/carotte)\
**Replies:** 2\
**Last updated:** [November 24, 2018, 7:16am UTC](https://discourse.processing.org/t/programme-processing/5797 "2018-11-24T07:16:41Z")

</div>

BONSOIR, j’ai un programme Processing à effectuer, y aurait-il des personnes qui serait qualifier dans le domaine pour me donner un coup de main car je débute. le programme est bien évidement de base. le but est de cré…

---

## [Building a clock - I got stuck](https://discourse.processing.org/t/building-a-clock-i-got-stuck/5837)

<div class="topic-metadata">

**Author:** [@somaflaco](https://discourse.processing.org/u/somaflaco)\
**Replies:** 7\
**Last updated:** [November 24, 2018, 12:07pm UTC](https://discourse.processing.org/t/building-a-clock-i-got-stuck/5837 "2018-11-24T12:07:17Z")

</div>

Hey Guys, I’m completely new to processing and i’m trying to build a clock. I want the top row to indicate the hours (12rects), the second row to indicate the tens digits for the minutes (6rects), the third row to in…

---

## ["Langton's Car" Not working](https://discourse.processing.org/t/langtons-car-not-working/5817)

<div class="topic-metadata">

**Author:** [@MCCreeper8890](https://discourse.processing.org/u/MCCreeper8890)\
**Replies:** 8\
**Last updated:** [November 23, 2018, 10:53pm UTC](https://discourse.processing.org/t/langtons-car-not-working/5817 "2018-11-23T22:53:00Z")

</div>

The idea is this: Set all pixels positions on screen to a random value of either 0,1,2, or 3. Set a particle “car” in the middle with an arbitrary velocity vector. On each frame, the car will move to a new position. if …

---

## [Differentiating Array definitions](https://discourse.processing.org/t/differentiating-array-definitions/5834)

<div class="topic-metadata">

**Author:** [@LordCacops](https://discourse.processing.org/u/LordCacops)\
**Replies:** 5\
**Last updated:** [November 23, 2018, 12:13pm UTC](https://discourse.processing.org/t/differentiating-array-definitions/5834 "2018-11-23T12:13:11Z")

</div>

Hello friends, I am programming a genome that’s made of chromosomes. Each chromosome is an array. Each defines its values through symmetry producing operations (symmetry as in retrogrades of the integer sequence of its …

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

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