# Coding Questions

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

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

**Page:** 155

---

## [Erase part of PGraphics image to transparent](https://discourse.processing.org/t/erase-part-of-pgraphics-image-to-transparent/7605)

<div class="topic-metadata">

**Author:** [@ottenm](https://discourse.processing.org/u/ottenm)\
**Replies:** 4\
**Last updated:** [January 19, 2019, 12:01pm UTC](https://discourse.processing.org/t/erase-part-of-pgraphics-image-to-transparent/7605 "2019-01-19T12:01:54Z")

</div>

Any help cutting/cropping out part of a PGraphics image, leaving behind a transparent rectangle? I tried the code below, but it just adds a transparent rectangle on top (no visual change to the underlying image). I did…

---

## [Set present background colour](https://discourse.processing.org/t/set-present-background-colour/6957)

<div class="topic-metadata">

**Author:** [@garrettlynch](https://discourse.processing.org/u/garrettlynch)\
**Replies:** 4\
**Last updated:** [January 18, 2019, 3:07pm UTC](https://discourse.processing.org/t/set-present-background-colour/6957 "2019-01-18T15:07:26Z")

</div>

I’m trying to set the present background colour of a sketch’s second window launched through PApplet.runSketch(), however nothing I’ve tried works. I don’t want to set processing’s background preference for all sketches…

---

## [Problem with overlapping balls](https://discourse.processing.org/t/problem-with-overlapping-balls/7588)

<div class="topic-metadata">

**Author:** [@bjente](https://discourse.processing.org/u/bjente)\
**Replies:** 6\
**Last updated:** [January 17, 2019, 12:30pm UTC](https://discourse.processing.org/t/problem-with-overlapping-balls/7588 "2019-01-17T12:30:10Z")

</div>

Hello all, I’m kinda new to processing and I’m doing some exercises to get the hang of it. Right now I’m writing a little script which draws balls to the screen. If the balls overlap, I want the color of the current bal…

---

## [Mutator not mutating](https://discourse.processing.org/t/mutator-not-mutating/7553)

<div class="topic-metadata">

**Author:** [@LordCacops](https://discourse.processing.org/u/LordCacops)\
**Replies:** 2\
**Last updated:** [January 17, 2019, 10:27am UTC](https://discourse.processing.org/t/mutator-not-mutating/7553 "2019-01-17T10:27:32Z")

</div>

Howdy! I wrote this program to mutate colors on a grid, where there’s a probability of an offspring grid inheriting each square from its parent grid, or mutating it into a randomized color. …but I cannot get it to work…

---

## [The file is missing or Inaccessible](https://discourse.processing.org/t/the-file-is-missing-or-inaccessible/2996)

<div class="topic-metadata">

**Author:** [@Hedgy](https://discourse.processing.org/u/Hedgy)\
**Replies:** 20\
**Last updated:** [January 17, 2019, 4:09am UTC](https://discourse.processing.org/t/the-file-is-missing-or-inaccessible/2996 "2019-01-17T04:09:38Z")

</div>

Hello. I have files that are required for my game, I have added them to the data folder and yet it says they are still missing or inaccessible. I have checked that the names are the same. I don’t understand why it doesn’…

---

## [I really need help! to make a quiz](https://discourse.processing.org/t/i-really-need-help-to-make-a-quiz/7431)

<div class="topic-metadata">

**Author:** [@lchute03](https://discourse.processing.org/u/lchute03)\
**Replies:** 4\
**Last updated:** [January 16, 2019, 9:19pm UTC](https://discourse.processing.org/t/i-really-need-help-to-make-a-quiz/7431 "2019-01-16T21:19:36Z")

</div>

I’m brand new to processing, completely new. ‘I’m 15 and learning it in class’ type new. My teacher doesnt know a thing about what im doing, but I want to finish this if possible. I’m trying to make a quiz, essentially.…

---

## [Text, go to the next line after finding a certain character](https://discourse.processing.org/t/text-go-to-the-next-line-after-finding-a-certain-character/7057)

<div class="topic-metadata">

**Author:** [@bitCrasher](https://discourse.processing.org/u/bitCrasher)\
**Replies:** 4\
**Last updated:** [January 1, 2019, 12:08am UTC](https://discourse.processing.org/t/text-go-to-the-next-line-after-finding-a-certain-character/7057 "2019-01-01T00:08:21Z")

</div>

Hi guys, I’m going crazy on something really stupid, but I just can not solve it. I would like to wrap after I’ve found a specific character. the code I am using is this: String\[\] lines; String randText; void setup…

---

## [Resizable window with constrained proportions](https://discourse.processing.org/t/resizable-window-with-constrained-proportions/7536)

<div class="topic-metadata">

**Author:** [@Sarah](https://discourse.processing.org/u/Sarah)\
**Replies:** 6\
**Last updated:** [January 16, 2019, 9:03am UTC](https://discourse.processing.org/t/resizable-window-with-constrained-proportions/7536 "2019-01-16T09:03:56Z")

</div>

When I need the canvas to be resizable I use surface.setResizable(true);. However, I need to keep the width and height equal and can’t seem to find a way to apply constraints to do so. I initially tried to manually set …

---

## [Can't see the missing curly bracket](https://discourse.processing.org/t/cant-see-the-missing-curly-bracket/7135)

<div class="topic-metadata">

**Author:** [@losferatos](https://discourse.processing.org/u/losferatos)\
**Replies:** 4\
**Last updated:** [January 15, 2019, 10:55pm UTC](https://discourse.processing.org/t/cant-see-the-missing-curly-bracket/7135 "2019-01-15T22:55:38Z")

</div>

Hi there! I have a very short code that should clean up a dump file, but I get continuously errors because there’s a missing “{” and after 1h of frustrated staring, I need your help =) ArrayList\<String\> rough = new Arr…

---

## [\[SOLVED\] Best way to store words count?](https://discourse.processing.org/t/solved-best-way-to-store-words-count/7031)

<div class="topic-metadata">

**Author:** [@Architector\_4](https://discourse.processing.org/u/Architector_4)\
**Replies:** 5\
**Last updated:** [January 15, 2019, 4:58pm UTC](https://discourse.processing.org/t/solved-best-way-to-store-words-count/7031 "2019-01-15T16:58:04Z")

</div>

So I’m making a thing that counts how many times each word is present in a given String, but I’m not sure what would be the most efficient way to store the values. Right now, the first way to store them that came to my …

---

## [Compare 2 IntList without 'for'?](https://discourse.processing.org/t/compare-2-intlist-without-for/7035)

<div class="topic-metadata">

**Author:** [@amaia](https://discourse.processing.org/u/amaia)\
**Replies:** 8\
**Last updated:** [January 15, 2019, 4:54pm UTC](https://discourse.processing.org/t/compare-2-intlist-without-for/7035 "2019-01-15T16:54:25Z")

</div>

Hello! I want to compare 2 IntList; I’ve tried to compare them without using the for loop, something like this: IntList ordered; IntList disordered; void setup() { size(200, 200); ordered = new IntList(); ordere…

---

## [Virtual dice dots not being drawn](https://discourse.processing.org/t/virtual-dice-dots-not-being-drawn/7508)

<div class="topic-metadata">

**Author:** [@Harie](https://discourse.processing.org/u/Harie)\
**Replies:** 4\
**Last updated:** [January 15, 2019, 2:11pm UTC](https://discourse.processing.org/t/virtual-dice-dots-not-being-drawn/7508 "2019-01-15T14:11:31Z")

</div>

I can’t figure out why the dots aren’t being drawn after the random variable is decided. Please help. The point is to make the die “roll around” 7 times slower each time, and then stopping. //LED Dice Virtual Simulation…

---

## [Delete one shape and add another or moving shapes](https://discourse.processing.org/t/delete-one-shape-and-add-another-or-moving-shapes/7503)

<div class="topic-metadata">

**Author:** [@mizu](https://discourse.processing.org/u/mizu)\
**Replies:** 4\
**Last updated:** [January 15, 2019, 12:47pm UTC](https://discourse.processing.org/t/delete-one-shape-and-add-another-or-moving-shapes/7503 "2019-01-15T12:47:08Z")

</div>

float radius; void setup() { size(1440, 900); } int clicks=0; int screen = 0; float counter; void draw() { float l= random(1380); float r= random(640); if (clicks==clicks+1) background(0); radius=30; …

---

## [PImage to base64](https://discourse.processing.org/t/pimage-to-base64/7041)

<div class="topic-metadata">

**Author:** [@lmccandless](https://discourse.processing.org/u/lmccandless)\
**Replies:** 2\
**Last updated:** [January 15, 2019, 12:23am UTC](https://discourse.processing.org/t/pimage-to-base64/7041 "2019-01-15T00:23:55Z")

</div>

This code works to load a png file and make a base64 string, but I want to go directly from a pgraphics pixels\[\] array to a base64 string. public static String encoder(String imagePath) { String base64Image = ""; Fi…

---

## [In P3D mode images not transparent when textSize \> 35 is used](https://discourse.processing.org/t/in-p3d-mode-images-not-transparent-when-textsize-35-is-used/7138)

<div class="topic-metadata">

**Author:** [@companje](https://discourse.processing.org/u/companje)\
**Replies:** 1\
**Last updated:** [January 14, 2019, 10:54pm UTC](https://discourse.processing.org/t/in-p3d-mode-images-not-transparent-when-textsize-35-is-used/7138 "2019-01-14T22:54:26Z")

</div>

Hi, I noticed that when using a font size larger than 35 in P3D mode images stop being transparent. Is this a known bug? Does anyone know a workaround for this? I’m running Processing 3.4 on Windows 10. PImage bg, fg; …

---

## ["getImageData is not a function" error when using P3D processing.js](https://discourse.processing.org/t/getimagedata-is-not-a-function-error-when-using-p3d-processing-js/7505)

<div class="topic-metadata">

**Author:** [@Heiwan](https://discourse.processing.org/u/Heiwan)\
**Replies:** 1\
**Last updated:** [January 14, 2019, 7:38pm UTC](https://discourse.processing.org/t/getimagedata-is-not-a-function-error-when-using-p3d-processing-js/7505 "2019-01-14T19:38:40Z")

</div>

Hello. I am trying to display one of my processing sketches in the browser with processing.js and it works fine both from processing “Run” and the browser when I am using size(1900,1200), but when I add P3D to size(), t…

---

## [Image array For loop position variation](https://discourse.processing.org/t/image-array-for-loop-position-variation/6938)

<div class="topic-metadata">

**Author:** [@rcargb](https://discourse.processing.org/u/rcargb)\
**Replies:** 5\
**Last updated:** [January 13, 2019, 6:28pm UTC](https://discourse.processing.org/t/image-array-for-loop-position-variation/6938 "2019-01-13T18:28:03Z")

</div>

Pretty simple, I want to create subtle variation in position in the X and Y axis using noise() on a PImage. I’ve messed around with the pull and pop matrix with no luck. Any help is appreciated. void noize(){ jpg.load…

---

## [Sorting an array of dates as strings](https://discourse.processing.org/t/sorting-an-array-of-dates-as-strings/7487)

<div class="topic-metadata">

**Author:** [@epicwyvern](https://discourse.processing.org/u/epicwyvern)\
**Replies:** 1\
**Last updated:** [January 14, 2019, 4:08am UTC](https://discourse.processing.org/t/sorting-an-array-of-dates-as-strings/7487 "2019-01-14T04:08:35Z")

</div>

Hello guys, i need help with a specific problem regarding sorting i have run into for my program. say i have the following text file that contains first and last names, with the third row consisting of dates Carrie,Wil…

---

## [PShape GROUP weirdness](https://discourse.processing.org/t/pshape-group-weirdness/7462)

<div class="topic-metadata">

**Author:** [@Aleksi](https://discourse.processing.org/u/Aleksi)\
**Replies:** 8\
**Last updated:** [January 14, 2019, 1:41pm UTC](https://discourse.processing.org/t/pshape-group-weirdness/7462 "2019-01-14T13:41:31Z")

</div>

I stumbled upon a really nice effect by accident duplicating shapes inside a PShape GROUP. But when I tried to control it I discovered that I can’t because of some weirdness I can’t work around. I figured that each new …

---

## [Gradient Color Control](https://discourse.processing.org/t/gradient-color-control/7449)

<div class="topic-metadata">

**Author:** [@uforange](https://discourse.processing.org/u/uforange)\
**Replies:** 3\
**Last updated:** [January 13, 2019, 5:23pm UTC](https://discourse.processing.org/t/gradient-color-control/7449 "2019-01-13T17:23:51Z")

</div>

Hello, For a gradient example of Illustrator or Photoshop, we can easily change the center point of two colors. I am trying to make a similar thing in Processing. What I’ve tried in my code is: When mouseX is 0, the …

---

## [Lowercase so that letters after periods are left capital](https://discourse.processing.org/t/lowercase-so-that-letters-after-periods-are-left-capital/7461)

<div class="topic-metadata">

**Author:** [@Dudez01](https://discourse.processing.org/u/Dudez01)\
**Replies:** 6\
**Last updated:** [January 13, 2019, 6:34pm UTC](https://discourse.processing.org/t/lowercase-so-that-letters-after-periods-are-left-capital/7461 "2019-01-13T18:34:03Z")

</div>

Hey everyone! I am a pretty new Processing user as we use it in my programming class and was introduced to it then. In our new unit, we have been given a series of practice problem solving questions and I am stumped on t…

---

## [Connected Circles](https://discourse.processing.org/t/connected-circles/7471)

<div class="topic-metadata">

**Author:** [@german\_guy](https://discourse.processing.org/u/german_guy)\
**Replies:** 2\
**Last updated:** [January 13, 2019, 5:27pm UTC](https://discourse.processing.org/t/connected-circles/7471 "2019-01-13T17:27:30Z")

</div>

Hey, this is a task that I have to solve for a course at uni. It’s processing for beginners. We use Processing 3. What do I do to connect each circle at y = 100 with those at y = 550? Apparently, a nested loop is a sol…

---

## [Pixel sorting problem](https://discourse.processing.org/t/pixel-sorting-problem/7445)

<div class="topic-metadata">

**Author:** [@thrm](https://discourse.processing.org/u/thrm)\
**Replies:** 3\
**Last updated:** [January 13, 2019, 3:01pm UTC](https://discourse.processing.org/t/pixel-sorting-problem/7445 "2019-01-13T15:01:21Z")

</div>

Hi ! I’m very new to processing and I have a problem with a code I’m working on. I have written some of it, but now I’m stuck finishing it. I am working with pixel sorting of an image in processing 3.0 and I have writt…

---

## [Collision detection between avatar and 5 moving circles](https://discourse.processing.org/t/collision-detection-between-avatar-and-5-moving-circles/7466)

<div class="topic-metadata">

**Author:** [@lucadelagua](https://discourse.processing.org/u/lucadelagua)\
**Replies:** 3\
**Last updated:** [January 13, 2019, 2:41pm UTC](https://discourse.processing.org/t/collision-detection-between-avatar-and-5-moving-circles/7466 "2019-01-13T14:41:07Z")

</div>

Hey, I got a task from the university and I don’t know, why I cant detect the collision between my avatar with the 5 ghosts. some lines under voidDraw. Does anyone see the problem? Thanks :slight\_smile: Here is my Code…

---

## [So I am trying to make a Pacman kinda game](https://discourse.processing.org/t/so-i-am-trying-to-make-a-pacman-kinda-game/7358)

<div class="topic-metadata">

**Author:** [@captainmajere](https://discourse.processing.org/u/captainmajere)\
**Replies:** 2\
**Last updated:** [January 12, 2019, 9:48pm UTC](https://discourse.processing.org/t/so-i-am-trying-to-make-a-pacman-kinda-game/7358 "2019-01-12T21:48:35Z")

</div>

I am new to processing so I am trying to make a pacman kinda game. I want to make the small ball disappear and randomly spawn at another point in screen but I can’t specify the collision. How can I do that? Here is my …

---

## [\[SOLVED\] Gradient color with a mask](https://discourse.processing.org/t/solved-gradient-color-with-a-mask/7435)

<div class="topic-metadata">

**Author:** [@uforange](https://discourse.processing.org/u/uforange)\
**Replies:** 2\
**Last updated:** [January 12, 2019, 5:24pm UTC](https://discourse.processing.org/t/solved-gradient-color-with-a-mask/7435 "2019-01-12T17:24:02Z")

</div>

Hello, I am struggling with applying mask in my sketch. I’ve tried PGraphics, but I have no idea how to make it work. I would like to draw a particular shape(rect or ellipse or triangle) using mask on this gradient colo…

---

## [Translating horizontally inverted quads](https://discourse.processing.org/t/translating-horizontally-inverted-quads/7364)

<div class="topic-metadata">

**Author:** [@solub](https://discourse.processing.org/u/solub)\
**Replies:** 8\
**Last updated:** [January 12, 2019, 3:50pm UTC](https://discourse.processing.org/t/translating-horizontally-inverted-quads/7364 "2019-01-12T15:50:29Z")

</div>

A week ago I asked a question about translations and rotations in Processing. I wanted to: translate, invert and rotate a single quadrilateral (PShape object) multiple times then change the height of one of its 2 top…

---

## [Trail effect on waterfall issue](https://discourse.processing.org/t/trail-effect-on-waterfall-issue/7440)

<div class="topic-metadata">

**Author:** [@bertin](https://discourse.processing.org/u/bertin)\
**Replies:** 1\
**Last updated:** [January 12, 2019, 3:41pm UTC](https://discourse.processing.org/t/trail-effect-on-waterfall-issue/7440 "2019-01-12T15:41:56Z")

</div>

Hi all! I’m trying to implement a simple waterfall sketch, but I’m having an issue with how to show a trail effect on my drops object while moving acros the screen. Here is my code: import java.util.List; import java.ut…

---

## [Collating .tif images?](https://discourse.processing.org/t/collating-tif-images/7401)

<div class="topic-metadata">

**Author:** [@Bluu](https://discourse.processing.org/u/Bluu)\
**Replies:** 3\
**Last updated:** [January 11, 2019, 4:38pm UTC](https://discourse.processing.org/t/collating-tif-images/7401 "2019-01-11T16:38:54Z")

</div>

I have a script I’m using to capture frames(I made it simpler for understandability’s sake here, so I can’t change it, sorry :frowning: ). I’ve used the processing moviemaker tool in the past, but is there any way to use…

---

## [Interface and classes](https://discourse.processing.org/t/interface-and-classes/7331)

<div class="topic-metadata">

**Author:** [@bask185](https://discourse.processing.org/u/bask185)\
**Replies:** 4\
**Last updated:** [January 11, 2019, 2:09pm UTC](https://discourse.processing.org/t/interface-and-classes/7331 "2019-01-11T14:09:51Z")

</div>

I have several objects of different types which had to be stored in the same arrayList. I did this because most classes share similar functions. ArrayList \<Node\> objectArray = new ArrayList(); With an interface interf…

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

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