# Coding Questions

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

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

**Page:** 48

---

## [Is it possible to open a file with processing sketch? (command line)](https://discourse.processing.org/t/is-it-possible-to-open-a-file-with-processing-sketch-command-line/26613)

<div class="topic-metadata">

**Author:** [@Brastin](https://discourse.processing.org/u/Brastin)\
**Replies:** 9\
**Last updated:** [July 29, 2021, 1:18pm UTC](https://discourse.processing.org/t/is-it-possible-to-open-a-file-with-processing-sketch-command-line/26613 "2021-07-29T13:18:53Z")

</div>

I would like to create something like a text editor, and allow the user to open text files with the text editor, rather than having to open the editor first. Is this possible? I’ve tried to achieve this before but I have…

---

## [Read byte array from file](https://discourse.processing.org/t/read-byte-array-from-file/31474)

<div class="topic-metadata">

**Author:** [@Vadimkuzmin](https://discourse.processing.org/u/Vadimkuzmin)\
**Replies:** 0\
**Last updated:** [July 28, 2021, 11:34am UTC](https://discourse.processing.org/t/read-byte-array-from-file/31474 "2021-07-28T11:34:23Z")

</div>

void Impuls(File selection) { if (selection == null) { println("Window was closed or the user hit cancel."); } else { println("User selected " + selection.getAbsolutePath()); String\[\] lines = loadStrings(…

---

## [Using Headers for loading Images](https://discourse.processing.org/t/using-headers-for-loading-images/31450)

<div class="topic-metadata">

**Author:** [@Glenton](https://discourse.processing.org/u/Glenton)\
**Replies:** 8\
**Last updated:** [July 27, 2021, 9:27pm UTC](https://discourse.processing.org/t/using-headers-for-loading-images/31450 "2021-07-27T21:27:25Z")

</div>

Hello, I would like to use the discog API in order to get informations on music albums and the cover Image of the album. The program I wrote handles the API correctly for fetching the String datas, but I have a problem…

---

## [Survey creation](https://discourse.processing.org/t/survey-creation/31453)

<div class="topic-metadata">

**Author:** [@coderdoge](https://discourse.processing.org/u/coderdoge)\
**Replies:** 6\
**Last updated:** [July 27, 2021, 6:31pm UTC](https://discourse.processing.org/t/survey-creation/31453 "2021-07-27T18:31:32Z")

</div>

Hi all, I have started a new project in which I want to make a survey using processing. My idea was to insert shapes as multiple choice selection tools and text as the question itself. I’ve been struggling to formulate …

---

## [loadImage() 403 Error](https://discourse.processing.org/t/loadimage-403-error/25734)

<div class="topic-metadata">

**Author:** [@jorivdkolk](https://discourse.processing.org/u/jorivdkolk)\
**Replies:** 4\
**Last updated:** [July 27, 2021, 4:31pm UTC](https://discourse.processing.org/t/loadimage-403-error/25734 "2021-07-27T16:31:36Z")

</div>

I am trying to load an image from a URL. Some images work, but sometimes the response is a 403 error message. When I try to open the URL’s in my browser they work fine, but not through the processing code. One of the im…

---

## [How Do I Make "Smarter" Linear Gradients (Ex. From Orange To Violet)?](https://discourse.processing.org/t/how-do-i-make-smarter-linear-gradients-ex-from-orange-to-violet/31426)

<div class="topic-metadata">

**Author:** [@Blurpy\_the\_RABID](https://discourse.processing.org/u/Blurpy_the_RABID)\
**Replies:** 3\
**Last updated:** [July 25, 2021, 6:22pm UTC](https://discourse.processing.org/t/how-do-i-make-smarter-linear-gradients-ex-from-orange-to-violet/31426 "2021-07-25T18:22:37Z")

</div>

Greetings everyone! I’m struggling with an issue where I want to create a linear gradient that goes from two colors that are relatively close together on the color wheel (ex. orange and violet). What I want is a simple…

---

## [Masking - I want to get rid of the outside of the circle](https://discourse.processing.org/t/masking-i-want-to-get-rid-of-the-outside-of-the-circle/31428)

<div class="topic-metadata">

**Author:** [@jih](https://discourse.processing.org/u/jih)\
**Replies:** 4\
**Last updated:** [July 25, 2021, 2:08pm UTC](https://discourse.processing.org/t/masking-i-want-to-get-rid-of-the-outside-of-the-circle/31428 "2021-07-25T14:08:00Z")

</div>

Hello, I’m studying masking. I want to get rid of the outside of the circle. (background color is gray) I tried BeginContour, but I failed. Thank you int barWidth = 10; int lastBar = -1; int r ; void setup(){ si…

---

## [Saving frames to SVG](https://discourse.processing.org/t/saving-frames-to-svg/31405)

<div class="topic-metadata">

**Author:** [@krissnutt](https://discourse.processing.org/u/krissnutt)\
**Replies:** 2\
**Last updated:** [July 25, 2021, 1:27pm UTC](https://discourse.processing.org/t/saving-frames-to-svg/31405 "2021-07-25T13:27:23Z")

</div>

Hey! I was wondering if there is an easy way to save frames as SVG files in processing? I have seen some examples using arrays, but wonder if there are other alternatives?

---

## [JSON File to 2D Array Java](https://discourse.processing.org/t/json-file-to-2d-array-java/31414)

<div class="topic-metadata">

**Author:** [@Gyrosis](https://discourse.processing.org/u/Gyrosis)\
**Replies:** 1\
**Last updated:** [July 24, 2021, 5:45am UTC](https://discourse.processing.org/t/json-file-to-2d-array-java/31414 "2021-07-24T05:45:07Z")

</div>

How can I create a 2D array using a JSON file? “tile\_size”: 16, “map\_width”: 101, “map\_height”: 37, “layers”: \[ { “name”: “bg”, “positions”: \[ { “x”:1, “y”:6, “id”:0 }, { “x”:1, “y”:7, “id”:0 }, { “x”:1, “y”:8,…

---

## [Hey! I need help with figuring out, how to make this outcome possible?](https://discourse.processing.org/t/hey-i-need-help-with-figuring-out-how-to-make-this-outcome-possible/31282)

<div class="topic-metadata">

**Author:** [@bopStu77](https://discourse.processing.org/u/bopStu77)\
**Replies:** 4\
**Last updated:** [July 24, 2021, 2:02am UTC](https://discourse.processing.org/t/hey-i-need-help-with-figuring-out-how-to-make-this-outcome-possible/31282 "2021-07-24T02:02:06Z")

</div>

Hey! I need help with figuring out, how to make this outcome possible? Create a program that allows the user to click 20 times on the screen. Once the 20th click has been pressed, circles will appear on the run window wh…

---

## [Hey Guys! I'm very new to Processing and coding. I was wondering if y'all can guide me towards the right direction](https://discourse.processing.org/t/hey-guys-im-very-new-to-processing-and-coding-i-was-wondering-if-yall-can-guide-me-towards-the-right-direction/31409)

<div class="topic-metadata">

**Author:** [@noobprogramer](https://discourse.processing.org/u/noobprogramer)\
**Replies:** 1\
**Last updated:** [July 23, 2021, 11:42pm UTC](https://discourse.processing.org/t/hey-guys-im-very-new-to-processing-and-coding-i-was-wondering-if-yall-can-guide-me-towards-the-right-direction/31409 "2021-07-23T23:42:44Z")

</div>

Hey! I’m just asking for help, not answers, just guidance! I need to get the outcome but I have no idea how or where to get started, I was wondering if I could be guided step by step please format code with \</\> button…

---

## [Snake game error](https://discourse.processing.org/t/snake-game-error/31389)

<div class="topic-metadata">

**Author:** [@Xavier](https://discourse.processing.org/u/Xavier)\
**Replies:** 1\
**Last updated:** [July 23, 2021, 10:12am UTC](https://discourse.processing.org/t/snake-game-error/31389 "2021-07-23T10:12:06Z")

</div>

Hi everyone, Iam making a snake game for my class but it has to have an interactive aproach, so my idea was that every time the snake eat an apple an image in the background would appear, so you would win the game when …

---

## [Draw A Circle After 20 Mouse Clicks In An Array](https://discourse.processing.org/t/draw-a-circle-after-20-mouse-clicks-in-an-array/31387)

<div class="topic-metadata">

**Author:** [@KH1](https://discourse.processing.org/u/KH1)\
**Replies:** 11\
**Last updated:** [July 22, 2021, 6:16pm UTC](https://discourse.processing.org/t/draw-a-circle-after-20-mouse-clicks-in-an-array/31387 "2021-07-22T18:16:32Z")

</div>

Hello All, I am trying to figure out how to draw a circle after 20 mouse click in an array. int mouseClicks; void mousePressed() { if (mouseClicks== 20) {Circle(,)} else { mouseClicks = 0; } Thank You For The Help!

---

## [How to hide the sketch window and the task bar icon?](https://discourse.processing.org/t/how-to-hide-the-sketch-window-and-the-task-bar-icon/4901)

<div class="topic-metadata">

**Author:** [@YSL](https://discourse.processing.org/u/YSL)\
**Replies:** 4\
**Last updated:** [September 15, 2020, 10:01am UTC](https://discourse.processing.org/t/how-to-hide-the-sketch-window-and-the-task-bar-icon/4901 "2020-09-15T10:01:49Z")

</div>

How can I hide the sketch window entirely, including the taskbar icon? Currently, I can create a TrayIcon and call surface.setVisible(false) to hide the window when I need to, but the taskbar icon is still there. How can…

---

## [Letting the User Set String (Save As... Dialog)](https://discourse.processing.org/t/letting-the-user-set-string-save-as-dialog/31321)

<div class="topic-metadata">

**Author:** [@dtools22](https://discourse.processing.org/u/dtools22)\
**Replies:** 8\
**Last updated:** [July 20, 2021, 3:26pm UTC](https://discourse.processing.org/t/letting-the-user-set-string-save-as-dialog/31321 "2021-07-20T15:26:58Z")

</div>

Hello, I am writing a program that contains a “save file” mechanic to it. What I want to do is offer the user of the program a chance to name the save file to whatever they wish. I believe I understand the gist of the …

---

## [How to non linear iterator](https://discourse.processing.org/t/how-to-non-linear-iterator/31235)

<div class="topic-metadata">

**Author:** [@goldorak](https://discourse.processing.org/u/goldorak)\
**Replies:** 8\
**Last updated:** [July 20, 2021, 9:22am UTC](https://discourse.processing.org/t/how-to-non-linear-iterator/31235 "2021-07-20T09:22:28Z")

</div>

Hi, Instead of iterating through my loop with a classic iterator (when I say classic I mean iterating the loop using a fixed value with something like += 20). I would like to iterate with a value which is increasing or…

---

## [Random position subordinated to random positions](https://discourse.processing.org/t/random-position-subordinated-to-random-positions/31302)

<div class="topic-metadata">

**Author:** [@humano](https://discourse.processing.org/u/humano)\
**Replies:** 7\
**Last updated:** [July 18, 2021, 2:09pm UTC](https://discourse.processing.org/t/random-position-subordinated-to-random-positions/31302 "2021-07-18T14:09:26Z")

</div>

hi there! I want to use random function to give this blocks random positions in that canvas, but I really don’t know how to do it. I can make the pink one has y valor between 0 and 500: rect(0,random(0,500),900,400); but…

---

## [Processing Onscreen D-Pad to Move Character (buttons)](https://discourse.processing.org/t/processing-onscreen-d-pad-to-move-character-buttons/31306)

<div class="topic-metadata">

**Author:** [@NerdyBoy](https://discourse.processing.org/u/NerdyBoy)\
**Replies:** 5\
**Last updated:** [July 18, 2021, 12:59pm UTC](https://discourse.processing.org/t/processing-onscreen-d-pad-to-move-character-buttons/31306 "2021-07-18T12:59:00Z")

</div>

Good Afternoon! Everyone, Im currently working on a game and I have been all over the internet looking for footage on how to program a Onscreen ( Directional-Pad Button(s) ) using the Processing Library! And when l tel…

---

## [Avoiding self intersection for 3d spline-tube](https://discourse.processing.org/t/avoiding-self-intersection-for-3d-spline-tube/31285)

<div class="topic-metadata">

**Author:** [@dehyde](https://discourse.processing.org/u/dehyde)\
**Replies:** 2\
**Last updated:** [July 17, 2021, 3:53pm UTC](https://discourse.processing.org/t/avoiding-self-intersection-for-3d-spline-tube/31285 "2021-07-17T15:53:48Z")

</div>

Hi I’m trying to create a curved 3d tube using Shapes3d library. The shape of the spline is done randomly using PVectors: for (int i=0; i\<complexity; i++){ knots\[i\] = new PVector(random(-2,2)\*300,random(-2,2)\*3…

---

## [Save() to export pictures](https://discourse.processing.org/t/save-to-export-pictures/31301)

<div class="topic-metadata">

**Author:** [@humano](https://discourse.processing.org/u/humano)\
**Replies:** 0\
**Last updated:** [July 17, 2021, 1:45pm UTC](https://discourse.processing.org/t/save-to-export-pictures/31301 "2021-07-17T13:45:51Z")

</div>

Hi there! I am trying to save the picture that my sketch has done but I can not do it. I use save() but when I go to the folder of my sketch in my android phone I don’t find it. Can you please help me? void setup() { …

---

## [Issue with image() and beginRecord(SVG)](https://discourse.processing.org/t/issue-with-image-and-beginrecord-svg/31118)

<div class="topic-metadata">

**Author:** [@TomD](https://discourse.processing.org/u/TomD)\
**Replies:** 2\
**Last updated:** [July 17, 2021, 12:38pm UTC](https://discourse.processing.org/t/issue-with-image-and-beginrecord-svg/31118 "2021-07-17T12:38:42Z")

</div>

Hi there :wave: I am having an issue with image() loading a PGraphics object and SVG beginRecord(). I am running windows Processing 3.5.4 If beginRecord() is commented out in setup() my code runs without issue. If be…

---

## [How to go from Functions to Objects?](https://discourse.processing.org/t/how-to-go-from-functions-to-objects/31275)

<div class="topic-metadata">

**Author:** [@CosmicCrowMC](https://discourse.processing.org/u/CosmicCrowMC)\
**Replies:** 6\
**Last updated:** [July 17, 2021, 7:39am UTC](https://discourse.processing.org/t/how-to-go-from-functions-to-objects/31275 "2021-07-17T07:39:11Z")

</div>

I’ve read the PShape tutorial article, specifically about Retained Mode with a Custom PShape Class, and looked at the accompanying examples, but I can’t wrap my head around any of it. I’ve avoided Object-Oriented Program…

---

## [Object Following A Moving Bezier Graph](https://discourse.processing.org/t/object-following-a-moving-bezier-graph/30598)

<div class="topic-metadata">

**Author:** [@Nick76](https://discourse.processing.org/u/Nick76)\
**Replies:** 22\
**Last updated:** [July 16, 2021, 1:24pm UTC](https://discourse.processing.org/t/object-following-a-moving-bezier-graph/30598 "2021-07-16T13:24:05Z")

</div>

Hi everybody, I am trying to make an object follow a curved path (representing a breathing ratio). The object is centred on the x-axis, however, should dynamically adjust its y-position to match/stay on the path, which …

---

## [PShader/PeasyCam texture not rotating](https://discourse.processing.org/t/pshader-peasycam-texture-not-rotating/31224)

<div class="topic-metadata">

**Author:** [@mnse](https://discourse.processing.org/u/mnse)\
**Replies:** 3\
**Last updated:** [July 16, 2021, 10:29am UTC](https://discourse.processing.org/t/pshader-peasycam-texture-not-rotating/31224 "2021-07-16T10:29:01Z")

</div>

Hi, I’ve a simple processing sketch which should use a shader to texture a sphere and use peasycam for rotation. if running the sketch the texture is applied quite well, but it doesn’t apply the rotation. Has anyone an …

---

## [How can I stretch letters individually?](https://discourse.processing.org/t/how-can-i-stretch-letters-individually/31247)

<div class="topic-metadata">

**Author:** [@tommyba](https://discourse.processing.org/u/tommyba)\
**Replies:** 1\
**Last updated:** [July 16, 2021, 12:14am UTC](https://discourse.processing.org/t/how-can-i-stretch-letters-individually/31247 "2021-07-16T00:14:59Z")

</div>

PGraphics letters; PGraphics letters2; PGraphics letters3; PGraphics letters4; PGraphics letters5; PGraphics letters6; void setup() { size(5000, 5000); letters = createGraphics(width, height); letters2 = createG…

---

## [Help on a console project](https://discourse.processing.org/t/help-on-a-console-project/31257)

<div class="topic-metadata">

**Author:** [@Ironbatman1](https://discourse.processing.org/u/Ironbatman1)\
**Replies:** 10\
**Last updated:** [July 15, 2021, 6:03pm UTC](https://discourse.processing.org/t/help-on-a-console-project/31257 "2021-07-15T18:03:28Z")

</div>

Hello!!! so I’ve been working on making a console using processing, I’m making it similar to windows terminal or Linux bash command line. but I’m having a bit of an issue with getting what you previously typed to slowly …

---

## [A little help is needed !?](https://discourse.processing.org/t/a-little-help-is-needed/31268)

<div class="topic-metadata">

**Author:** [@Peace](https://discourse.processing.org/u/Peace)\
**Replies:** 1\
**Last updated:** [July 15, 2021, 2:01pm UTC](https://discourse.processing.org/t/a-little-help-is-needed/31268 "2021-07-15T14:01:28Z")

</div>

Can anybody pls educate me how did the writer measure the following two rect () to produce (1,2, 4,3) ( I understood only 1,2 touching the coordinate 1 (x), 2 (y) part ). Rect () (3,2,4,2). I understood only (3,2) coord…

---

## [How can I stretch individual letters?](https://discourse.processing.org/t/how-can-i-stretch-individual-letters/31239)

<div class="topic-metadata">

**Author:** [@tommyba](https://discourse.processing.org/u/tommyba)\
**Replies:** 1\
**Last updated:** [July 15, 2021, 8:40am UTC](https://discourse.processing.org/t/how-can-i-stretch-individual-letters/31239 "2021-07-15T08:40:53Z")

</div>

i have this code and i want to, for example, stretch the A to the right and and the rest of the letters get really little like they are being pushed, or stretch the C to both left and right and push the A B to the left a…

---

## [Hi Guys! I just need help figuring out how to change the color of the bouncing ball every time the player circle collides with it](https://discourse.processing.org/t/hi-guys-i-just-need-help-figuring-out-how-to-change-the-color-of-the-bouncing-ball-every-time-the-player-circle-collides-with-it/31250)

<div class="topic-metadata">

**Author:** [@bopStu77](https://discourse.processing.org/u/bopStu77)\
**Replies:** 4\
**Last updated:** [July 14, 2021, 3:41pm UTC](https://discourse.processing.org/t/hi-guys-i-just-need-help-figuring-out-how-to-change-the-color-of-the-bouncing-ball-every-time-the-player-circle-collides-with-it/31250 "2021-07-14T15:41:26Z")

</div>

This is the code I was given to start with; int rad = 60; // Width of the shape float xpos, ypos; // Starting position of shape float xspeed = 2.8; // Speed of the shape float yspeed = 2.2; // Speed of th…

---

## [Creating a shield for an enemy class](https://discourse.processing.org/t/creating-a-shield-for-an-enemy-class/31242)

<div class="topic-metadata">

**Author:** [@Gyrosis](https://discourse.processing.org/u/Gyrosis)\
**Replies:** 1\
**Last updated:** [July 14, 2021, 7:08am UTC](https://discourse.processing.org/t/creating-a-shield-for-an-enemy-class/31242 "2021-07-14T07:08:24Z")

</div>

So say if I want to create a shield so that you would have to take down the shield before killing the enemy. How would I code that?

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

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