# Coding Questions

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

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

**Page:** 38

---

## [Minesweeper game with three objects](https://discourse.processing.org/t/minesweeper-game-with-three-objects/34019)

<div class="topic-metadata">

**Author:** [@gvmrk](https://discourse.processing.org/u/gvmrk)\
**Replies:** 1\
**Last updated:** [December 9, 2021, 11:06pm UTC](https://discourse.processing.org/t/minesweeper-game-with-three-objects/34019 "2021-12-09T23:06:01Z")

</div>

Hello, Im trying to make a kind of minesweeper game, but with 3 objects the player can find on the gameboard. I now have the code working to load 1 object into the game board. But i need all three objects placed on the …

---

## [Thoughts on Best Way to Render Game Pieces: sprites vs SVGs vs…](https://discourse.processing.org/t/thoughts-on-best-way-to-render-game-pieces-sprites-vs-svgs-vs/34018)

<div class="topic-metadata">

**Author:** [@Anders](https://discourse.processing.org/u/Anders)\
**Replies:** 0\
**Last updated:** [December 9, 2021, 6:47pm UTC](https://discourse.processing.org/t/thoughts-on-best-way-to-render-game-pieces-sprites-vs-svgs-vs/34018 "2021-12-09T18:47:04Z")

</div>

Hi! As part of the Data Chefs initiative, I’m working on a project to explore creating a series of team dashboards that are more like gameboards. For pieces on the gameboards-as-dashboards, any thoughts about how to…

---

## [Drawing array of curves from PVector](https://discourse.processing.org/t/drawing-array-of-curves-from-pvector/33775)

<div class="topic-metadata">

**Author:** [@mrbro](https://discourse.processing.org/u/mrbro)\
**Replies:** 12\
**Last updated:** [December 9, 2021, 12:41am UTC](https://discourse.processing.org/t/drawing-array-of-curves-from-pvector/33775 "2021-12-09T00:41:34Z")

</div>

Hi friends! I am trying to draw an array of curves from PVector coordinates. Basically it is similar to Particle system tutorial, just instead of points, I need to get curves. I try to use begin shape (in class Particl…

---

## [Connecting Cells](https://discourse.processing.org/t/connecting-cells/33835)

<div class="topic-metadata">

**Author:** [@eltrem](https://discourse.processing.org/u/eltrem)\
**Replies:** 14\
**Last updated:** [December 8, 2021, 9:50pm UTC](https://discourse.processing.org/t/connecting-cells/33835 "2021-12-08T21:50:47Z")

</div>

\*deleted post (it was a terrible code…)

---

## [Old processing zombie game by Kevan Davis. Can you help me get it working?](https://discourse.processing.org/t/old-processing-zombie-game-by-kevan-davis-can-you-help-me-get-it-working/7178)

<div class="topic-metadata">

**Author:** [@aaronszcz](https://discourse.processing.org/u/aaronszcz)\
**Replies:** 19\
**Last updated:** [December 7, 2021, 10:31pm UTC](https://discourse.processing.org/t/old-processing-zombie-game-by-kevan-davis-can-you-help-me-get-it-working/7178 "2021-12-07T22:31:17Z")

</div>

Hello Forum, One day I remembered an old zombie game I played I high school computer class. I found the source code for it. Turns out it was written for Processing 1.0. Ive coded with java and python before, but not in…

---

## [Connecting a line that passes though 2 points](https://discourse.processing.org/t/connecting-a-line-that-passes-though-2-points/33856)

<div class="topic-metadata">

**Author:** [@chaotic.rabbit](https://discourse.processing.org/u/chaotic.rabbit)\
**Replies:** 11\
**Last updated:** [December 7, 2021, 9:01am UTC](https://discourse.processing.org/t/connecting-a-line-that-passes-though-2-points/33856 "2021-12-07T09:01:41Z")

</div>

Hi I found this code posted on here and it worked for me to draw a line that passes from 2 points that I wanted. However I want the line to start and stop at certain points not continue all the way to the top and bottom.…

---

## [Coding Help-Collision](https://discourse.processing.org/t/coding-help-collision/33969)

<div class="topic-metadata">

**Author:** [@Mr.B](https://discourse.processing.org/u/Mr.B)\
**Replies:** 0\
**Last updated:** [December 6, 2021, 6:19pm UTC](https://discourse.processing.org/t/coding-help-collision/33969 "2021-12-06T18:19:26Z")

</div>

(p5.js Web Editor) How can I fix lines 44-46 to have a “better” collision between the projectile and the alien?

---

## [Running code on exit](https://discourse.processing.org/t/running-code-on-exit/33961)

<div class="topic-metadata">

**Author:** [@Cereal](https://discourse.processing.org/u/Cereal)\
**Replies:** 0\
**Last updated:** [December 6, 2021, 12:59pm UTC](https://discourse.processing.org/t/running-code-on-exit/33961 "2021-12-06T12:59:58Z")

</div>

Just wanted to verify this is a safe way of running code when the program exits: function setup() {} function draw() {} function dispose() { super.dispose() // Anything else I want cleaned up } Didn’t see any offi…

---

## [Choose random multiple entries from a StringList](https://discourse.processing.org/t/choose-random-multiple-entries-from-a-stringlist/33958)

<div class="topic-metadata">

**Author:** [@melo](https://discourse.processing.org/u/melo)\
**Replies:** 0\
**Last updated:** [December 6, 2021, 12:44pm UTC](https://discourse.processing.org/t/choose-random-multiple-entries-from-a-stringlist/33958 "2021-12-06T12:44:05Z")

</div>

Hello, Yesterday I was trying to pick three random entries from a StringList when you pressed a button. Ideally, the entry shouldn’t be repeated. I decided to shuffle() it once at the beggining, with three int which wou…

---

## [Different frameCount in the same code](https://discourse.processing.org/t/different-framecount-in-the-same-code/33937)

<div class="topic-metadata">

**Author:** [@Cosmin](https://discourse.processing.org/u/Cosmin)\
**Replies:** 2\
**Last updated:** [December 6, 2021, 4:03am UTC](https://discourse.processing.org/t/different-framecount-in-the-same-code/33937 "2021-12-06T04:03:30Z")

</div>

Hello, guys! I’m Cosmin and is a pleasure to be here. I have a question: it’s possible to have different frameCounts in the same definition? More exactly, I have two videos with different value of this function. In the f…

---

## [Startup code runs more than once](https://discourse.processing.org/t/startup-code-runs-more-than-once/33922)

<div class="topic-metadata">

**Author:** [@hacketet](https://discourse.processing.org/u/hacketet)\
**Replies:** 4\
**Last updated:** [December 5, 2021, 9:41pm UTC](https://discourse.processing.org/t/startup-code-runs-more-than-once/33922 "2021-12-05T21:41:54Z")

</div>

I am developing a control system with numerouos buttons displayed on the monitor. Everything is working fine, however, I discovered that the startup code runs whenever I trigger a control. There is an empty draw sub - …

---

## [Calculate maximum length of a vector](https://discourse.processing.org/t/calculate-maximum-length-of-a-vector/33818)

<div class="topic-metadata">

**Author:** [@travis.stdenis](https://discourse.processing.org/u/travis.stdenis)\
**Replies:** 11\
**Last updated:** [December 5, 2021, 3:29pm UTC](https://discourse.processing.org/t/calculate-maximum-length-of-a-vector/33818 "2021-12-05T15:29:08Z")

</div>

I’m trying to achieve the following calculation but i really don’t know what functions and equations to use in this situation. As you can see in the diagram, I have vector A and vector B and I know angle K and angle …

---

## [Trying to make a shape grow on its own](https://discourse.processing.org/t/trying-to-make-a-shape-grow-on-its-own/33939)

<div class="topic-metadata">

**Author:** [@Callum](https://discourse.processing.org/u/Callum)\
**Replies:** 2\
**Last updated:** [December 5, 2021, 3:08pm UTC](https://discourse.processing.org/t/trying-to-make-a-shape-grow-on-its-own/33939 "2021-12-05T15:08:52Z")

</div>

Hi, I’m very very new to Processing (just learned loops earlier today) and am trying to figure something out. I’m trying to make it so that when you click the screen, a circle of random size and colour shows up, and then…

---

## [Scrambling an Image](https://discourse.processing.org/t/scrambling-an-image/33879)

<div class="topic-metadata">

**Author:** [@bcabc](https://discourse.processing.org/u/bcabc)\
**Replies:** 4\
**Last updated:** [December 2, 2021, 9:28pm UTC](https://discourse.processing.org/t/scrambling-an-image/33879 "2021-12-02T21:28:25Z")

</div>

Hi- I’d like to rearrange a JPG’s pixels so that they were in random order - preferably in 4x4 blocks. I’m having a little trouble figuring this out. I was hoping something like the following would work - but it doesn’…

---

## [How do I get the line to stop at the edge?](https://discourse.processing.org/t/how-do-i-get-the-line-to-stop-at-the-edge/33894)

<div class="topic-metadata">

**Author:** [@chaotic.rabbit](https://discourse.processing.org/u/chaotic.rabbit)\
**Replies:** 1\
**Last updated:** [December 4, 2021, 12:24am UTC](https://discourse.processing.org/t/how-do-i-get-the-line-to-stop-at-the-edge/33894 "2021-12-04T00:24:22Z")

</div>

Hi, I’ve been trying to draw a blue line like the one shown in the image that passes through 2 given points (red points) and ends as soon as it touches the black line (which i know the x position of but I dont know the y…

---

## [2d camera in Processing follow up](https://discourse.processing.org/t/2d-camera-in-processing-follow-up/33890)

<div class="topic-metadata">

**Author:** [@SNICKRS](https://discourse.processing.org/u/SNICKRS)\
**Replies:** 4\
**Last updated:** [December 3, 2021, 9:47pm UTC](https://discourse.processing.org/t/2d-camera-in-processing-follow-up/33890 "2021-12-03T21:47:00Z")

</div>

Similarly to my last post, I am trying to make a 2d camera in processing. So far, I have the camera “look” where the character points towards the mouse, but I can’t find anything to help me with camera movement in 2d. Ar…

---

## [Export PDF on child PApplet](https://discourse.processing.org/t/export-pdf-on-child-papplet/33903)

<div class="topic-metadata">

**Author:** [@MonoRail](https://discourse.processing.org/u/MonoRail)\
**Replies:** 0\
**Last updated:** [December 3, 2021, 8:11pm UTC](https://discourse.processing.org/t/export-pdf-on-child-papplet/33903 "2021-12-03T20:11:32Z")

</div>

I’m writing a program with a GUI (ControlP5) in which the parent PApplet contains the textfields with parameters and a button to export to PDF. I want the child PApplet to contain all of the drawn information and export …

---

## [How to introduce gradient into ellipse](https://discourse.processing.org/t/how-to-introduce-gradient-into-ellipse/33863)

<div class="topic-metadata">

**Author:** [@srb777](https://discourse.processing.org/u/srb777)\
**Replies:** 1\
**Last updated:** [December 1, 2021, 9:41pm UTC](https://discourse.processing.org/t/how-to-introduce-gradient-into-ellipse/33863 "2021-12-01T21:41:39Z")

</div>

Hi, I am learning to program with processing and I need help.I need to paint the balls with gradient, It has to look like this: My code: int columns = 20; // Número de columnes int rows = 10; // Número de files floa…

---

## [Is Processing a pure Java platform IDE?](https://discourse.processing.org/t/is-processing-a-pure-java-platform-ide/33821)

<div class="topic-metadata">

**Author:** [@R1S8K](https://discourse.processing.org/u/R1S8K)\
**Replies:** 2\
**Last updated:** [December 2, 2021, 7:13am UTC](https://discourse.processing.org/t/is-processing-a-pure-java-platform-ide/33821 "2021-12-02T07:13:19Z")

</div>

Hi, I downloaded eclipse to test some java snippets and examples. My question now, is the coding system in Processing is exactly the same as in other IDE like eclipse ?

---

## [Two objects in one](https://discourse.processing.org/t/two-objects-in-one/33871)

<div class="topic-metadata">

**Author:** [@tati1202](https://discourse.processing.org/u/tati1202)\
**Replies:** 0\
**Last updated:** [December 1, 2021, 10:32pm UTC](https://discourse.processing.org/t/two-objects-in-one/33871 "2021-12-01T22:32:12Z")

</div>

Hi, I want to unite the class Juego with the Class Pantallas to replace the golBayernD screen. How can I do this? Here’s the code: GitHub - BautiFelli/tecnomultimedia at tp6

---

## [Robot down key not working](https://discourse.processing.org/t/robot-down-key-not-working/33838)

<div class="topic-metadata">

**Author:** [@MoonAlien822](https://discourse.processing.org/u/MoonAlien822)\
**Replies:** 2\
**Last updated:** [November 30, 2021, 7:29pm UTC](https://discourse.processing.org/t/robot-down-key-not-working/33838 "2021-11-30T19:29:21Z")

</div>

why does this robot not pres the down key? import java.awt.AWTException; import java.awt.Robot; import java.awt.event.KeyEvent; Robot robot; void setup() { size(400, 400); //Let's get a Robot... try { robo…

---

## [Trying to draw a shape based on two circles](https://discourse.processing.org/t/trying-to-draw-a-shape-based-on-two-circles/33841)

<div class="topic-metadata">

**Author:** [@LucaP](https://discourse.processing.org/u/LucaP)\
**Replies:** 6\
**Last updated:** [December 1, 2021, 1:13pm UTC](https://discourse.processing.org/t/trying-to-draw-a-shape-based-on-two-circles/33841 "2021-12-01T13:13:55Z")

</div>

Hi, I am trying to draw a shape like this: It is important that the top and bottom of the shape match the radius of a perfect circle. I have tried doing this with shapes and beziérs but I can’t get my head around to…

---

## [Help with dragging images!](https://discourse.processing.org/t/help-with-dragging-images/33661)

<div class="topic-metadata">

**Author:** [@quixotic](https://discourse.processing.org/u/quixotic)\
**Replies:** 3\
**Last updated:** [November 30, 2021, 9:13pm UTC](https://discourse.processing.org/t/help-with-dragging-images/33661 "2021-11-30T21:13:39Z")

</div>

Hello all! I am very very new to coding and am attempting to create a code in which I can click on an image, have it change into a different image, then be able to click and drag the new image. I want this to be able to …

---

## [Difficulty of running code when compacting sketch into a ZIP-file](https://discourse.processing.org/t/difficulty-of-running-code-when-compacting-sketch-into-a-zip-file/33113)

<div class="topic-metadata">

**Author:** [@William](https://discourse.processing.org/u/William)\
**Replies:** 3\
**Last updated:** [November 30, 2021, 7:49pm UTC](https://discourse.processing.org/t/difficulty-of-running-code-when-compacting-sketch-into-a-zip-file/33113 "2021-11-30T19:49:48Z")

</div>

So, I have completed an animation with a custom background picture i.e. a picture of a google search. It runs normal & fine on my laptop but when I compremise it into a ZIP-file to send it to my supervisor, I get constan…

---

## [Screens are not updating](https://discourse.processing.org/t/screens-are-not-updating/33829)

<div class="topic-metadata">

**Author:** [@tati1202](https://discourse.processing.org/u/tati1202)\
**Replies:** 1\
**Last updated:** [November 30, 2021, 1:56am UTC](https://discourse.processing.org/t/screens-are-not-updating/33829 "2021-11-30T01:56:21Z")

</div>

Hello! I have a problem in which the screens are not updated, I tried several ways but cannot find the error. Can anyone know what it may be? please format code with \</\> button \* homework policy \* asking questions

---

## [Why is a frameRate fucntion in setup slower than draw?](https://discourse.processing.org/t/why-is-a-framerate-fucntion-in-setup-slower-than-draw/33827)

<div class="topic-metadata">

**Author:** [@5star\_weapon](https://discourse.processing.org/u/5star_weapon)\
**Replies:** 0\
**Last updated:** [November 30, 2021, 1:03am UTC](https://discourse.processing.org/t/why-is-a-framerate-fucntion-in-setup-slower-than-draw/33827 "2021-11-30T01:03:38Z")

</div>

I wrote a code that moves sphere in 3d. int s=100,m=5;//s is the size of the sphere, m is the position change. void setup() { size(500,500,P3D); noFill();//draw circle with only a stroke } void draw() { backgroun…

---

## [Screen with objects](https://discourse.processing.org/t/screen-with-objects/33683)

<div class="topic-metadata">

**Author:** [@tati1202](https://discourse.processing.org/u/tati1202)\
**Replies:** 2\
**Last updated:** [November 29, 2021, 1:45pm UTC](https://discourse.processing.org/t/screen-with-objects/33683 "2021-11-29T13:45:30Z")

</div>

Hi, why does the screen not change when I press the button? please format code with \</\> button \* homework policy \* asking questions Class Pantalla { int cant=57; Botoncito bot=new Botoncito\[cant\]; Textos texto; P…

---

## [Add string to file name](https://discourse.processing.org/t/add-string-to-file-name/33774)

<div class="topic-metadata">

**Author:** [@yalaniv](https://discourse.processing.org/u/yalaniv)\
**Replies:** 6\
**Last updated:** [November 29, 2021, 1:24pm UTC](https://discourse.processing.org/t/add-string-to-file-name/33774 "2021-11-29T13:24:46Z")

</div>

I have a loop which create graphics and save them into jpg files, and save them as saveFrame(“C:\\process\\test\\colors-###.jpg”); I create the graphics from randomize list of colors, and if the color red was chosen, I …

---

## [MouseX with cursor](https://discourse.processing.org/t/mousex-with-cursor/33630)

<div class="topic-metadata">

**Author:** [@Caseyo](https://discourse.processing.org/u/Caseyo)\
**Replies:** 9\
**Last updated:** [November 29, 2021, 6:29am UTC](https://discourse.processing.org/t/mousex-with-cursor/33630 "2021-11-29T06:29:03Z")

</div>

\<void setup(){ size(600,800); background(0,0,80); } void draw() { float x = mouseX; background(0,0,80); fill(150,100,0); rect(width/2,height/2,150,150); if(x\<300){ fill(0,0,80); rect(x,400,150,150); } else if…

---

## [Filling a PShape](https://discourse.processing.org/t/filling-a-pshape/33644)

<div class="topic-metadata">

**Author:** [@bcabc](https://discourse.processing.org/u/bcabc)\
**Replies:** 5\
**Last updated:** [November 29, 2021, 12:19am UTC](https://discourse.processing.org/t/filling-a-pshape/33644 "2021-11-29T00:19:38Z")

</div>

I’d like to be able to generate an arbitrary shape and fill it with a simple pattern. Drawing the shape is easy - something like this would do: void setup(){ size(650, 650, P3D); smooth(8); translate(200, 200); …

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

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