# Coding Questions

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

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

**Page:** 185

---

## [Coding Landmarks displaying info](https://discourse.processing.org/t/coding-landmarks-displaying-info/1256)

<div class="topic-metadata">

**Author:** [@Radccoon](https://discourse.processing.org/u/Radccoon)\
**Replies:** 3\
**Last updated:** [June 26, 2018, 3:38am UTC](https://discourse.processing.org/t/coding-landmarks-displaying-info/1256 "2018-06-26T03:38:23Z")

</div>

I’m trying to code some landmarks, (as shown in the image) but when you put the cursor on top of the landmark displays some info. So far I manage to create this. But I just can’t figure out how to do what I want. Can …

---

## [Texture transparency problem with P3D for Doom clone](https://discourse.processing.org/t/texture-transparency-problem-with-p3d-for-doom-clone/641)

<div class="topic-metadata">

**Author:** [@luxregina](https://discourse.processing.org/u/luxregina)\
**Replies:** 5\
**Last updated:** [June 26, 2018, 1:53am UTC](https://discourse.processing.org/t/texture-transparency-problem-with-p3d-for-doom-clone/641 "2018-06-26T01:53:08Z")

</div>

Hello everyone! I’m currently coding a “Doom” clone, using P3D. I’m not using any external library. I’m having a weird artifact that happens when I’m using a masked texture. I’ve tried several methods to fix it, but to…

---

## [Radio waves animation](https://discourse.processing.org/t/radio-waves-animation/1135)

<div class="topic-metadata">

**Author:** [@deanomite](https://discourse.processing.org/u/deanomite)\
**Replies:** 11\
**Last updated:** [June 26, 2018, 1:45am UTC](https://discourse.processing.org/t/radio-waves-animation/1135 "2018-06-26T01:45:56Z")

</div>

Hi guys, I’m trying to code this radio waves animation. I want each circle to fade off towards the end of its cycle so that the opacity change is staggered. Right now, all the circles fade off together which is not the …

---

## [Run function on 'Close'](https://discourse.processing.org/t/run-function-on-close/1228)

<div class="topic-metadata">

**Author:** [@madscientist](https://discourse.processing.org/u/madscientist)\
**Replies:** 1\
**Last updated:** [June 25, 2018, 1:39am UTC](https://discourse.processing.org/t/run-function-on-close/1228 "2018-06-25T01:39:55Z")

</div>

OK, so I’m trying to create an app where the user is prompted to save when the red ‘X’ a.k.a. the ‘Close’ button is clicked, but I can’t figure out how to run a function when that is clicked. I DO know how to prevent the…

---

## [Need help understanding the shuffle cards method](https://discourse.processing.org/t/need-help-understanding-the-shuffle-cards-method/1247)

<div class="topic-metadata">

**Author:** [@ProcessingPro](https://discourse.processing.org/u/ProcessingPro)\
**Replies:** 3\
**Last updated:** [June 25, 2018, 6:13pm UTC](https://discourse.processing.org/t/need-help-understanding-the-shuffle-cards-method/1247 "2018-06-25T18:13:16Z")

</div>

I don’t understand the //shuffle cards thing. //assigning values to each card in the grid int\[\] values = new int\[20\]; for (int i=0; i\<icons.length; i++) { icons\[i\] = loadImage(filename\[i\]); values\[2\*i\] = i; …

---

## [Well scoped variables each draw vs global variables](https://discourse.processing.org/t/well-scoped-variables-each-draw-vs-global-variables/1242)

<div class="topic-metadata">

**Author:** [@cuI6QV0SphbBeN9E](https://discourse.processing.org/u/cuI6QV0SphbBeN9E)\
**Replies:** 11\
**Last updated:** [June 25, 2018, 3:23pm UTC](https://discourse.processing.org/t/well-scoped-variables-each-draw-vs-global-variables/1242 "2018-06-25T15:23:27Z")

</div>

I understand the difference between global variables and locally-scoped variables each draw. If I’m going to use a variable only inside draw (or keyPressed, or any function), good programming practice dictates that it i…

---

## [Use a class declared as .pde in a .java file](https://discourse.processing.org/t/use-a-class-declared-as-pde-in-a-java-file/1237)

<div class="topic-metadata">

**Author:** [@Manuel](https://discourse.processing.org/u/Manuel)\
**Replies:** 3\
**Last updated:** [June 25, 2018, 11:46am UTC](https://discourse.processing.org/t/use-a-class-declared-as-pde-in-a-java-file/1237 "2018-06-25T11:46:20Z")

</div>

Hi, I’m using a .java file to contain an enum with extended variables an behaviours, but I want it to contain an object of one of the classes contained in a .pde file, however the compiler says that that class does not e…

---

## [PGraphics and PApplets](https://discourse.processing.org/t/pgraphics-and-papplets/1227)

<div class="topic-metadata">

**Author:** [@vjjv](https://discourse.processing.org/u/vjjv)\
**Replies:** 6\
**Last updated:** [June 25, 2018, 10:16am UTC](https://discourse.processing.org/t/pgraphics-and-papplets/1227 "2018-06-25T10:16:25Z")

</div>

Hello. Im trying to do a preview output of main buffer Graphic in a extra pApplet. Here my code: layerWindow p; LayerManager layer; void settings(){ size(1280, 720, P3D); } void setup(){ p = new layerWindow(); l…

---

## [Point "over" object (inside to push ans pop matrix)](https://discourse.processing.org/t/point-over-object-inside-to-push-ans-pop-matrix/1224)

<div class="topic-metadata">

**Author:** [@ferrari](https://discourse.processing.org/u/ferrari)\
**Replies:** 3\
**Last updated:** [June 25, 2018, 3:26am UTC](https://discourse.processing.org/t/point-over-object-inside-to-push-ans-pop-matrix/1224 "2018-06-25T03:26:12Z")

</div>

Hello, I need to detect when a point is over an object (mouse, for example), but this object was previously moved, rotated and scaled inside to pushMatrix() and popMatrix() Any idea or suggestion is welcome and appreci…

---

## [How to make array values MOVE UP](https://discourse.processing.org/t/how-to-make-array-values-move-up/1184)

<div class="topic-metadata">

**Author:** [@WindJammer](https://discourse.processing.org/u/WindJammer)\
**Replies:** 8\
**Last updated:** [June 24, 2018, 10:19am UTC](https://discourse.processing.org/t/how-to-make-array-values-move-up/1184 "2018-06-24T10:19:38Z")

</div>

How do i make values in an array move up, everytime the array receives a new value? I want to have the newest incoming variable always to be in the 1st array slot. The rest should move up to the next slot. Example: \[…

---

## [Help with for()](https://discourse.processing.org/t/help-with-for/1194)

<div class="topic-metadata">

**Author:** [@jferreira](https://discourse.processing.org/u/jferreira)\
**Replies:** 2\
**Last updated:** [June 24, 2018, 4:57am UTC](https://discourse.processing.org/t/help-with-for/1194 "2018-06-24T04:57:14Z")

</div>

Hello! I am working in a minigame based in StarCastle(Vectrex), and i am trying to draw the shields: void drawLines(){ for(ArrayList\<PVector\> line : this.shield){ switch(this.shield.indexOf(line)){ c…

---

## [Color Shuffle with hex color codes](https://discourse.processing.org/t/color-shuffle-with-hex-color-codes/1191)

<div class="topic-metadata">

**Author:** [@deanomite](https://discourse.processing.org/u/deanomite)\
**Replies:** 11\
**Last updated:** [June 24, 2018, 12:26am UTC](https://discourse.processing.org/t/color-shuffle-with-hex-color-codes/1191 "2018-06-24T00:26:43Z")

</div>

Hi there, Am trying to get colors in an array to shuffle, but having some trouble understanding how to adapt this code: I want to create an array with the following hex color codes and have them shuffle whenever there’…

---

## [Help with loops](https://discourse.processing.org/t/help-with-loops/1190)

<div class="topic-metadata">

**Author:** [@NNY](https://discourse.processing.org/u/NNY)\
**Replies:** 7\
**Last updated:** [June 23, 2018, 11:59pm UTC](https://discourse.processing.org/t/help-with-loops/1190 "2018-06-23T23:59:21Z")

</div>

Working on a homework assignment and I’m absolutely horrible with programming. I need to run a program that asks a riddle and lists some words. the Answer to the riddle is the first letter of each word. Once the user inp…

---

## [Passing mat4 array to shader uniform](https://discourse.processing.org/t/passing-mat4-array-to-shader-uniform/1177)

<div class="topic-metadata">

**Author:** [@kosowski](https://discourse.processing.org/u/kosowski)\
**Replies:** 1\
**Last updated:** [June 23, 2018, 4:46pm UTC](https://discourse.processing.org/t/passing-mat4-array-to-shader-uniform/1177 "2018-06-23T16:46:51Z")

</div>

Hi all! I want to pass an array of mat4 transformation matrices to a uniform in a PShader object, defined like this: uniform mat4 jointTransforms\[MAX\_JOINTS\]; I cannot see this option neither in the reference nor in …

---

## [Compositing of two blurred shapes drawn into PGraphics](https://discourse.processing.org/t/compositing-of-two-blurred-shapes-drawn-into-pgraphics/1174)

<div class="topic-metadata">

**Author:** [@stoph](https://discourse.processing.org/u/stoph)\
**Replies:** 8\
**Last updated:** [June 23, 2018, 1:27pm UTC](https://discourse.processing.org/t/compositing-of-two-blurred-shapes-drawn-into-pgraphics/1174 "2018-06-23T13:27:57Z")

</div>

Hello, everyone! What I want to achieve is having two differently colored blurred shapes in one PGraphics. The problem is that when copying the latter shape/image into the first one the semi-transparent pixels (blurred …

---

## [Line & Intersection](https://discourse.processing.org/t/line-intersection/1118)

<div class="topic-metadata">

**Author:** [@rioma7](https://discourse.processing.org/u/rioma7)\
**Replies:** 2\
**Last updated:** [June 23, 2018, 2:35am UTC](https://discourse.processing.org/t/line-intersection/1118 "2018-06-23T02:35:32Z")

</div>

Hello people, I would like to draw lines from side to side of the canvas \[random points\] but I don’t want that it draws if the drawn line intersect a circle, which is in the middle. My code is this void setup(){ back…

---

## [Help needed (Processing)](https://discourse.processing.org/t/help-needed-processing/1134)

<div class="topic-metadata">

**Author:** [@adlertag](https://discourse.processing.org/u/adlertag)\
**Replies:** 1\
**Last updated:** [June 21, 2018, 12:00am UTC](https://discourse.processing.org/t/help-needed-processing/1134 "2018-06-21T00:00:35Z")

</div>

What is wrong with this Sketck? ////////////////////////////////////////////////////// Ptica\[\] p = new Ptica\[1200\]; int N = 100; void setup() { size(1280, 900); for(int i=0; i \< N; i++) { p\[i\] = new Ptica(random(w…

---

## [The center of a rect() stroke](https://discourse.processing.org/t/the-center-of-a-rect-stroke/907)

<div class="topic-metadata">

**Author:** [@noel](https://discourse.processing.org/u/noel)\
**Replies:** 13\
**Last updated:** [June 22, 2018, 8:58am UTC](https://discourse.processing.org/t/the-center-of-a-rect-stroke/907 "2018-06-22T08:58:26Z")

</div>

Hi. Amplifying the image drawn with the code below, you will see a rectangle drawn with two ‘one-pixel-lines’ more, on the left and upper side of the rectangle, shown with the white lines, but just one-pixel-line on th…

---

## [Hiding ControlP5 controller](https://discourse.processing.org/t/hiding-controlp5-controller/1034)

<div class="topic-metadata">

**Author:** [@deanomite](https://discourse.processing.org/u/deanomite)\
**Replies:** 4\
**Last updated:** [June 21, 2018, 9:20pm UTC](https://discourse.processing.org/t/hiding-controlp5-controller/1034 "2018-06-21T21:20:51Z")

</div>

Is it possible to hide a controlP5 say with a key press or boolean within a key press? Am asking this because a controlP5 controller eg: slider, gets ‘created’ in setup() at the beginning and so there is no access to it…

---

## [How can I retrieve polygons with respective vertices from a PShape?](https://discourse.processing.org/t/how-can-i-retrieve-polygons-with-respective-vertices-from-a-pshape/986)

<div class="topic-metadata">

**Author:** [@cumulus](https://discourse.processing.org/u/cumulus)\
**Replies:** 2\
**Last updated:** [June 21, 2018, 6:54pm UTC](https://discourse.processing.org/t/how-can-i-retrieve-polygons-with-respective-vertices-from-a-pshape/986 "2018-06-21T18:54:09Z")

</div>

I would like to be able to retrieve all individual polygons from a PShape object (preferably an imported .obj) in order to know which vertices are linked to each other. for example if I was to import a simple tetrahedro…

---

## [Vertical and horizontal center glyphs](https://discourse.processing.org/t/vertical-and-horizontal-center-glyphs/860)

<div class="topic-metadata">

**Author:** [@Leo\_Aguiar](https://discourse.processing.org/u/Leo_Aguiar)\
**Replies:** 3\
**Last updated:** [June 20, 2018, 2:36am UTC](https://discourse.processing.org/t/vertical-and-horizontal-center-glyphs/860 "2018-06-20T02:36:00Z")

</div>

Hi guys, I’m a noob and I’ve made a sketch where by clicking you can shuffle through an alphabet’s glyphs and they get vertically and horizontally centered according to their size and the size of the sketch. I was stuck…

---

## [How do i get the output of a command?](https://discourse.processing.org/t/how-do-i-get-the-output-of-a-command/769)

<div class="topic-metadata">

**Author:** [@crazylogic](https://discourse.processing.org/u/crazylogic)\
**Replies:** 9\
**Last updated:** [June 19, 2018, 11:45pm UTC](https://discourse.processing.org/t/how-do-i-get-the-output-of-a-command/769 "2018-06-19T23:45:49Z")

</div>

so i want to get the output of the following command Process p = exec("/usr/sbin/system\_profiler", "SPHardwareDataType | grep Serial"); try { int result = p.waitFor(); println("the process retur…

---

## [Help to start color sequence in the game "Simon says" in Processing](https://discourse.processing.org/t/help-to-start-color-sequence-in-the-game-simon-says-in-processing/882)

<div class="topic-metadata">

**Author:** [@Scorpion](https://discourse.processing.org/u/Scorpion)\
**Replies:** 1\
**Last updated:** [June 19, 2018, 12:15am UTC](https://discourse.processing.org/t/help-to-start-color-sequence-in-the-game-simon-says-in-processing/882 "2018-06-19T00:15:47Z")

</div>

I’m starting to make the game “Simon says” and I do not know how to start generating the “guessList”, that the random colors come out so that the user can then repeat the sequence, how do I continue? for the moment I hav…

---

## [Uncomplete circle](https://discourse.processing.org/t/uncomplete-circle/1060)

<div class="topic-metadata">

**Author:** [@josephh](https://discourse.processing.org/u/josephh)\
**Replies:** 2\
**Last updated:** [June 18, 2018, 9:43pm UTC](https://discourse.processing.org/t/uncomplete-circle/1060 "2018-06-18T21:43:50Z")

</div>

Hi guys, Is there a way to draw an uncomplete circle without using beginShape() and curveVertex() like this ? : int diam = 200; void setup(){ size(500,500); translate(width/2,height/2); stroke(#E044A2); backg…

---

## [Not receiving all data from Arduino Serial port](https://discourse.processing.org/t/not-receiving-all-data-from-arduino-serial-port/1044)

<div class="topic-metadata">

**Author:** [@rluxon](https://discourse.processing.org/u/rluxon)\
**Replies:** 2\
**Last updated:** [June 18, 2018, 5:30am UTC](https://discourse.processing.org/t/not-receiving-all-data-from-arduino-serial-port/1044 "2018-06-18T05:30:32Z")

</div>

Hey everyone, total noob here to programming. I have an issue with a script (is it called that for processing?) I receive 2 of the 3 parts of data, but cant for the life of me get the soil moisture readings. I know its …

---

## [Pressing multiple keys at once on different rows](https://discourse.processing.org/t/pressing-multiple-keys-at-once-on-different-rows/1023)

<div class="topic-metadata">

**Author:** [@widemouthfrog1](https://discourse.processing.org/u/widemouthfrog1)\
**Replies:** 3\
**Last updated:** [June 18, 2018, 12:36am UTC](https://discourse.processing.org/t/pressing-multiple-keys-at-once-on-different-rows/1023 "2018-06-18T00:36:57Z")

</div>

public class Main extends PApplet{ public static void main(String\[\] args) { PApplet.main("Main"); } Map\<Character, Boolean\> buttonsPressed = new HashMap\<Character, Boolean\>(); Map\<Character, Boolean\> button…

---

## [Novice coder needing help - cannot be resolved to a variable error](https://discourse.processing.org/t/novice-coder-needing-help-cannot-be-resolved-to-a-variable-error/1031)

<div class="topic-metadata">

**Author:** [@JRK](https://discourse.processing.org/u/JRK)\
**Replies:** 2\
**Last updated:** [June 17, 2018, 7:20pm UTC](https://discourse.processing.org/t/novice-coder-needing-help-cannot-be-resolved-to-a-variable-error/1031 "2018-06-17T19:20:04Z")

</div>

I am a beginner and finding a problem. I wrote the following code and had error message “a cannot be resolved to a variable”. The rectangle appears fine with numbers but will not accept a declared integer. void setup ()…

---

## [How to name objects with variables?](https://discourse.processing.org/t/how-to-name-objects-with-variables/1027)

<div class="topic-metadata">

**Author:** [@RipplB](https://discourse.processing.org/u/RipplB)\
**Replies:** 1\
**Last updated:** [June 17, 2018, 3:16pm UTC](https://discourse.processing.org/t/how-to-name-objects-with-variables/1027 "2018-06-17T15:16:13Z")

</div>

I have a class for a game, and i want to create more objects from that class. For that, i’d like to use a for loop. How to name the separate objects correctly? It is important, that later on i’d like to use their functio…

---

## [Imports, image metadata - adding text to png](https://discourse.processing.org/t/imports-image-metadata-adding-text-to-png/1025)

<div class="topic-metadata">

**Author:** [@lmccandless](https://discourse.processing.org/u/lmccandless)\
**Replies:** 1\
**Last updated:** [June 17, 2018, 2:17pm UTC](https://discourse.processing.org/t/imports-image-metadata-adding-text-to-png/1025 "2018-06-17T14:17:34Z")

</div>

I’m trying to add text metadata to a png, I found java code to do it on stackoverflow. I’m trying to get it to work in processing, but I can’t seem to find the right imports for some these classes the code uses import j…

---

## [Applet use in nested classes](https://discourse.processing.org/t/applet-use-in-nested-classes/827)

<div class="topic-metadata">

**Author:** [@ZazoThex](https://discourse.processing.org/u/ZazoThex)\
**Replies:** 3\
**Last updated:** [June 16, 2018, 9:15am UTC](https://discourse.processing.org/t/applet-use-in-nested-classes/827 "2018-06-16T09:15:56Z")

</div>

Hello all. As an exercise in becoming more proficient at Processing, I’ve been trying to make my own GUI instead of using one of the great already-made libraries like CP5. I’ve been doing well enough, but am getting hung…

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

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