# Coding Questions

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

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

**Page:** 74

---

## [Direction of Up vector with Camera, P3D](https://discourse.processing.org/t/direction-of-up-vector-with-camera-p3d/25434)

<div class="topic-metadata">

**Author:** [@jimyoung](https://discourse.processing.org/u/jimyoung)\
**Replies:** 4\
**Last updated:** [November 16, 2020, 3:45pm UTC](https://discourse.processing.org/t/direction-of-up-vector-with-camera-p3d/25434 "2020-11-16T15:45:33Z")

</div>

Hey everyone! Just looking at P3D here, and I noticed something that’s got me slightly confused. I am guessing it’s something simple, so I hope for some clarification. I have posted a quick example at the bottom. In Pro…

---

## [hint(DISABLE\_OPTIMIZED\_STROKE) & Processing Matrices](https://discourse.processing.org/t/hint-disable-optimized-stroke-processing-matrices/25442)

<div class="topic-metadata">

**Author:** [@Geo\_Pi](https://discourse.processing.org/u/Geo_Pi)\
**Replies:** 1\
**Last updated:** [November 16, 2020, 3:08pm UTC](https://discourse.processing.org/t/hint-disable-optimized-stroke-processing-matrices/25442 "2020-11-16T15:08:36Z")

</div>

Hello everybody, I have been struggling with this issue and I can’t seem to find a solution. I want to create a Sphere looking Particle system, using billboarding and a normal map for shading, to avoid having to handle…

---

## [Low fps problem](https://discourse.processing.org/t/low-fps-problem/12313)

<div class="topic-metadata">

**Author:** [@GuilhermeVolker](https://discourse.processing.org/u/GuilhermeVolker)\
**Replies:** 15\
**Last updated:** [November 16, 2020, 8:56am UTC](https://discourse.processing.org/t/low-fps-problem/12313 "2020-11-16T08:56:50Z")

</div>

My sketch has 10 images, with stuff moving and so on, the problem is that even with the function frameRate(30) i only get 9 to 12 FPS. I had try the sketch on pretty good pc and the result is the same. The promp comand s…

---

## [How to draw a polygon, when x is getting bigger, its sides getting more](https://discourse.processing.org/t/how-to-draw-a-polygon-when-x-is-getting-bigger-its-sides-getting-more/24987)

<div class="topic-metadata">

**Author:** [@mengtong](https://discourse.processing.org/u/mengtong)\
**Replies:** 41\
**Last updated:** [November 16, 2020, 5:37am UTC](https://discourse.processing.org/t/how-to-draw-a-polygon-when-x-is-getting-bigger-its-sides-getting-more/24987 "2020-11-16T05:37:00Z")

</div>

Here is my code. I wang polygon’s sided gets more when x gets bigger. But it looks incorrect. Can someone help me check it. int points; int radius=100; void setup() { size(500, 500); points=mouseX/20; } void draw(…

---

## [Collision detection Ball](https://discourse.processing.org/t/collision-detection-ball/25210)

<div class="topic-metadata">

**Author:** [@MitchMitch](https://discourse.processing.org/u/MitchMitch)\
**Replies:** 44\
**Last updated:** [November 15, 2020, 8:51pm UTC](https://discourse.processing.org/t/collision-detection-ball/25210 "2020-11-15T20:51:51Z")

</div>

import static javax.swing.JOptionPane.showMessageDialog; import java.util.Random; Random rand = new Random(); float x = 450; float Ball = 0; int RandomSpawnWidth; float speedBall = 3; int score = 0; float speedPl…

---

## [How to check a function for every single array](https://discourse.processing.org/t/how-to-check-a-function-for-every-single-array/25444)

<div class="topic-metadata">

**Author:** [@tea](https://discourse.processing.org/u/tea)\
**Replies:** 3\
**Last updated:** [November 15, 2020, 8:31pm UTC](https://discourse.processing.org/t/how-to-check-a-function-for-every-single-array/25444 "2020-11-15T20:31:31Z")

</div>

So I’m trying to make a platformer game where the platform is created in the set up in an array, and then I check the collision of the character and the platform with another function, like so: In the setup: void setup…

---

## [I just studied user defined function, got some trouble](https://discourse.processing.org/t/i-just-studied-user-defined-function-got-some-trouble/25405)

<div class="topic-metadata">

**Author:** [@mengtong](https://discourse.processing.org/u/mengtong)\
**Replies:** 17\
**Last updated:** [November 15, 2020, 7:59pm UTC](https://discourse.processing.org/t/i-just-studied-user-defined-function-got-some-trouble/25405 "2020-11-15T19:59:06Z")

</div>

I am trying to draw a picture like this. here is my code. I just start it. void setup() { size(800, 800); noStroke(); //No black outline around the circles } void draw() { final int CIRCLE\_SIZE = 20; final…

---

## [Creating a Pong using tutorials](https://discourse.processing.org/t/creating-a-pong-using-tutorials/25428)

<div class="topic-metadata">

**Author:** [@GalactusBR](https://discourse.processing.org/u/GalactusBR)\
**Replies:** 5\
**Last updated:** [November 15, 2020, 7:48pm UTC](https://discourse.processing.org/t/creating-a-pong-using-tutorials/25428 "2020-11-15T19:48:41Z")

</div>

homework policy \* asking questions I need help creating a Pong game that have Points system Victory and Loss condition “Ball” with physics simulation 2 player option 1 player option with a CPU Menu …

---

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

<div class="topic-metadata">

**Author:** [@ruben89](https://discourse.processing.org/u/ruben89)\
**Replies:** 36\
**Last updated:** [November 15, 2020, 5:17pm UTC](https://discourse.processing.org/t/i-need-help-with-a-code-timer/25377 "2020-11-15T17:17:21Z")

</div>

I have this code and I want to make the square disappear when clicking a key and two seconds after clicking it, the square reappears in another position. Thanks! int cuadrado=60; float recX, recY; void setup() { fu…

---

## [Surface and length](https://discourse.processing.org/t/surface-and-length/25394)

<div class="topic-metadata">

**Author:** [@ala](https://discourse.processing.org/u/ala)\
**Replies:** 6\
**Last updated:** [November 15, 2020, 6:15am UTC](https://discourse.processing.org/t/surface-and-length/25394 "2020-11-15T06:15:43Z")

</div>

Hello, I have a problem. I have to write a program for designating the area and length of the edge of a color spot at the click of a mouse. I know that i must load a picture and and that the actions are after a click, …

---

## [How can I rotate the Sketch in 3D while its drawing](https://discourse.processing.org/t/how-can-i-rotate-the-sketch-in-3d-while-its-drawing/25389)

<div class="topic-metadata">

**Author:** [@ssdesign](https://discourse.processing.org/u/ssdesign)\
**Replies:** 8\
**Last updated:** [November 15, 2020, 12:32am UTC](https://discourse.processing.org/t/how-can-i-rotate-the-sketch-in-3d-while-its-drawing/25389 "2020-11-15T00:32:00Z")

</div>

Hi, I am trying to draw points in 3D space and while the sketch draws it, I want to continuously rotate the sketch so that I can view the dots in 3D space. Somehow I am not able to figure out how to do this. Here is m…

---

## [Motorbike contructor help](https://discourse.processing.org/t/motorbike-contructor-help/25421)

<div class="topic-metadata">

**Author:** [@TheGullible1](https://discourse.processing.org/u/TheGullible1)\
**Replies:** 1\
**Last updated:** [November 14, 2020, 2:37pm UTC](https://discourse.processing.org/t/motorbike-contructor-help/25421 "2020-11-14T14:37:55Z")

</div>

im trying to add a constructor to my code and I think I don’t understand how to do it my code: Motorbike redBike; Motorbike blueBike; void setup() //called only once at the start { size(500,100); Motorbike(30, RE…

---

## [I need help with my code(scale problem)](https://discourse.processing.org/t/i-need-help-with-my-code-scale-problem/25388)

<div class="topic-metadata">

**Author:** [@Fungineer1](https://discourse.processing.org/u/Fungineer1)\
**Replies:** 1\
**Last updated:** [November 14, 2020, 8:06am UTC](https://discourse.processing.org/t/i-need-help-with-my-code-scale-problem/25388 "2020-11-14T08:06:04Z")

</div>

please format code with \</\> button \* homework policy \* asking questions So I was working on my code, which is to draw three bees, and each time they bounce on to wall or hive, they would bounce back(aka change their …

---

## [Trying to use boolean and if statement to do colour collision detection (Tron)](https://discourse.processing.org/t/trying-to-use-boolean-and-if-statement-to-do-colour-collision-detection-tron/25399)

<div class="topic-metadata">

**Author:** [@TheGullible1](https://discourse.processing.org/u/TheGullible1)\
**Replies:** 3\
**Last updated:** [November 13, 2020, 2:51pm UTC](https://discourse.processing.org/t/trying-to-use-boolean-and-if-statement-to-do-colour-collision-detection-tron/25399 "2020-11-13T14:51:40Z")

</div>

So i have created the tron light bike and now I want it that when it crashes it I want it maybe to reset and then go again. for this I’m using of a crash detection function using get to check the pixel colour, a crash ha…

---

## [Tron Light Cycle project I'm making](https://discourse.processing.org/t/tron-light-cycle-project-im-making/25398)

<div class="topic-metadata">

**Author:** [@TheGullible1](https://discourse.processing.org/u/TheGullible1)\
**Replies:** 1\
**Last updated:** [November 13, 2020, 12:38pm UTC](https://discourse.processing.org/t/tron-light-cycle-project-im-making/25398 "2020-11-13T12:38:16Z")

</div>

JAVA\*\* so im trying to move my point continuously when a key is pressed it will only move that direction. //arrow keys to draw float x,y; int speedY = 0; int speedX = 1; void setup(){ size(500,500); background(255,…

---

## [Is it possible to save any data produced with sketch on web?](https://discourse.processing.org/t/is-it-possible-to-save-any-data-produced-with-sketch-on-web/25386)

<div class="topic-metadata">

**Author:** [@candydope](https://discourse.processing.org/u/candydope)\
**Replies:** 5\
**Last updated:** [November 13, 2020, 7:27am UTC](https://discourse.processing.org/t/is-it-possible-to-save-any-data-produced-with-sketch-on-web/25386 "2020-11-13T07:27:17Z")

</div>

hello, I’m newbie for coding. I use processing mostly for art projects. now I’m working on coding for my friend’s project which is about writing a poem with limited words on web site. I managed to make sketch which seem…

---

## [Change object direction when reaching edges](https://discourse.processing.org/t/change-object-direction-when-reaching-edges/24761)

<div class="topic-metadata">

**Author:** [@lukeltw](https://discourse.processing.org/u/lukeltw)\
**Replies:** 16\
**Last updated:** [November 12, 2020, 7:40pm UTC](https://discourse.processing.org/t/change-object-direction-when-reaching-edges/24761 "2020-11-12T19:40:06Z")

</div>

How can I change the direction of my image? As you know, a fish has a head, unlike a ball, each side could be its head, so when my fish reach the right side, I want to let them turn around, and now they are just moving…

---

## [Gradient along a row of squares](https://discourse.processing.org/t/gradient-along-a-row-of-squares/25355)

<div class="topic-metadata">

**Author:** [@Pugsofwar](https://discourse.processing.org/u/Pugsofwar)\
**Replies:** 2\
**Last updated:** [November 12, 2020, 9:24am UTC](https://discourse.processing.org/t/gradient-along-a-row-of-squares/25355 "2020-11-12T09:24:00Z")

</div>

please format code with \</\> button \* homework policy \* asking questions I’m trying to create a row of squares and the gradient from white to black using a for loop but I am struggling with it

---

## [Please Help me for Text Function ! I am noob](https://discourse.processing.org/t/please-help-me-for-text-function-i-am-noob/25356)

<div class="topic-metadata">

**Author:** [@AzizurRahman](https://discourse.processing.org/u/AzizurRahman)\
**Replies:** 5\
**Last updated:** [November 12, 2020, 8:39am UTC](https://discourse.processing.org/t/please-help-me-for-text-function-i-am-noob/25356 "2020-11-12T08:39:46Z")

</div>

Hi everyone I am A beginner. I wrote this code so far. And I want make output texts in way so that it is has only 5 column inside the screen and when the output is bigger than width it goes to new line under the previous…

---

## [I am a beginner, please help!](https://discourse.processing.org/t/i-am-a-beginner-please-help/25336)

<div class="topic-metadata">

**Author:** [@AzizurRahman](https://discourse.processing.org/u/AzizurRahman)\
**Replies:** 12\
**Last updated:** [November 12, 2020, 2:01am UTC](https://discourse.processing.org/t/i-am-a-beginner-please-help/25336 "2020-11-12T02:01:06Z")

</div>

i need to make something in which when user inputs some string it got converted into another sets of string

---

## [3D Face in Processing?](https://discourse.processing.org/t/3d-face-in-processing/21596)

<div class="topic-metadata">

**Author:** [@rkk16](https://discourse.processing.org/u/rkk16)\
**Replies:** 8\
**Last updated:** [November 10, 2020, 6:10pm UTC](https://discourse.processing.org/t/3d-face-in-processing/21596 "2020-11-10T18:10:25Z")

</div>

Hi all, I’m quite new to Processing. I’ve got the hang of the 2D quite well and managed to build a complicated social robot’s face with various functions working. I was wondering if anyone had any idea about how I’d be a…

---

## [newInstance() method](https://discourse.processing.org/t/newinstance-method/25324)

<div class="topic-metadata">

**Author:** [@alb85](https://discourse.processing.org/u/alb85)\
**Replies:** 4\
**Last updated:** [November 10, 2020, 5:39pm UTC](https://discourse.processing.org/t/newinstance-method/25324 "2020-11-10T17:39:07Z")

</div>

Hello everybody! I think there is a problem in Processing with the method newInstance(). If I run this simple example: void setup(){ try{ Test t = Test.class.newInstance(); }catch(Exception e){ e.printStackTra…

---

## [Ellipse limit of the drawing](https://discourse.processing.org/t/ellipse-limit-of-the-drawing/25319)

<div class="topic-metadata">

**Author:** [@Dimdimtri](https://discourse.processing.org/u/Dimdimtri)\
**Replies:** 4\
**Last updated:** [November 10, 2020, 3:03pm UTC](https://discourse.processing.org/t/ellipse-limit-of-the-drawing/25319 "2020-11-10T15:03:22Z")

</div>

Hello everyone ! after a lot of research, I am asking for your help. I draw a random Bezier inside an ellipse, but I would like this ellipse to be the limit of the drawing as well to avoid continuing the lines outside …

---

## [Extrude function](https://discourse.processing.org/t/extrude-function/25290)

<div class="topic-metadata">

**Author:** [@Vako](https://discourse.processing.org/u/Vako)\
**Replies:** 5\
**Last updated:** [November 9, 2020, 7:41pm UTC](https://discourse.processing.org/t/extrude-function/25290 "2020-11-09T19:41:00Z")

</div>

Hello, I’ve been coding for a few years in processing and I’ve been developing some simple simulations, however I wanted to take my work and do it in 3D, my pieces are quite simple (just a rectangle with 2 semi circles i…

---

## [Incremetly speed millis()?](https://discourse.processing.org/t/incremetly-speed-millis/25293)

<div class="topic-metadata">

**Author:** [@claudinho7](https://discourse.processing.org/u/claudinho7)\
**Replies:** 1\
**Last updated:** [November 9, 2020, 1:05pm UTC](https://discourse.processing.org/t/incremetly-speed-millis/25293 "2020-11-09T13:05:16Z")

</div>

hello, im working on a small project thats due in 2 hours and im hard stuck, i need to find a way to speed my clock in the same time as i speed the background to give it a “fast travel trough time” look. Is there a way…

---

## [Mapping time to an array](https://discourse.processing.org/t/mapping-time-to-an-array/25286)

<div class="topic-metadata">

**Author:** [@lkalotihos](https://discourse.processing.org/u/lkalotihos)\
**Replies:** 1\
**Last updated:** [November 8, 2020, 9:28pm UTC](https://discourse.processing.org/t/mapping-time-to-an-array/25286 "2020-11-08T21:28:36Z")

</div>

Hi there, I’m trying to display a new ellipse on the sketch as each second goes by, to eventually get a row of ellipses. I’m running in to trouble displaying a new ellipse though. Thanks for the help! void setup(){ s…

---

## [Drawing on screen after region clicked processing](https://discourse.processing.org/t/drawing-on-screen-after-region-clicked-processing/25280)

<div class="topic-metadata">

**Author:** [@crimpqwe](https://discourse.processing.org/u/crimpqwe)\
**Replies:** 1\
**Last updated:** [November 8, 2020, 4:08pm UTC](https://discourse.processing.org/t/drawing-on-screen-after-region-clicked-processing/25280 "2020-11-08T16:08:08Z")

</div>

I’m trying to make it so that when the user clicks the pencil icon in the program they are allowed to draw until the pencil has been clicked again. ive not added in a toggle yet but my current problem is that i get the d…

---

## [Parsing a JSON file - NYT API](https://discourse.processing.org/t/parsing-a-json-file-nyt-api/25281)

<div class="topic-metadata">

**Author:** [@okori](https://discourse.processing.org/u/okori)\
**Replies:** 0\
**Last updated:** [November 8, 2020, 3:36pm UTC](https://discourse.processing.org/t/parsing-a-json-file-nyt-api/25281 "2020-11-08T15:36:57Z")

</div>

Hey all, I am trying to use the NYT api following this tutorial http://blog.blprnt.com/blog/blprnt/processing-json-the-new-york-times It seems that when i try to grab the total from the array it says it cannot be found…

---

## [Solve 3 equations with 3 variables](https://discourse.processing.org/t/solve-3-equations-with-3-variables/25252)

<div class="topic-metadata">

**Author:** [@vestergaard12](https://discourse.processing.org/u/vestergaard12)\
**Replies:** 4\
**Last updated:** [November 8, 2020, 2:14pm UTC](https://discourse.processing.org/t/solve-3-equations-with-3-variables/25252 "2020-11-08T14:14:58Z")

</div>

Hello Processing foundation I have these 3 equations with 3 variables (a,b,c) that i want to solve using processing, but unfortunaly I do not have a clue how to do this. Therefore, I really hope that someone could hel…

---

## [I don't know how do that use the loop](https://discourse.processing.org/t/i-dont-know-how-do-that-use-the-loop/25269)

<div class="topic-metadata">

**Author:** [@zoe87](https://discourse.processing.org/u/zoe87)\
**Replies:** 1\
**Last updated:** [November 8, 2020, 8:50am UTC](https://discourse.processing.org/t/i-dont-know-how-do-that-use-the-loop/25269 "2020-11-08T08:50:06Z")

</div>

I need your help I don’t know how to do that use the loop to change the color

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

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