# Coding Questions

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

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

**Page:** 120

---

## [Reading and writing variable or arrays in text format for later use](https://discourse.processing.org/t/reading-and-writing-variable-or-arrays-in-text-format-for-later-use/15561)

<div class="topic-metadata">

**Author:** [@paulgoux](https://discourse.processing.org/u/paulgoux)\
**Replies:** 7\
**Last updated:** [November 17, 2019, 6:43pm UTC](https://discourse.processing.org/t/reading-and-writing-variable-or-arrays-in-text-format-for-later-use/15561 "2019-11-17T18:43:02Z")

</div>

As the title suggests, whats the best method for doing this?

---

## [Adding collisions and a scoreboard](https://discourse.processing.org/t/adding-collisions-and-a-scoreboard/15584)

<div class="topic-metadata">

**Author:** [@snyke123](https://discourse.processing.org/u/snyke123)\
**Replies:** 1\
**Last updated:** [November 17, 2019, 6:12pm UTC](https://discourse.processing.org/t/adding-collisions-and-a-scoreboard/15584 "2019-11-17T18:12:51Z")

</div>

Hey for a school project I am making a little game where you control a spaceship with your mouse and you have to go between the walls. If you hit one of the walls you fail. (It is like a flappy bird game) But the proble…

---

## [Help with creating axis & naming it](https://discourse.processing.org/t/help-with-creating-axis-naming-it/15554)

<div class="topic-metadata">

**Author:** [@madf](https://discourse.processing.org/u/madf)\
**Replies:** 4\
**Last updated:** [November 17, 2019, 4:50pm UTC](https://discourse.processing.org/t/help-with-creating-axis-naming-it/15554 "2019-11-17T16:50:13Z")

</div>

I am about to cry, I am so confused and lost. I’ve looked all over the processing.org resources but maybe my question is just too simple for it. I can’t figure out how to create and name an axis or how to create the litt…

---

## [Get rid of distortion](https://discourse.processing.org/t/get-rid-of-distortion/15564)

<div class="topic-metadata">

**Author:** [@bkaramah](https://discourse.processing.org/u/bkaramah)\
**Replies:** 1\
**Last updated:** [November 17, 2019, 5:30am UTC](https://discourse.processing.org/t/get-rid-of-distortion/15564 "2019-11-17T05:30:26Z")

</div>

Hello, i want to project a picture onto a cylinder. However this is distorted during the projection. At the sides, it is strongly consumed, because of the uneven surface. How can I solve the problem?

---

## [Errors importing to openprocessing](https://discourse.processing.org/t/errors-importing-to-openprocessing/15569)

<div class="topic-metadata">

**Author:** [@paulgoux](https://discourse.processing.org/u/paulgoux)\
**Replies:** 5\
**Last updated:** [November 17, 2019, 12:49pm UTC](https://discourse.processing.org/t/errors-importing-to-openprocessing/15569 "2019-11-17T12:49:02Z")

</div>

So I’ve ran into an issue porting code from pde to open processing, at first i realised that i was assigning variable was functions which for some reason is acceptable for boolean values in the pde environment, ie Boole…

---

## [How to get image to change direction when it touches a wall](https://discourse.processing.org/t/how-to-get-image-to-change-direction-when-it-touches-a-wall/15528)

<div class="topic-metadata">

**Author:** [@Banana132](https://discourse.processing.org/u/Banana132)\
**Replies:** 15\
**Last updated:** [November 16, 2019, 8:10pm UTC](https://discourse.processing.org/t/how-to-get-image-to-change-direction-when-it-touches-a-wall/15528 "2019-11-16T20:10:13Z")

</div>

Hi there, im quite new to processing and programming in general, im trying to get a different image when it hits a wall but also that it changes its image to the direction it is going after it has hit a wall. I have go…

---

## [Acos() not giving angles between PI/2-3PI/2](https://discourse.processing.org/t/acos-not-giving-angles-between-pi-2-3pi-2/15513)

<div class="topic-metadata">

**Author:** [@F53](https://discourse.processing.org/u/F53)\
**Replies:** 2\
**Last updated:** [November 15, 2019, 5:51pm UTC](https://discourse.processing.org/t/acos-not-giving-angles-between-pi-2-3pi-2/15513 "2019-11-15T17:51:17Z")

</div>

I am making a tank game, using the following to determine the angle from the tank to the cursor rotate(atan(((mouseY-height/2)\*scalar)/((mouseX-width/2)\*scalar))); then drawing my cannon within it (for shortening purpo…

---

## [Making a Palette using for loops and arrays \[COMPLICATED\]](https://discourse.processing.org/t/making-a-palette-using-for-loops-and-arrays-complicated/15475)

<div class="topic-metadata">

**Author:** [@IsaiahZ](https://discourse.processing.org/u/IsaiahZ)\
**Replies:** 15\
**Last updated:** [November 15, 2019, 11:24am UTC](https://discourse.processing.org/t/making-a-palette-using-for-loops-and-arrays-complicated/15475 "2019-11-15T11:24:25Z")

</div>

So I am making a palette and am trying to learn for loops(nested loops) and arrays. I am having difficulty understanding the mechanics of them as well as how I am to implement them to this project. I will explain first …

---

## [Can you help me repair it?](https://discourse.processing.org/t/can-you-help-me-repair-it/15502)

<div class="topic-metadata">

**Author:** [@Soloh](https://discourse.processing.org/u/Soloh)\
**Replies:** 1\
**Last updated:** [November 15, 2019, 9:27am UTC](https://discourse.processing.org/t/can-you-help-me-repair-it/15502 "2019-11-15T09:27:23Z")

</div>

int x=500; int o=600; void setup() { size(1000,1000); strokeWeight(2); } void draw() { background(100,150,200); line(500,200,x,700); ellipse(x,700,200,200); ellipse(x,700,170,170); ellipse(x,700,140,140); ellipse(x,70…

---

## [Square an arraylist (new to coding)](https://discourse.processing.org/t/square-an-arraylist-new-to-coding/15489)

<div class="topic-metadata">

**Author:** [@NoSmoke11](https://discourse.processing.org/u/NoSmoke11)\
**Replies:** 5\
**Last updated:** [November 14, 2019, 10:16pm UTC](https://discourse.processing.org/t/square-an-arraylist-new-to-coding/15489 "2019-11-14T22:16:54Z")

</div>

Hello guys how do i square all the numbers in an arrayList? i want to square each number with itself, is this possible?

---

## [Way to use a method as parameter](https://discourse.processing.org/t/way-to-use-a-method-as-parameter/15494)

<div class="topic-metadata">

**Author:** [@NumericPrime](https://discourse.processing.org/u/NumericPrime)\
**Replies:** 4\
**Last updated:** [November 14, 2019, 9:00pm UTC](https://discourse.processing.org/t/way-to-use-a-method-as-parameter/15494 "2019-11-14T21:00:08Z")

</div>

Hi I’ve been Looking for a way to create a method wich uses an other method for calculating stuff. As I surfed I found that there are methods in specific classes wich can do this for Example in the Library java.awt.event…

---

## [Any idea how to fix this? Quiz](https://discourse.processing.org/t/any-idea-how-to-fix-this-quiz/15418)

<div class="topic-metadata">

**Author:** [@CyberDodo](https://discourse.processing.org/u/CyberDodo)\
**Replies:** 7\
**Last updated:** [November 14, 2019, 4:52pm UTC](https://discourse.processing.org/t/any-idea-how-to-fix-this-quiz/15418 "2019-11-14T16:52:05Z")

</div>

int flag = 0; void setup() { size( 1366, 768); background(255); } void draw() { if(flag == 0){ push(); background(255); fill(255, 0, 0); rect (700, 300, 300, 300); fill(0, 255, 0); …

---

## [Can't add elements to an arraylist?](https://discourse.processing.org/t/cant-add-elements-to-an-arraylist/15461)

<div class="topic-metadata">

**Author:** [@Althos](https://discourse.processing.org/u/Althos)\
**Replies:** 10\
**Last updated:** [November 14, 2019, 2:57pm UTC](https://discourse.processing.org/t/cant-add-elements-to-an-arraylist/15461 "2019-11-14T14:57:18Z")

</div>

Hi, Although I wouldn’t say I’m a complete novice, I’ve been unsucessfully trying to do something quite simple : add objects to an ArrayList Code is somethin like this : ArrayList\<Object\> objects = new ArrayList\<Objec…

---

## [Having trouble with my grid](https://discourse.processing.org/t/having-trouble-with-my-grid/15466)

<div class="topic-metadata">

**Author:** [@IsaiahZ](https://discourse.processing.org/u/IsaiahZ)\
**Replies:** 7\
**Last updated:** [November 14, 2019, 1:34pm UTC](https://discourse.processing.org/t/having-trouble-with-my-grid/15466 "2019-11-14T13:34:10Z")

</div>

Having trouble with the for loops. I need to keep the grid but get rid of the excess lines. If anyone could help. I’m very new to all this. size(500,500); final int N = 25; for(int i=0; i\<N; i++){ float xPosition …

---

## [Caesar Cipher Text](https://discourse.processing.org/t/caesar-cipher-text/15477)

<div class="topic-metadata">

**Author:** [@Adrian1998](https://discourse.processing.org/u/Adrian1998)\
**Replies:** 1\
**Last updated:** [November 14, 2019, 5:32am UTC](https://discourse.processing.org/t/caesar-cipher-text/15477 "2019-11-14T05:32:29Z")

</div>

Hello I am currently struggling very hard on this program. I have to make a caesar cipher program and I can not figure out how to make the program cipher once. String Alpha = "abcdefghijklmnopqrstuvwxyz"; int i = 0; vo…

---

## [Color - changing RGB values when in HSB colorMode](https://discourse.processing.org/t/color-changing-rgb-values-when-in-hsb-colormode/15277)

<div class="topic-metadata">

**Author:** [@paulstgeorge](https://discourse.processing.org/u/paulstgeorge)\
**Replies:** 34\
**Last updated:** [November 14, 2019, 3:39am UTC](https://discourse.processing.org/t/color-changing-rgb-values-when-in-hsb-colormode/15277 "2019-11-14T03:39:05Z")

</div>

I have produced this crude and simple sketch to get and change a RGB value when I am in HSB colorMode. Later I will use bit shifting instead of green() and so on. But before I build on this, is this the best way to do t…

---

## [Needle sweep. I have needle going to 180 degrees, but I need it to sweep back to 0](https://discourse.processing.org/t/needle-sweep-i-have-needle-going-to-180-degrees-but-i-need-it-to-sweep-back-to-0/15473)

<div class="topic-metadata">

**Author:** [@DonnieBrasco](https://discourse.processing.org/u/DonnieBrasco)\
**Replies:** 3\
**Last updated:** [November 14, 2019, 1:47am UTC](https://discourse.processing.org/t/needle-sweep-i-have-needle-going-to-180-degrees-but-i-need-it-to-sweep-back-to-0/15473 "2019-11-14T01:47:20Z")

</div>

//Define Global Variables float x, y; //updating coordinates float a = 0; //find theta angle float r = 200; //radius void setup(){ size(640,480); } void draw(){ background(#6E96A7); //bluish background drawC…

---

## [Cant find solution for restart](https://discourse.processing.org/t/cant-find-solution-for-restart/15462)

<div class="topic-metadata">

**Author:** [@actuallyagod](https://discourse.processing.org/u/actuallyagod)\
**Replies:** 1\
**Last updated:** [November 13, 2019, 7:51pm UTC](https://discourse.processing.org/t/cant-find-solution-for-restart/15462 "2019-11-13T19:51:19Z")

</div>

Hi All! I have been trying to add a restart button to this code but variables dont seem to work for me or maybe im doing it wrong. As of now i have tried to add: void keyPressed() { if(key == 'r') { restart(); } } …

---

## [Help with Intersecting Functions of Game Elements](https://discourse.processing.org/t/help-with-intersecting-functions-of-game-elements/15345)

<div class="topic-metadata">

**Author:** [@las6525](https://discourse.processing.org/u/las6525)\
**Replies:** 5\
**Last updated:** [November 10, 2019, 11:20am UTC](https://discourse.processing.org/t/help-with-intersecting-functions-of-game-elements/15345 "2019-11-10T11:20:52Z")

</div>

Hi All, I am playing around with building an incredibly simple two-person competitive game. Here’s the concept: One player uses the mouse, EI the ‘spaceship’ that shoots a ‘light beam’ when the mouse is clicked. The ot…

---

## [How to make an advanced Score in Processing?](https://discourse.processing.org/t/how-to-make-an-advanced-score-in-processing/15436)

<div class="topic-metadata">

**Author:** [@Leyonad](https://discourse.processing.org/u/Leyonad)\
**Replies:** 3\
**Last updated:** [November 12, 2019, 10:09pm UTC](https://discourse.processing.org/t/how-to-make-an-advanced-score-in-processing/15436 "2019-11-12T22:09:40Z")

</div>

Hello, I’m developing a game in processing. It’s about hitting a ball with a bat so that the ball is thrown back. If you hit the ball, you get a point or the score increases by 1. I want to add a shop to the main menu,…

---

## [Bouncing Throwable Ball](https://discourse.processing.org/t/bouncing-throwable-ball/15429)

<div class="topic-metadata">

**Author:** [@riverhawc](https://discourse.processing.org/u/riverhawc)\
**Replies:** 3\
**Last updated:** [November 12, 2019, 8:25pm UTC](https://discourse.processing.org/t/bouncing-throwable-ball/15429 "2019-11-12T20:25:09Z")

</div>

Hi all. I’ve made the basic bouncing ball, but I’m trying to make it so that it maintains the velocity of the cursor. is there something I did wrong? PVector location; PVector velocity; PVector gravity; int sz = 100; …

---

## [Getting 2D Array of Objects to Randomly Scale](https://discourse.processing.org/t/getting-2d-array-of-objects-to-randomly-scale/15390)

<div class="topic-metadata">

**Author:** [@Lane](https://discourse.processing.org/u/Lane)\
**Replies:** 8\
**Last updated:** [November 12, 2019, 7:53pm UTC](https://discourse.processing.org/t/getting-2d-array-of-objects-to-randomly-scale/15390 "2019-11-12T19:53:34Z")

</div>

Hello! I’m trying to make my background of stars randomly scale. I used a 2D array of class Star to display what I have right now. I’m very new to processing so explaining this to me in basic terms would be very much app…

---

## [How to detect path progression direction](https://discourse.processing.org/t/how-to-detect-path-progression-direction/15404)

<div class="topic-metadata">

**Author:** [@jeykech](https://discourse.processing.org/u/jeykech)\
**Replies:** 8\
**Last updated:** [November 12, 2019, 7:36pm UTC](https://discourse.processing.org/t/how-to-detect-path-progression-direction/15404 "2019-11-12T19:36:43Z")

</div>

hi guys, let’s say I have different paths from a vector file, and I want them to be all the vertices evolving in clockwise direction how there are now how I want them to be what I have done so far is: I have alr…

---

## [Touchscreen Question](https://discourse.processing.org/t/touchscreen-question/15405)

<div class="topic-metadata">

**Author:** [@Ladan](https://discourse.processing.org/u/Ladan)\
**Replies:** 10\
**Last updated:** [November 12, 2019, 3:11pm UTC](https://discourse.processing.org/t/touchscreen-question/15405 "2019-11-12T15:11:57Z")

</div>

I haave written a programm, in which you can click buttons, and a text will appear. Now, I have to know, if MousePressed() works on a touchscreen monitor, that means you dont click the mouse, but you tap the screen. @kl…

---

## [Problem with Bezier Curves when exporting SVG from illustrator,](https://discourse.processing.org/t/problem-with-bezier-curves-when-exporting-svg-from-illustrator/15232)

<div class="topic-metadata">

**Author:** [@jeykech](https://discourse.processing.org/u/jeykech)\
**Replies:** 4\
**Last updated:** [November 6, 2019, 3:19pm UTC](https://discourse.processing.org/t/problem-with-bezier-curves-when-exporting-svg-from-illustrator/15232 "2019-11-06T15:19:16Z")

</div>

hi all, I came across this little problem: when exporting a bezier curve as svg from illustrator and then importing it to processing, the control points are considered as vertices, does anyone know how to access anchor …

---

## [Glowy ellipses using javaFX bloom \[MULTIPLE QUESTIONS\]](https://discourse.processing.org/t/glowy-ellipses-using-javafx-bloom-multiple-questions/15156)

<div class="topic-metadata">

**Author:** [@FilDomInteractive](https://discourse.processing.org/u/FilDomInteractive)\
**Replies:** 27\
**Last updated:** [November 11, 2019, 9:38pm UTC](https://discourse.processing.org/t/glowy-ellipses-using-javafx-bloom-multiple-questions/15156 "2019-11-11T21:38:36Z")

</div>

Multiple questions \> How to make glowy ellipses using javaFX bloom? How to make ellipse motion effect that it fades in to the ellipse? Thank you EDIT : And how to import javafx bloom library?

---

## [A JSONArray text must start with '\[' Error](https://discourse.processing.org/t/a-jsonarray-text-must-start-with-error/15389)

<div class="topic-metadata">

**Author:** [@KeirMeDear](https://discourse.processing.org/u/KeirMeDear)\
**Replies:** 2\
**Last updated:** [November 11, 2019, 9:25pm UTC](https://discourse.processing.org/t/a-jsonarray-text-must-start-with-error/15389 "2019-11-11T21:25:50Z")

</div>

Hey, So I’m trying to get to grips using JSON with processing and I’m having a couple of problems. Currently I’ve created a piece of code which uses the Runescape API to loop through a list of known in game item id’s (…

---

## [Key and mouse pressed with boolean](https://discourse.processing.org/t/key-and-mouse-pressed-with-boolean/15274)

<div class="topic-metadata">

**Author:** [@vincentstrebelle](https://discourse.processing.org/u/vincentstrebelle)\
**Replies:** 13\
**Last updated:** [November 11, 2019, 8:30pm UTC](https://discourse.processing.org/t/key-and-mouse-pressed-with-boolean/15274 "2019-11-11T20:30:51Z")

</div>

Hi, i wonder if it’s possible to use a boolean with the code proposed by @tutantontut import processing.event.MouseEvent; boolean\[\] mouses = new boolean\[2\]; boolean pressLeft = true; boolean pressRight = true; boolean …

---

## [Background(image) not working](https://discourse.processing.org/t/background-image-not-working/14305)

<div class="topic-metadata">

**Author:** [@Ladan](https://discourse.processing.org/u/Ladan)\
**Replies:** 73\
**Last updated:** [November 11, 2019, 7:58pm UTC](https://discourse.processing.org/t/background-image-not-working/14305 "2019-11-11T19:58:25Z")

</div>

I have written this code: void Setup(){ size(1920, 1080); PImage img; img = loadImage("desktop-wallpaper-9.jpg"); background(img); } and it just opens this window:

---

## [How do I move an object upwards?](https://discourse.processing.org/t/how-do-i-move-an-object-upwards/15288)

<div class="topic-metadata">

**Author:** [@ImConfused](https://discourse.processing.org/u/ImConfused)\
**Replies:** 3\
**Last updated:** [November 11, 2019, 7:48pm UTC](https://discourse.processing.org/t/how-do-i-move-an-object-upwards/15288 "2019-11-11T19:48:15Z")

</div>

I need help I’m doing this project and I don’t know how to move the object upwards.

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

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