# Coding Questions

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

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

**Page:** 50

---

## [Using texture in PGraphic](https://discourse.processing.org/t/using-texture-in-pgraphic/30967)

<div class="topic-metadata">

**Author:** [@heXYdi](https://discourse.processing.org/u/heXYdi)\
**Replies:** 7\
**Last updated:** [June 30, 2021, 2:04pm UTC](https://discourse.processing.org/t/using-texture-in-pgraphic/30967 "2021-06-30T14:04:43Z")

</div>

Dear people, probably the question is pretty simple and maybe I am just blind. Unfortunately I don’t manage to apply an Image as texture for a PGraphic. In my original code the PGraphic is used in several functions, whi…

---

## [ScreenCapture with Robot Class (code not working)](https://discourse.processing.org/t/screencapture-with-robot-class-code-not-working/30551)

<div class="topic-metadata">

**Author:** [@MoonAlien822](https://discourse.processing.org/u/MoonAlien822)\
**Replies:** 10\
**Last updated:** [June 30, 2021, 10:43am UTC](https://discourse.processing.org/t/screencapture-with-robot-class-code-not-working/30551 "2021-06-30T10:43:35Z")

</div>

i have an irl card that has the rgb value:11, 96, 133. i made a code that, scans the screen for that color so when you have the app camera open it says kaart gevonden (found card in dutch) on the screen. but it is not w…

---

## [How to find a colour on the screen?](https://discourse.processing.org/t/how-to-find-a-colour-on-the-screen/30405)

<div class="topic-metadata">

**Author:** [@MoonAlien822](https://discourse.processing.org/u/MoonAlien822)\
**Replies:** 7\
**Last updated:** [June 30, 2021, 10:06am UTC](https://discourse.processing.org/t/how-to-find-a-colour-on-the-screen/30405 "2021-06-30T10:06:39Z")

</div>

i have a colour value (11, 96, 133) and i want the program to tell me if there is any colour that is really similar or exactly the same. here is the rest of my code if its useful: PImage screenshot; import java.awt.Robo…

---

## [Background images in draw slows operation, in setup leaves trail, also z-index question](https://discourse.processing.org/t/background-images-in-draw-slows-operation-in-setup-leaves-trail-also-z-index-question/30955)

<div class="topic-metadata">

**Author:** [@silphonix](https://discourse.processing.org/u/silphonix)\
**Replies:** 4\
**Last updated:** [June 29, 2021, 8:10am UTC](https://discourse.processing.org/t/background-images-in-draw-slows-operation-in-setup-leaves-trail-also-z-index-question/30955 "2021-06-29T08:10:34Z")

</div>

Hi, I’m trying to make a representation of frogs jumping out of water. This is my code: ArrayList\<Frogs\> frog = new ArrayList(); PImage pataIzq, pataDer,cuerpo; PImage bgBackline, bgBluerose, bgFloaters, bgGrassnotop, …

---

## [Displaying randomised coloured squares](https://discourse.processing.org/t/displaying-randomised-coloured-squares/28824)

<div class="topic-metadata">

**Author:** [@hwahwa](https://discourse.processing.org/u/hwahwa)\
**Replies:** 3\
**Last updated:** [June 15, 2021, 1:15pm UTC](https://discourse.processing.org/t/displaying-randomised-coloured-squares/28824 "2021-06-15T13:15:09Z")

</div>

Hello, I’m trying to display randomised coloured squares but the issue is, when I use my code outside of a void draw() function, it works fine, but when I put it in a void draw() function, the colours of the squares cont…

---

## [pushMatrix() NullPointerException](https://discourse.processing.org/t/pushmatrix-nullpointerexception/30929)

<div class="topic-metadata">

**Author:** [@SNICKRS](https://discourse.processing.org/u/SNICKRS)\
**Replies:** 5\
**Last updated:** [June 27, 2021, 1:49pm UTC](https://discourse.processing.org/t/pushmatrix-nullpointerexception/30929 "2021-06-27T13:49:29Z")

</div>

Hello everyone, I am writing a game using processing in Eclipse, but I get a strange NullPointerException error when using pushMatrix in two of my classes. Even taking out the pushMatrix() and popMatrix() doesn’t work, c…

---

## [I need help with the color change of the dots in the image I created](https://discourse.processing.org/t/i-need-help-with-the-color-change-of-the-dots-in-the-image-i-created/30906)

<div class="topic-metadata">

**Author:** [@process](https://discourse.processing.org/u/process)\
**Replies:** 9\
**Last updated:** [June 27, 2021, 10:32pm UTC](https://discourse.processing.org/t/i-need-help-with-the-color-change-of-the-dots-in-the-image-i-created/30906 "2021-06-27T22:32:15Z")

</div>

I need help with the color change of the dots in the image I created I added a colorwheel, I create a point with mousepress and drop it to the ground. The color I choose from Colorwheel changes the color of the dots on …

---

## [Using Vectors to Make a Bullet shoot to where I click with my mouse](https://discourse.processing.org/t/using-vectors-to-make-a-bullet-shoot-to-where-i-click-with-my-mouse/30915)

<div class="topic-metadata">

**Author:** [@Hunter9649](https://discourse.processing.org/u/Hunter9649)\
**Replies:** 2\
**Last updated:** [June 26, 2021, 7:51am UTC](https://discourse.processing.org/t/using-vectors-to-make-a-bullet-shoot-to-where-i-click-with-my-mouse/30915 "2021-06-26T07:51:17Z")

</div>

So I have been trying to make a game like a shooter similar to diep.io but its like a zombie thing. I could not figure out vectors because I’m too small brain. Anyone wanna help me. Here is the code I have so far. \<clas…

---

## [Voxel game mesh code](https://discourse.processing.org/t/voxel-game-mesh-code/30895)

<div class="topic-metadata">

**Author:** [@SNICKRS](https://discourse.processing.org/u/SNICKRS)\
**Replies:** 4\
**Last updated:** [June 26, 2021, 3:10am UTC](https://discourse.processing.org/t/voxel-game-mesh-code/30895 "2021-06-26T03:10:30Z")

</div>

Hello everyone, I am trying to code my first voxel game. So far, I have the 3d camera and cubes loading to the screen. However, when I try to expand the terrain, there is a lot of lag because Processing has to render a l…

---

## [One sided vertices in 3d graphics](https://discourse.processing.org/t/one-sided-vertices-in-3d-graphics/30922)

<div class="topic-metadata">

**Author:** [@SNICKRS](https://discourse.processing.org/u/SNICKRS)\
**Replies:** 0\
**Last updated:** [June 26, 2021, 3:04am UTC](https://discourse.processing.org/t/one-sided-vertices-in-3d-graphics/30922 "2021-06-26T03:04:02Z")

</div>

Hello everyone, I recently starting coding a voxel game in processing. However, there is a lot of lag whenever rendering the cubes, say 1000 of them, because cube faces are being drawn that the player cannot see (the cub…

---

## [Random vertex on diagonal line](https://discourse.processing.org/t/random-vertex-on-diagonal-line/30857)

<div class="topic-metadata">

**Author:** [@humano](https://discourse.processing.org/u/humano)\
**Replies:** 5\
**Last updated:** [June 25, 2021, 4:14pm UTC](https://discourse.processing.org/t/random-vertex-on-diagonal-line/30857 "2021-06-25T16:14:29Z")

</div>

Hi there! I am trying to do a design using random vertex, as you can see on the picture. I want to take a random point between X1 and X2, that is easy to do, but I don’t know what to do with y, because it has to be on…

---

## [HELP Want to redraw an image using lines but the graphics won't show](https://discourse.processing.org/t/help-want-to-redraw-an-image-using-lines-but-the-graphics-wont-show/30643)

<div class="topic-metadata">

**Author:** [@goblincaptain](https://discourse.processing.org/u/goblincaptain)\
**Replies:** 20\
**Last updated:** [June 11, 2021, 11:35am UTC](https://discourse.processing.org/t/help-want-to-redraw-an-image-using-lines-but-the-graphics-wont-show/30643 "2021-06-11T11:35:07Z")

</div>

My concept is to load an image and scan through all its pixels. For every pixel, find another pixel in the whole image that has the biggest color difference. Once the program detects the best pair(biggest difference), it…

---

## [I want the PVector after rotate](https://discourse.processing.org/t/i-want-the-pvector-after-rotate/30744)

<div class="topic-metadata">

**Author:** [@zang](https://discourse.processing.org/u/zang)\
**Replies:** 6\
**Last updated:** [June 25, 2021, 10:55am UTC](https://discourse.processing.org/t/i-want-the-pvector-after-rotate/30744 "2021-06-25T10:55:24Z")

</div>

PVector v = new PVector(); void setup() { size(800, 800, P3D); } void draw() { background(255); push(); translate(0,0,0); v = new PVector(1, 10, 1); rotateZ(frameCount); pop(); println(v); } i …

---

## [How to do other sides](https://discourse.processing.org/t/how-to-do-other-sides/30878)

<div class="topic-metadata">

**Author:** [@MoonAlien822](https://discourse.processing.org/u/MoonAlien822)\
**Replies:** 0\
**Last updated:** [June 23, 2021, 7:18pm UTC](https://discourse.processing.org/t/how-to-do-other-sides/30878 "2021-06-23T19:18:01Z")

</div>

i cant figure out how to use this code in other directions. this line of code checks if something on its west side is in range and then it presses z. this works but i cant seem to figure out how to do it for its northwe…

---

## [Rectangle button](https://discourse.processing.org/t/rectangle-button/30846)

<div class="topic-metadata">

**Author:** [@PARINAZ129](https://discourse.processing.org/u/PARINAZ129)\
**Replies:** 3\
**Last updated:** [June 23, 2021, 1:38am UTC](https://discourse.processing.org/t/rectangle-button/30846 "2021-06-23T01:38:22Z")

</div>

Dear As a beginner, I wanted to create 4 buttons that show different colors when being pressed, however, when I press each of them they don’t work individually. Additionally, I have a serious problem with writing distan…

---

## [Need help for a grid](https://discourse.processing.org/t/need-help-for-a-grid/30851)

<div class="topic-metadata">

**Author:** [@sympathetic](https://discourse.processing.org/u/sympathetic)\
**Replies:** 1\
**Last updated:** [June 22, 2021, 2:20pm UTC](https://discourse.processing.org/t/need-help-for-a-grid/30851 "2021-06-22T14:20:16Z")

</div>

Hi, my english is not that good i hope you understand. So I have a grid with a for cycle and wanted it to map the brightness of an ellipse, but don’t really know how to code it. int a = 20; void setup () { size(800, 8…

---

## [Continuous Random Line](https://discourse.processing.org/t/continuous-random-line/30377)

<div class="topic-metadata">

**Author:** [@humano](https://discourse.processing.org/u/humano)\
**Replies:** 16\
**Last updated:** [June 21, 2021, 5:21pm UTC](https://discourse.processing.org/t/continuous-random-line/30377 "2021-06-21T17:21:57Z")

</div>

Hi there! I would like to create a drawing with a line with random points , something similar to the picture attached. I have found a Code and I am trying but It does not work. Can you please help me with that and te…

---

## [How do I loop the methods in my game?](https://discourse.processing.org/t/how-do-i-loop-the-methods-in-my-game/30821)

<div class="topic-metadata">

**Author:** [@Metin](https://discourse.processing.org/u/Metin)\
**Replies:** 10\
**Last updated:** [June 21, 2021, 1:50pm UTC](https://discourse.processing.org/t/how-do-i-loop-the-methods-in-my-game/30821 "2021-06-21T13:50:12Z")

</div>

Hello guys! I am in need of your help. I am currently working on a game that is similar to Pac-Man without the walls and stuff. Doing it while being a beginner in coding and Processing. You will also see that I am sti…

---

## [Check x&y when they are the correct color](https://discourse.processing.org/t/check-x-y-when-they-are-the-correct-color/30830)

<div class="topic-metadata">

**Author:** [@MoonAlien822](https://discourse.processing.org/u/MoonAlien822)\
**Replies:** 5\
**Last updated:** [June 21, 2021, 11:00am UTC](https://discourse.processing.org/t/check-x-y-when-they-are-the-correct-color/30830 "2021-06-21T11:00:57Z")

</div>

this code prints the word same if the color on coordinates x,y is the same as one of the team colors. how do i check what x and y are at the moment that they are one of the team colors and place a circle there. int x=1;…

---

## [Get resized window size?](https://discourse.processing.org/t/get-resized-window-size/30808)

<div class="topic-metadata">

**Author:** [@Sayochi](https://discourse.processing.org/u/Sayochi)\
**Replies:** 8\
**Last updated:** [June 20, 2021, 8:22pm UTC](https://discourse.processing.org/t/get-resized-window-size/30808 "2021-06-20T20:22:14Z")

</div>

I’m making a 2d noise map generator in processing js. I’m doing this with pixels\[\] in my sketch and when I resize my window it doesn’t behave in the way i want. what I want is creating wider map if window width is increa…

---

## [Help me please, I can't save my images](https://discourse.processing.org/t/help-me-please-i-cant-save-my-images/30811)

<div class="topic-metadata">

**Author:** [@manu1306](https://discourse.processing.org/u/manu1306)\
**Replies:** 4\
**Last updated:** [June 20, 2021, 4:55pm UTC](https://discourse.processing.org/t/help-me-please-i-cant-save-my-images/30811 "2021-06-20T16:55:11Z")

</div>

Hello I am new to the processing software I found a code on github but I would have liked to add the function of saving the image for each image made by the algorithm can you help me please thank you because I do not can…

---

## [Contour rectangle with an ellipse](https://discourse.processing.org/t/contour-rectangle-with-an-ellipse/30408)

<div class="topic-metadata">

**Author:** [@guidoDimasi](https://discourse.processing.org/u/guidoDimasi)\
**Replies:** 2\
**Last updated:** [June 20, 2021, 1:33pm UTC](https://discourse.processing.org/t/contour-rectangle-with-an-ellipse/30408 "2021-06-20T13:33:05Z")

</div>

Hi, there a simple way to contour a rectangle with an ellipse? i’ve tried vertex, curvedvertex but nothing work well what i’m trying to accomplish is a way to apply some sort of a circle mask to a underlyng object,sha…

---

## [Save and write an odt file](https://discourse.processing.org/t/save-and-write-an-odt-file/30239)

<div class="topic-metadata">

**Author:** [@SimonAbitbol](https://discourse.processing.org/u/SimonAbitbol)\
**Replies:** 8\
**Last updated:** [June 20, 2021, 12:28pm UTC](https://discourse.processing.org/t/save-and-write-an-odt-file/30239 "2021-06-20T12:28:56Z")

</div>

Hi, I would like to write and save a file with open office. Is this feasible ?

---

## [Grid of circles made with images randomly selected](https://discourse.processing.org/t/grid-of-circles-made-with-images-randomly-selected/30802)

<div class="topic-metadata">

**Author:** [@userfc](https://discourse.processing.org/u/userfc)\
**Replies:** 5\
**Last updated:** [June 19, 2021, 10:42pm UTC](https://discourse.processing.org/t/grid-of-circles-made-with-images-randomly-selected/30802 "2021-06-19T22:42:11Z")

</div>

https://editor.p5js.org/rfcanas/sketches/X-c\_v8L9n Hi! I’m starting a little school project and I’m quite a newbie to Processing. I do not know if I can ask in this forum, but our work if or if we should do it in p5.js.…

---

## [Trying to target an area of square to apply noise function](https://discourse.processing.org/t/trying-to-target-an-area-of-square-to-apply-noise-function/30786)

<div class="topic-metadata">

**Author:** [@debxyz](https://discourse.processing.org/u/debxyz)\
**Replies:** 4\
**Last updated:** [June 19, 2021, 4:47pm UTC](https://discourse.processing.org/t/trying-to-target-an-area-of-square-to-apply-noise-function/30786 "2021-06-19T16:47:34Z")

</div>

I am trying to target selected areas of a square. In the code below I have targeted the top edge of the shape. Am I on the right path? It seems like this current iteration should work, but it’s not. Any guidance is mos…

---

## [Keypress in other application](https://discourse.processing.org/t/keypress-in-other-application/30783)

<div class="topic-metadata">

**Author:** [@MoonAlien822](https://discourse.processing.org/u/MoonAlien822)\
**Replies:** 1\
**Last updated:** [June 18, 2021, 10:50pm UTC](https://discourse.processing.org/t/keypress-in-other-application/30783 "2021-06-18T22:50:03Z")

</div>

Is there any way to have a program press a key in another application?

---

## [Mouse event unwantedly interferes with button click](https://discourse.processing.org/t/mouse-event-unwantedly-interferes-with-button-click/30664)

<div class="topic-metadata">

**Author:** [@mmuylle](https://discourse.processing.org/u/mmuylle)\
**Replies:** 2\
**Last updated:** [June 18, 2021, 1:09pm UTC](https://discourse.processing.org/t/mouse-event-unwantedly-interferes-with-button-click/30664 "2021-06-18T13:09:13Z")

</div>

Part of a sketch uses a button and a mouse event where the mouse event should only occur within the border of a rectangle. Unfortunately, my code forces the user to click the button twice before taking any action. This i…

---

## [How to stop moving the slider until the key is released](https://discourse.processing.org/t/how-to-stop-moving-the-slider-until-the-key-is-released/30775)

<div class="topic-metadata">

**Author:** [@noobcoderxx](https://discourse.processing.org/u/noobcoderxx)\
**Replies:** 5\
**Last updated:** [June 18, 2021, 8:02am UTC](https://discourse.processing.org/t/how-to-stop-moving-the-slider-until-the-key-is-released/30775 "2021-06-18T08:02:42Z")

</div>

class slider { int y = 0; void draw() { keyPressed(); keyReleased(); //not going out of frame if(y \< 0) y += 25; if(y \> height-25) y -= 25; rect(width-30, y, 10, rectSize); } void k…

---

## [Distance between two objects](https://discourse.processing.org/t/distance-between-two-objects/30751)

<div class="topic-metadata">

**Author:** [@MacJ](https://discourse.processing.org/u/MacJ)\
**Replies:** 3\
**Last updated:** [June 17, 2021, 5:25pm UTC](https://discourse.processing.org/t/distance-between-two-objects/30751 "2021-06-17T17:25:40Z")

</div>

Hello i want to calculate the distance between the centre of Pac-Man and the centre of the treat and If this distance is less than the radius of Pac-Man, we will consider Pac-Man to have “eaten” the treat. When Pac-Man …

---

## [Make two sketches comunicate](https://discourse.processing.org/t/make-two-sketches-comunicate/30755)

<div class="topic-metadata">

**Author:** [@fatou](https://discourse.processing.org/u/fatou)\
**Replies:** 2\
**Last updated:** [June 17, 2021, 4:53pm UTC](https://discourse.processing.org/t/make-two-sketches-comunicate/30755 "2021-06-17T16:53:33Z")

</div>

please format code with \</\> button \* homework policy \* asking questions Hello everyone! I´m working on a project that consists of two sketches that communicate. In the first one, you can draw with the mouse, and whe…

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

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