# Coding Questions

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

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

**Page:** 177

---

## [Basic shader help](https://discourse.processing.org/t/basic-shader-help/2895)

<div class="topic-metadata">

**Author:** [@steve\_j](https://discourse.processing.org/u/steve_j)\
**Replies:** 7\
**Last updated:** [August 29, 2018, 12:57pm UTC](https://discourse.processing.org/t/basic-shader-help/2895 "2018-08-29T12:57:19Z")

</div>

Im currently trying to get my head around shaders. Have tried adapting the the “VideoMappingWithShader” fragment shader from gohai’s GL video Pi library to add a gradient to the video. i get a “OpenGL error 1282 at top …

---

## [What does get() return?](https://discourse.processing.org/t/what-does-get-return/3069)

<div class="topic-metadata">

**Author:** [@malaJ0](https://discourse.processing.org/u/malaJ0)\
**Replies:** 2\
**Last updated:** [August 28, 2018, 5:14pm UTC](https://discourse.processing.org/t/what-does-get-return/3069 "2018-08-28T17:14:17Z")

</div>

Hey everyone, I’m trying to figure out what does get() return when you use it with 4 arguments - as referred to at processing References. Does it return a matrix of w\*h dimension, while x and y is the position of the t…

---

## [Exporting files](https://discourse.processing.org/t/exporting-files/3012)

<div class="topic-metadata">

**Author:** [@Groot](https://discourse.processing.org/u/Groot)\
**Replies:** 2\
**Last updated:** [August 27, 2018, 5:47pm UTC](https://discourse.processing.org/t/exporting-files/3012 "2018-08-27T17:47:05Z")

</div>

Hey - when i export the file and save it down. I am unable to email and/or share the file. is there something i am missing? thanks

---

## [Creating a game](https://discourse.processing.org/t/creating-a-game/2948)

<div class="topic-metadata">

**Author:** [@suptoabha](https://discourse.processing.org/u/suptoabha)\
**Replies:** 5\
**Last updated:** [August 26, 2018, 4:04pm UTC](https://discourse.processing.org/t/creating-a-game/2948 "2018-08-26T16:04:14Z")

</div>

I need some examples of codes of games. So that i can get an idea how to make a simple game like a character can collect coin and increase score And if touch any object like bomb its life will be deducted. Just some exam…

---

## [Movie objects all change at the same time](https://discourse.processing.org/t/movie-objects-all-change-at-the-same-time/2979)

<div class="topic-metadata">

**Author:** [@tefa](https://discourse.processing.org/u/tefa)\
**Replies:** 2\
**Last updated:** [August 25, 2018, 11:13pm UTC](https://discourse.processing.org/t/movie-objects-all-change-at-the-same-time/2979 "2018-08-25T23:13:18Z")

</div>

Hello Processors, thank you for your time. I made this object using a Movie object where two videos float up and stay in the top. It works but I also typed a function for each of them to change color when I click on them…

---

## [Video does not show up when object oriented code runs](https://discourse.processing.org/t/video-does-not-show-up-when-object-oriented-code-runs/2976)

<div class="topic-metadata">

**Author:** [@tefa](https://discourse.processing.org/u/tefa)\
**Replies:** 5\
**Last updated:** [August 25, 2018, 11:09pm UTC](https://discourse.processing.org/t/video-does-not-show-up-when-object-oriented-code-runs/2976 "2018-08-25T23:09:09Z")

</div>

Hello Processors, thank you for your time. I made an object using another object called Movie, so that two videos appear floating upwards and stay in the top. The code runs but only the white background appears. import …

---

## [Move the character by pressing up key](https://discourse.processing.org/t/move-the-character-by-pressing-up-key/2475)

<div class="topic-metadata">

**Author:** [@suptoabha](https://discourse.processing.org/u/suptoabha)\
**Replies:** 10\
**Last updated:** [August 25, 2018, 6:42pm UTC](https://discourse.processing.org/t/move-the-character-by-pressing-up-key/2475 "2018-08-25T18:42:53Z")

</div>

When keyboard arrow key UP is press, character should move up to the next upper section. Each time character is more up on level, this level will be coloured differently. Please somebody help me to code this.

---

## [Random boxes and circles using array(s)](https://discourse.processing.org/t/random-boxes-and-circles-using-array-s/2939)

<div class="topic-metadata">

**Author:** [@suptoabha](https://discourse.processing.org/u/suptoabha)\
**Replies:** 4\
**Last updated:** [August 25, 2018, 6:40pm UTC](https://discourse.processing.org/t/random-boxes-and-circles-using-array-s/2939 "2018-08-25T18:40:12Z")

</div>

I am trying to make something like this. My code is here int x; int y=226; boolean play = true; void setup() { size(800, 400); background(0); } void draw() { cave(); stone(); clumsy(); bomb(); coin…

---

## [While loop bug? Stuck on empty](https://discourse.processing.org/t/while-loop-bug-stuck-on-empty/2557)

<div class="topic-metadata">

**Author:** [@iamtomodea](https://discourse.processing.org/u/iamtomodea)\
**Replies:** 19\
**Last updated:** [August 13, 2018, 10:41am UTC](https://discourse.processing.org/t/while-loop-bug-stuck-on-empty/2557 "2018-08-13T10:41:05Z")

</div>

Hi I have a weird bug in a sketch that I’m using to control a plotter. I have a while loop that is controlled by a boolean that is switched to false while the plotter is in the middle of doing something. Once the plott…

---

## [Tint mp4 when clicked](https://discourse.processing.org/t/tint-mp4-when-clicked/2937)

<div class="topic-metadata">

**Author:** [@tefa](https://discourse.processing.org/u/tefa)\
**Replies:** 4\
**Last updated:** [August 25, 2018, 5:40am UTC](https://discourse.processing.org/t/tint-mp4-when-clicked/2937 "2018-08-25T05:40:49Z")

</div>

Hello Processors, thank you for your time. I have a loop that changes the size of mp4’s (images), using the key “s” I stop the loop and restart it with key “p”. I want to click on any of the images and randomly tint. I t…

---

## [Press space bar to stop animation](https://discourse.processing.org/t/press-space-bar-to-stop-animation/2933)

<div class="topic-metadata">

**Author:** [@suptoabha](https://discourse.processing.org/u/suptoabha)\
**Replies:** 2\
**Last updated:** [August 24, 2018, 3:26pm UTC](https://discourse.processing.org/t/press-space-bar-to-stop-animation/2933 "2018-08-24T15:26:50Z")

</div>

I have written this code. int x; int y=241; void setup() { size(800, 400); background(0); } void draw() { cave(); stone(); clumsy(); } void cave() { noStroke(); fill(160); rect(0,100,width,200);…

---

## [Tank movement seen from above](https://discourse.processing.org/t/tank-movement-seen-from-above/2883)

<div class="topic-metadata">

**Author:** [@Toki](https://discourse.processing.org/u/Toki)\
**Replies:** 11\
**Last updated:** [August 24, 2018, 2:51pm UTC](https://discourse.processing.org/t/tank-movement-seen-from-above/2883 "2018-08-24T14:51:17Z")

</div>

Hello, Im new to processing and coding in general. Im trying to code a “tank” move around (seen from above). I want to have a tank rotate left when pressing keyboard “A” and right when pressing “D”. And I want it to dri…

---

## [A repeated color pattern](https://discourse.processing.org/t/a-repeated-color-pattern/2928)

<div class="topic-metadata">

**Author:** [@suptoabha](https://discourse.processing.org/u/suptoabha)\
**Replies:** 5\
**Last updated:** [August 24, 2018, 2:42pm UTC](https://discourse.processing.org/t/a-repeated-color-pattern/2928 "2018-08-24T14:42:24Z")

</div>

I have written this code. void setup(){ size(800,400); background(0); } void draw(){ cave(); stone(); } void cave(){ noStroke(); fill(160); rect(0,100,width,200); } void stone(){ for(int i=0;i\<width;i+…

---

## [\[ask\] how to use an array of double in Java Processing](https://discourse.processing.org/t/ask-how-to-use-an-array-of-double-in-java-processing/2908)

<div class="topic-metadata">

**Author:** [@tavisena](https://discourse.processing.org/u/tavisena)\
**Replies:** 20\
**Last updated:** [August 24, 2018, 1:51pm UTC](https://discourse.processing.org/t/ask-how-to-use-an-array-of-double-in-java-processing/2908 "2018-08-24T13:51:07Z")

</div>

hi everyone! i have some project about using svm the coding using C++, ii wanna use this parameter in my java processing because i needed to control robot using leap motion and the svm as the decision maker. the array o…

---

## [noSmooth() doesn't works with P2D](https://discourse.processing.org/t/nosmooth-doesnt-works-with-p2d/2924)

<div class="topic-metadata">

**Author:** [@Kayno](https://discourse.processing.org/u/Kayno)\
**Replies:** 10\
**Last updated:** [August 24, 2018, 1:37pm UTC](https://discourse.processing.org/t/nosmooth-doesnt-works-with-p2d/2924 "2018-08-24T13:37:26Z")

</div>

Hello, I’m doing a little game and I’m using pixel art images so I need to use noSmooth() which doesn’t works in P2D… I would like to know if there is another way to use pixel art in P2D. Sorry about mistakes, I’m fre…

---

## [Multiple line graphs](https://discourse.processing.org/t/multiple-line-graphs/2785)

<div class="topic-metadata">

**Author:** [@Groot](https://discourse.processing.org/u/Groot)\
**Replies:** 8\
**Last updated:** [August 24, 2018, 1:03pm UTC](https://discourse.processing.org/t/multiple-line-graphs/2785 "2018-08-24T13:03:27Z")

</div>

Hi all - with the much appreciated help from TfGuy44, i managed to develop the below. which is great and very useful. I have decided however to go in a slightly different direction and want to view my data in the form of…

---

## [Creating an ArrayList of SinOsc objects, trouble with adding, removing, play sound and stop sound](https://discourse.processing.org/t/creating-an-arraylist-of-sinosc-objects-trouble-with-adding-removing-play-sound-and-stop-sound/2844)

<div class="topic-metadata">

**Author:** [@lanelps](https://discourse.processing.org/u/lanelps)\
**Replies:** 1\
**Last updated:** [August 24, 2018, 10:26am UTC](https://discourse.processing.org/t/creating-an-arraylist-of-sinosc-objects-trouble-with-adding-removing-play-sound-and-stop-sound/2844 "2018-08-24T10:26:43Z")

</div>

As the title says I’m trying to create an ArrayList of SinOsc objects. When I click the mouse I want it to add a new SinOsc object to the ArrayList which will play a sine wave. The sin wave will differ in frequency and…

---

## [Adding data to a string array how to?](https://discourse.processing.org/t/adding-data-to-a-string-array-how-to/2891)

<div class="topic-metadata">

**Author:** [@stevenette](https://discourse.processing.org/u/stevenette)\
**Replies:** 2\
**Last updated:** [August 24, 2018, 5:17am UTC](https://discourse.processing.org/t/adding-data-to-a-string-array-how-to/2891 "2018-08-24T05:17:12Z")

</div>

Hello, I am trying to add data to a string array every time one of those data values changes. I don’t know if this is possible. time = timeStamp.format(now); for (int i = 0; i \< 2; i++) { String\[\] gateGageTime; …

---

## [how to program HC SR04 ultrasonic sensor ](https://discourse.processing.org/t/how-to-program-hc-sr04-ultrasonic-sensor/2890)

<div class="topic-metadata">

**Author:** [@reedoh](https://discourse.processing.org/u/reedoh)\
**Replies:** 1\
**Last updated:** [August 24, 2018, 5:01am UTC](https://discourse.processing.org/t/how-to-program-hc-sr04-ultrasonic-sensor/2890 "2018-08-24T05:01:47Z")

</div>

Hi, can anyone guide me on how to obtain distance from sonar sensor using processing IDE for raspberry pi

---

## [Error playing SinOsc objects from an ArrayList](https://discourse.processing.org/t/error-playing-sinosc-objects-from-an-arraylist/2867)

<div class="topic-metadata">

**Author:** [@lanelps](https://discourse.processing.org/u/lanelps)\
**Replies:** 11\
**Last updated:** [August 24, 2018, 12:11am UTC](https://discourse.processing.org/t/error-playing-sinosc-objects-from-an-arraylist/2867 "2018-08-24T00:11:29Z")

</div>

I’m trying to create an ArrayList of SinOsc objects (Which works), but then the usual functions to play and stop sound aren’t recognised? The end goal is to be able to click to create a new object and hit a key to remov…

---

## [Need help in processing function](https://discourse.processing.org/t/need-help-in-processing-function/2875)

<div class="topic-metadata">

**Author:** [@avro](https://discourse.processing.org/u/avro)\
**Replies:** 4\
**Last updated:** [August 23, 2018, 4:36pm UTC](https://discourse.processing.org/t/need-help-in-processing-function/2875 "2018-08-23T16:36:18Z")

</div>

Define a function call BuildTheWall that gets the parameters/inputs (the size of each rectangle width or/and height), x coordinate and y coordinate of the first and the last point. The function should draw the rectangle…

---

## [Must qualify the allocation with](https://discourse.processing.org/t/must-qualify-the-allocation-with/2828)

<div class="topic-metadata">

**Author:** [@Manatee](https://discourse.processing.org/u/Manatee)\
**Replies:** 29\
**Last updated:** [August 23, 2018, 3:42pm UTC](https://discourse.processing.org/t/must-qualify-the-allocation-with/2828 "2018-08-23T15:42:31Z")

</div>

I google this problem but otehr one sort out! I cannot create a new instance of one of my class, here is the main: Snake snake; A tmp; int frameSpeed = 1;//the frame rate int score = 0; //int bestScore = 0; int attemp…

---

## [Network library data transfer question](https://discourse.processing.org/t/network-library-data-transfer-question/2850)

<div class="topic-metadata">

**Author:** [@creepercrack](https://discourse.processing.org/u/creepercrack)\
**Replies:** 1\
**Last updated:** [August 23, 2018, 6:03am UTC](https://discourse.processing.org/t/network-library-data-transfer-question/2850 "2018-08-23T06:03:26Z")

</div>

I recently started working with the processing network library, and when it comes to data transfer between a server and clients, I don’t see a good way to do it. I managed to transfer data reliable using Strings, but if…

---

## [How do I define an object with curly brackets?](https://discourse.processing.org/t/how-do-i-define-an-object-with-curly-brackets/2872)

<div class="topic-metadata">

**Author:** [@Grimtin10](https://discourse.processing.org/u/Grimtin10)\
**Replies:** 13\
**Last updated:** [August 23, 2018, 5:33am UTC](https://discourse.processing.org/t/how-do-i-define-an-object-with-curly-brackets/2872 "2018-08-23T05:33:07Z")

</div>

I want to define objects in an array like this: {name: "name", temp: 123, ...} How would I do this? -Grim

---

## [Why ellipse doesn't work?](https://discourse.processing.org/t/why-ellipse-doesnt-work/2864)

<div class="topic-metadata">

**Author:** [@rioma7](https://discourse.processing.org/u/rioma7)\
**Replies:** 1\
**Last updated:** [August 22, 2018, 8:42pm UTC](https://discourse.processing.org/t/why-ellipse-doesnt-work/2864 "2018-08-22T20:42:48Z")

</div>

Hello guys, I was playing a bit with processing and I tried to make a program which does a boucing shape. This shape at the beginning is a square and when it touches the right edge it goes back but becoming a circle…buu…

---

## [3D Grid Design Help](https://discourse.processing.org/t/3d-grid-design-help/2862)

<div class="topic-metadata">

**Author:** [@thedurf18](https://discourse.processing.org/u/thedurf18)\
**Replies:** 4\
**Last updated:** [August 22, 2018, 8:40pm UTC](https://discourse.processing.org/t/3d-grid-design-help/2862 "2018-08-22T20:40:02Z")

</div>

Hi, I need help designing a 3D Grid, like the pic below. I have more than half of it done, I just need the third plane. Here’s the code I have so far: int gridSize = 10; float inc = 0.001; int density = 10; float zn…

---

## [Custom classes with many drawing components?](https://discourse.processing.org/t/custom-classes-with-many-drawing-components/2853)

<div class="topic-metadata">

**Author:** [@ehasti21](https://discourse.processing.org/u/ehasti21)\
**Replies:** 2\
**Last updated:** [August 22, 2018, 4:31pm UTC](https://discourse.processing.org/t/custom-classes-with-many-drawing-components/2853 "2018-08-22T16:31:45Z")

</div>

Hello! I’m trying to take a drawing of a cat face i’ve made and put it into custom classes that follow a mouse as it moves. I’m a bit confused as to the differences between the base class and an implemented child class. …

---

## ["Blend" two Shapes in processing](https://discourse.processing.org/t/blend-two-shapes-in-processing/2816)

<div class="topic-metadata">

**Author:** [@kiraw](https://discourse.processing.org/u/kiraw)\
**Replies:** 9\
**Last updated:** [August 22, 2018, 4:26pm UTC](https://discourse.processing.org/t/blend-two-shapes-in-processing/2816 "2018-08-22T16:26:07Z")

</div>

Hey, English isn’t my first language so please be kind. I do by best and hope you understand my problem. :slight\_smile: This is my first processing project and i have completely no idea what i’m doing or have to do… I w…

---

## [Exporting processing sketch issue](https://discourse.processing.org/t/exporting-processing-sketch-issue/2842)

<div class="topic-metadata">

**Author:** [@12345](https://discourse.processing.org/u/12345)\
**Replies:** 3\
**Last updated:** [August 22, 2018, 1:29pm UTC](https://discourse.processing.org/t/exporting-processing-sketch-issue/2842 "2018-08-22T13:29:00Z")

</div>

Hi, I’m trying to export my sketch as frame images in order to make a movie. However, when I do, only the background of my sketch comes up. Have I missed something? I’ve used saveFrame in line 73. timport ddf.minim.\*; i…

---

## [Needing help with a design](https://discourse.processing.org/t/needing-help-with-a-design/2839)

<div class="topic-metadata">

**Author:** [@thedurf18](https://discourse.processing.org/u/thedurf18)\
**Replies:** 3\
**Last updated:** [August 22, 2018, 12:06pm UTC](https://discourse.processing.org/t/needing-help-with-a-design/2839 "2018-08-22T12:06:50Z")

</div>

Hi, I’m trying to create a 3D grid, like the pic below: But I’d also like to add circles onto each axis: X, Y, Z. I’d appreciate any help. I have more than half of it done. Here’s the code I have so far: int gridSi…

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

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