# Coding Questions

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

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

**Page:** 173

---

## [Question About correcting my code Pulses](https://discourse.processing.org/t/question-about-correcting-my-code-pulses/4034)

<div class="topic-metadata">

**Author:** [@gisue](https://discourse.processing.org/u/gisue)\
**Replies:** 5\
**Last updated:** [October 3, 2018, 10:25am UTC](https://discourse.processing.org/t/question-about-correcting-my-code-pulses/4034 "2018-10-03T10:25:30Z")

</div>

Hi all, I am a beginner in processing. could you please help me to correct the code. the question is: write the reverse motion of the previous example (using Processing array function is not allowed) And the below c…

---

## [Moving points into different directions](https://discourse.processing.org/t/moving-points-into-different-directions/4041)

<div class="topic-metadata">

**Author:** [@saotome](https://discourse.processing.org/u/saotome)\
**Replies:** 4\
**Last updated:** [October 3, 2018, 3:53pm UTC](https://discourse.processing.org/t/moving-points-into-different-directions/4041 "2018-10-03T15:53:46Z")

</div>

Good morning I’m trying to move a point from one coordinate to another one. Image it’s like this The code I have used for the left line of points is the following int ball\_radius; float ball\_y; float ball\_y0; float…

---

## [Create a grid out of rectangles](https://discourse.processing.org/t/create-a-grid-out-of-rectangles/4084)

<div class="topic-metadata">

**Author:** [@Jrekz](https://discourse.processing.org/u/Jrekz)\
**Replies:** 4\
**Last updated:** [October 3, 2018, 3:52pm UTC](https://discourse.processing.org/t/create-a-grid-out-of-rectangles/4084 "2018-10-03T15:52:38Z")

</div>

Hi, I want to draw rectangles (size=50) in a grid of 7 columns and 6 rows. With a sketch border offset of 15 pixels and 5 pixels between each rectangle. This is how it should look like: . When I try add the space some…

---

## [Rotating an object on command](https://discourse.processing.org/t/rotating-an-object-on-command/3896)

<div class="topic-metadata">

**Author:** [@ToivoUkkonen](https://discourse.processing.org/u/ToivoUkkonen)\
**Replies:** 3\
**Last updated:** [October 3, 2018, 3:24pm UTC](https://discourse.processing.org/t/rotating-an-object-on-command/3896 "2018-10-03T15:24:38Z")

</div>

Hello, in school we are currently learning coding and for a while i’ve been trying to get an object to rotate, when I press certain keys. Here is the code I am working with as of right now: int X; int Y; int SIVU; int S…

---

## [Shooting bullets class -- bullets disappearing](https://discourse.processing.org/t/shooting-bullets-class-bullets-disappearing/4028)

<div class="topic-metadata">

**Author:** [@Marcus152](https://discourse.processing.org/u/Marcus152)\
**Replies:** 2\
**Last updated:** [October 3, 2018, 1:42am UTC](https://discourse.processing.org/t/shooting-bullets-class-bullets-disappearing/4028 "2018-10-03T01:42:11Z")

</div>

Hey guys, i’m trying to make a game where bullets shoot in the direction of my mouse. I found some code online, and it worked for the most part; except for one thing. The original code that I found used a 600x600 window …

---

## [\[SOLVED\] Fullscreen sketch scaling and preformance](https://discourse.processing.org/t/solved-fullscreen-sketch-scaling-and-preformance/3916)

<div class="topic-metadata">

**Author:** [@ScottGrogin](https://discourse.processing.org/u/ScottGrogin)\
**Replies:** 11\
**Last updated:** [October 2, 2018, 11:51pm UTC](https://discourse.processing.org/t/solved-fullscreen-sketch-scaling-and-preformance/3916 "2018-10-02T23:51:58Z")

</div>

I want to have my sketch resolution be the same across different screen sizes. I have tried using PGraphics with image() but the performance suffers and my sketches frame rate drops. Am I using PGraphics and image() inco…

---

## [Appending to arrays of arrays](https://discourse.processing.org/t/appending-to-arrays-of-arrays/3945)

<div class="topic-metadata">

**Author:** [@ducco](https://discourse.processing.org/u/ducco)\
**Replies:** 8\
**Last updated:** [October 2, 2018, 11:40pm UTC](https://discourse.processing.org/t/appending-to-arrays-of-arrays/3945 "2018-10-02T23:40:51Z")

</div>

i’m working on an art program and i’m trying to save the coordinates of the vectors in arrays one level in (for using layers) and i cant seem to get the append to work correctly. can someone help me? i made some example…

---

## [Open new windows with Processing](https://discourse.processing.org/t/open-new-windows-with-processing/4050)

<div class="topic-metadata">

**Author:** [@anon57009815](https://discourse.processing.org/u/anon57009815)\
**Replies:** 4\
**Last updated:** [October 2, 2018, 5:40pm UTC](https://discourse.processing.org/t/open-new-windows-with-processing/4050 "2018-10-02T17:40:14Z")

</div>

Hello all Is there a way to open new windows with processing? like another window of size(x,z). Maybe by a button or something. I would like to ask if there is some library that I can use that do that without coding f…

---

## [Switching from a circle to a square](https://discourse.processing.org/t/switching-from-a-circle-to-a-square/4038)

<div class="topic-metadata">

**Author:** [@Lore](https://discourse.processing.org/u/Lore)\
**Replies:** 1\
**Last updated:** [October 2, 2018, 11:12am UTC](https://discourse.processing.org/t/switching-from-a-circle-to-a-square/4038 "2018-10-02T11:12:34Z")

</div>

Hello, I cannot seem to figure out how to switch from a circle to a square by pressing a key. I have been able to do it, but when trying to switch the color or size it resets back (either to a circle or just disappears)…

---

## [Drawing a triangle and arc](https://discourse.processing.org/t/drawing-a-triangle-and-arc/3929)

<div class="topic-metadata">

**Author:** [@Lore](https://discourse.processing.org/u/Lore)\
**Replies:** 6\
**Last updated:** [October 2, 2018, 7:30am UTC](https://discourse.processing.org/t/drawing-a-triangle-and-arc/3929 "2018-10-02T07:30:11Z")

</div>

How would you draw a triangle and arc so that the center of the shape is where your mouse is? (using mouseX and mouseY) and how would you change the size of the triangle and arc?

---

## [Vector moves along the path](https://discourse.processing.org/t/vector-moves-along-the-path/3985)

<div class="topic-metadata">

**Author:** [@kokoo](https://discourse.processing.org/u/kokoo)\
**Replies:** 3\
**Last updated:** [October 1, 2018, 8:17pm UTC](https://discourse.processing.org/t/vector-moves-along-the-path/3985 "2018-10-01T20:17:56Z")

</div>

Can you suggest how to make PVector move along a continuous path (for example tracing number ‘8’). Do i need 2 vectors to do it?

---

## [PDF Export with BLUR](https://discourse.processing.org/t/pdf-export-with-blur/3974)

<div class="topic-metadata">

**Author:** [@KeremTurkyilmaz](https://discourse.processing.org/u/KeremTurkyilmaz)\
**Replies:** 1\
**Last updated:** [October 1, 2018, 6:29am UTC](https://discourse.processing.org/t/pdf-export-with-blur/3974 "2018-10-01T06:29:57Z")

</div>

Hi, I made a simple sketch and I want to export PDF File, but when the pdf is out is blurred.If I open the file in illustrator there is un full resolution, but if I use the pdf for a print is already blurred. import …

---

## [If Else Not Working Properly - Doesn't Work](https://discourse.processing.org/t/if-else-not-working-properly-doesnt-work/3995)

<div class="topic-metadata">

**Author:** [@clevelandbrowns](https://discourse.processing.org/u/clevelandbrowns)\
**Replies:** 6\
**Last updated:** [October 1, 2018, 6:01am UTC](https://discourse.processing.org/t/if-else-not-working-properly-doesnt-work/3995 "2018-10-01T06:01:28Z")

</div>

I’m a complete novice with Processing. I took lessons in Java and C++ years ago and am just now getting back into things so I figured I’d check this out. I have this code and it seems defective. When I press B, it works…

---

## [How can you load a PNG texture to an OBJ?](https://discourse.processing.org/t/how-can-you-load-a-png-texture-to-an-obj/3964)

<div class="topic-metadata">

**Author:** [@Mandelbrot](https://discourse.processing.org/u/Mandelbrot)\
**Replies:** 1\
**Last updated:** [October 1, 2018, 6:17am UTC](https://discourse.processing.org/t/how-can-you-load-a-png-texture-to-an-obj/3964 "2018-10-01T06:17:49Z")

</div>

My program is so far very simple. It loads an OBJ with phaser = loadShape(“PhaserTypeII.obj”);, then it displays it: shape(phaser, 0, 0) in setup and draw functions respectively. That worked, and the model shows up. I ha…

---

## [Trying to Draw on Sphere](https://discourse.processing.org/t/trying-to-draw-on-sphere/4000)

<div class="topic-metadata">

**Author:** [@CAUP](https://discourse.processing.org/u/CAUP)\
**Replies:** 9\
**Last updated:** [October 1, 2018, 5:30am UTC](https://discourse.processing.org/t/trying-to-draw-on-sphere/4000 "2018-10-01T05:30:23Z")

</div>

Hey! I’m new here. I’m trying to draw on a sphere. I have basically no idea how. The sphere rotates when you move the mouse. I want you to be able to draw on the sphere when you hold down the mouse. The sphere stops mov…

---

## [Need Help Understanding this code](https://discourse.processing.org/t/need-help-understanding-this-code/3992)

<div class="topic-metadata">

**Author:** [@ant](https://discourse.processing.org/u/ant)\
**Replies:** 1\
**Last updated:** [October 1, 2018, 2:16am UTC](https://discourse.processing.org/t/need-help-understanding-this-code/3992 "2018-10-01T02:16:40Z")

</div>

Need help understanding how these lines of codes work. I know they are variables and methods, but beyond that I’m confused. // int x=50; Circles\[\]circle=new Circles \[x\]; // void setup(){ size(800,600); frameRate(120…

---

## [ArrayList stuff for Snake game](https://discourse.processing.org/t/arraylist-stuff-for-snake-game/3780)

<div class="topic-metadata">

**Author:** [@Dinator14](https://discourse.processing.org/u/Dinator14)\
**Replies:** 24\
**Last updated:** [September 30, 2018, 4:33pm UTC](https://discourse.processing.org/t/arraylist-stuff-for-snake-game/3780 "2018-09-30T16:33:19Z")

</div>

I’m pretty new to coding with Processing (I know some basics) so I wanted to make the game Snake. I’ve been able to make the square move in a grid and eat food then spawn new food, but adding a new square is giving me tr…

---

## [How do I spawn ellipses at a given time interval and is it possible to create objects infinitely until a condition has been met?](https://discourse.processing.org/t/how-do-i-spawn-ellipses-at-a-given-time-interval-and-is-it-possible-to-create-objects-infinitely-until-a-condition-has-been-met/3976)

<div class="topic-metadata">

**Author:** [@K-ran123](https://discourse.processing.org/u/K-ran123)\
**Replies:** 7\
**Last updated:** [September 30, 2018, 1:38pm UTC](https://discourse.processing.org/t/how-do-i-spawn-ellipses-at-a-given-time-interval-and-is-it-possible-to-create-objects-infinitely-until-a-condition-has-been-met/3976 "2018-09-30T13:38:00Z")

</div>

Hello, I am making a program similar to Aimbooster where the player has to click on the target (ellipse) before it disappears. At the moment, i got the targets (ellipses) to spawn at random locations using random() on t…

---

## [SVG layers converted to shapes](https://discourse.processing.org/t/svg-layers-converted-to-shapes/3949)

<div class="topic-metadata">

**Author:** [@Geez](https://discourse.processing.org/u/Geez)\
**Replies:** 2\
**Last updated:** [September 29, 2018, 8:38pm UTC](https://discourse.processing.org/t/svg-layers-converted-to-shapes/3949 "2018-09-29T20:38:14Z")

</div>

Hello, Hope y’all doing good! I have an SVG geographic map with various islands on it. When opening the SVG in a vector graphics editor, each island is a layer that you can select. Is there is a way for processing to…

---

## [Curve that passes through three points](https://discourse.processing.org/t/curve-that-passes-through-three-points/3944)

<div class="topic-metadata">

**Author:** [@molo32](https://discourse.processing.org/u/molo32)\
**Replies:** 1\
**Last updated:** [September 29, 2018, 2:44am UTC](https://discourse.processing.org/t/curve-that-passes-through-three-points/3944 "2018-09-29T02:44:35Z")

</div>

how to draw a curve according to three given points? for example curve (10,10, 20,50, 80,75) this function would draw a curve that passes through those 3 coordinates

---

## [Set a item of a JList with path](https://discourse.processing.org/t/set-a-item-of-a-jlist-with-path/3939)

<div class="topic-metadata">

**Author:** [@vjjv](https://discourse.processing.org/u/vjjv)\
**Replies:** 2\
**Last updated:** [September 29, 2018, 4:55pm UTC](https://discourse.processing.org/t/set-a-item-of-a-jlist-with-path/3939 "2018-09-29T16:55:19Z")

</div>

hello! anybody knows how can i set a JList item (saving previosly in a JSON file) with the PATH and not with INDEX? this is becouse my list are dinamic, and maybe when i save a selection (index 2, e.x), next when i wan…

---

## [Rect corner radius issue. Squircles!?](https://discourse.processing.org/t/rect-corner-radius-issue-squircles/3924)

<div class="topic-metadata">

**Author:** [@EliTheIceMan](https://discourse.processing.org/u/EliTheIceMan)\
**Replies:** 8\
**Last updated:** [September 29, 2018, 4:20am UTC](https://discourse.processing.org/t/rect-corner-radius-issue-squircles/3924 "2018-09-29T04:20:08Z")

</div>

I’m trying to make some buttons based on Tesla’s UI which has round and rounded rectangle buttons and found a weird issue. If you run rect(x, y, n, n, n/2); (in CORNER or CENTER mode) I would think you should get a circ…

---

## [Drawing a flower](https://discourse.processing.org/t/drawing-a-flower/3919)

<div class="topic-metadata">

**Author:** [@James](https://discourse.processing.org/u/James)\
**Replies:** 3\
**Last updated:** [September 29, 2018, 3:55pm UTC](https://discourse.processing.org/t/drawing-a-flower/3919 "2018-09-29T15:55:59Z")

</div>

Hello! I’ve drawn a mathematical rose and I can’t think of a way of animating it so it will slowly draw the line out. It will just print out the whole rose at once. How can I make it so it will draw out the lines like …

---

## [How do I make a line of code one variable?](https://discourse.processing.org/t/how-do-i-make-a-line-of-code-one-variable/3937)

<div class="topic-metadata">

**Author:** [@RienziDeal](https://discourse.processing.org/u/RienziDeal)\
**Replies:** 2\
**Last updated:** [September 28, 2018, 6:16pm UTC](https://discourse.processing.org/t/how-do-i-make-a-line-of-code-one-variable/3937 "2018-09-28T18:16:55Z")

</div>

Hi there, I don’t know if there’s a way to do this but I have a rect() function in my code and I want to know if it’s possible to group the line of code as a variable to make it all move at once. Read more at the bottom…

---

## [How to use for loop to plot the data into the graph?](https://discourse.processing.org/t/how-to-use-for-loop-to-plot-the-data-into-the-graph/3880)

<div class="topic-metadata">

**Author:** [@bread](https://discourse.processing.org/u/bread)\
**Replies:** 5\
**Last updated:** [September 27, 2018, 3:39pm UTC](https://discourse.processing.org/t/how-to-use-for-loop-to-plot-the-data-into-the-graph/3880 "2018-09-27T15:39:59Z")

</div>

This is the scatter plot graph that I need to plot the data in. How to use the for loop code to plot the data in? Also how to make different shapes to represent the shape under the for loop code?

---

## [Custom Patterned Pixelated image with custom palette of colors](https://discourse.processing.org/t/custom-patterned-pixelated-image-with-custom-palette-of-colors/3864)

<div class="topic-metadata">

**Author:** [@Ruchi](https://discourse.processing.org/u/Ruchi)\
**Replies:** 5\
**Last updated:** [September 27, 2018, 3:18pm UTC](https://discourse.processing.org/t/custom-patterned-pixelated-image-with-custom-palette-of-colors/3864 "2018-09-27T15:18:31Z")

</div>

Hello The above image shows concentric circle pixelated pattern and the link shows an image with strip pixelated pattern. My question is can I impose this type of patterns on an image but with my custom palette …

---

## [Math with Colors](https://discourse.processing.org/t/math-with-colors/3847)

<div class="topic-metadata">

**Author:** [@Turbo012](https://discourse.processing.org/u/Turbo012)\
**Replies:** 14\
**Last updated:** [September 27, 2018, 11:07am UTC](https://discourse.processing.org/t/math-with-colors/3847 "2018-09-27T11:07:44Z")

</div>

I was wondering if there’s a way to use addition or subtraction on the hex values for color to go up or go down a value. I tested out a sketch but the colors are limited telling me there’s a loop around with only a spec…

---

## [Rotate / Pendulum swing array of letters](https://discourse.processing.org/t/rotate-pendulum-swing-array-of-letters/3759)

<div class="topic-metadata">

**Author:** [@Keks](https://discourse.processing.org/u/Keks)\
**Replies:** 6\
**Last updated:** [September 26, 2018, 5:24pm UTC](https://discourse.processing.org/t/rotate-pendulum-swing-array-of-letters/3759 "2018-09-26T17:24:24Z")

</div>

Hello I am working with superimposed text and trying to create an animate version of this image. . It is basically two superimposed blocks of letters rotated at their center in opposite directions. I want to get each b…

---

## [\[SOLVED\] Can't put int i in if statement in for loop- Help!](https://discourse.processing.org/t/solved-cant-put-int-i-in-if-statement-in-for-loop-help/3848)

<div class="topic-metadata">

**Author:** [@Dinator14](https://discourse.processing.org/u/Dinator14)\
**Replies:** 2\
**Last updated:** [September 26, 2018, 12:24pm UTC](https://discourse.processing.org/t/solved-cant-put-int-i-in-if-statement-in-for-loop-help/3848 "2018-09-26T12:24:33Z")

</div>

I get the error variable i doesn’t exist and I’m not sure why. Without the if statement I don’t get errors. I’m pretty sure I’ve also seen the use of if statements and whatever int was in the for loop used in the if so I…

---

## [\[SOLVED\] How do you redraw over this pixel array?](https://discourse.processing.org/t/solved-how-do-you-redraw-over-this-pixel-array/3749)

<div class="topic-metadata">

**Author:** [@ProsExplorer](https://discourse.processing.org/u/ProsExplorer)\
**Replies:** 1\
**Last updated:** [September 26, 2018, 6:04am UTC](https://discourse.processing.org/t/solved-how-do-you-redraw-over-this-pixel-array/3749 "2018-09-26T06:04:24Z")

</div>

Hello all, I’m trying to redraw over this 2D pixel array of this program. // main setup settings int dimy = 800; // screen width 1681 int dimx = 850; //screen height 1019 int bailout = 2000; …

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

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