# Coding Questions

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

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

**Page:** 65

---

## [For structure not generating shapes](https://discourse.processing.org/t/for-structure-not-generating-shapes/27153)

<div class="topic-metadata">

**Author:** [@Townhaus](https://discourse.processing.org/u/Townhaus)\
**Replies:** 3\
**Last updated:** [January 24, 2021, 9:32am UTC](https://discourse.processing.org/t/for-structure-not-generating-shapes/27153 "2021-01-24T09:32:28Z")

</div>

/\* the first for structure generates rectangles but I’m not sure why the second for structure doesn’t generate rectangles \*/ size (500, 600); background (115, 10, 125); int x = 0; noStroke (); for (int i = 250; i \<=…

---

## [15 coins game - pls help im stuck](https://discourse.processing.org/t/15-coins-game-pls-help-im-stuck/27268)

<div class="topic-metadata">

**Author:** [@Grave](https://discourse.processing.org/u/Grave)\
**Replies:** 2\
**Last updated:** [January 23, 2021, 6:56am UTC](https://discourse.processing.org/t/15-coins-game-pls-help-im-stuck/27268 "2021-01-23T06:56:47Z")

</div>

How can I make the class Candy disappear when Eyeball touch it? String gameState; PImage sc; // SCARLET FOREST void setup() { size(810, 810); eyeballSetup(); for(int i=0;i\<candies.length;i++){ candies\[i\] = new Can…

---

## [Undo and Redo Button](https://discourse.processing.org/t/undo-and-redo-button/27301)

<div class="topic-metadata">

**Author:** [@Prxt.3k](https://discourse.processing.org/u/Prxt.3k)\
**Replies:** 4\
**Last updated:** [January 23, 2021, 5:59am UTC](https://discourse.processing.org/t/undo-and-redo-button/27301 "2021-01-23T05:59:57Z")

</div>

// Press CTRL+Z to undo, CTRL+SHIFT+Z to redo // We need these to know if CTRL/SHIFT are pressed boolean controlDown = false; boolean shiftDown = false; Undo undo; void setup() { size(500, 500); background(255); …

---

## [Adding a Start Screen to my drawing program](https://discourse.processing.org/t/adding-a-start-screen-to-my-drawing-program/27290)

<div class="topic-metadata">

**Author:** [@Prxt.3k](https://discourse.processing.org/u/Prxt.3k)\
**Replies:** 5\
**Last updated:** [January 23, 2021, 5:18am UTC](https://discourse.processing.org/t/adding-a-start-screen-to-my-drawing-program/27290 "2021-01-23T05:18:14Z")

</div>

Can someone let me know how it’s possible to add this to my code, for example, I want to add a start game button in this code and this screen should pop up every time I start a canvas and to enter the program I would nee…

---

## [Different function to every ellipse](https://discourse.processing.org/t/different-function-to-every-ellipse/27289)

<div class="topic-metadata">

**Author:** [@Karrajo](https://discourse.processing.org/u/Karrajo)\
**Replies:** 3\
**Last updated:** [January 22, 2021, 10:04pm UTC](https://discourse.processing.org/t/different-function-to-every-ellipse/27289 "2021-01-22T22:04:04Z")

</div>

Hi, I’m doing this thing, trying to make every ellipse appear and disappear with the same function but in a different time, like if every ellipse is in a different moment of the sine function. I can write the function a…

---

## [How can I web scrape to get images from different websites using processing?](https://discourse.processing.org/t/how-can-i-web-scrape-to-get-images-from-different-websites-using-processing/22052)

<div class="topic-metadata">

**Author:** [@usr-pyth](https://discourse.processing.org/u/usr-pyth)\
**Replies:** 2\
**Last updated:** [January 22, 2021, 12:19am UTC](https://discourse.processing.org/t/how-can-i-web-scrape-to-get-images-from-different-websites-using-processing/22052 "2021-01-22T00:19:52Z")

</div>

Hi! I’m trying to get images from reddit and load them into my processing sketch. How do I do this?

---

## [PG Graphics not working - bet you can't work this out!](https://discourse.processing.org/t/pg-graphics-not-working-bet-you-cant-work-this-out/27250)

<div class="topic-metadata">

**Author:** [@IRIGIMA](https://discourse.processing.org/u/IRIGIMA)\
**Replies:** 9\
**Last updated:** [January 21, 2021, 6:32pm UTC](https://discourse.processing.org/t/pg-graphics-not-working-bet-you-cant-work-this-out/27250 "2021-01-21T18:32:37Z")

</div>

I want to create pg graphics size x,y in black. In middle I want a non black point. Randomly searching through all pg graphics, I want to find this point in a routine iterating over and over. Once found - return that …

---

## [Error: NullPointerException](https://discourse.processing.org/t/error-nullpointerexception/27251)

<div class="topic-metadata">

**Author:** [@christiank79](https://discourse.processing.org/u/christiank79)\
**Replies:** 1\
**Last updated:** [January 20, 2021, 9:36pm UTC](https://discourse.processing.org/t/error-nullpointerexception/27251 "2021-01-20T21:36:44Z")

</div>

Hello, I have a problem to solve this coding in Java in 16th line, show me an error: NullPointerException. What can I do? Below is the code: import processing.svg.\*; PImage img; float theta= 31; float k = 11; float r =…

---

## [Player Health & Collision not working properly together](https://discourse.processing.org/t/player-health-collision-not-working-properly-together/27244)

<div class="topic-metadata">

**Author:** [@vvitch](https://discourse.processing.org/u/vvitch)\
**Replies:** 3\
**Last updated:** [January 20, 2021, 9:25pm UTC](https://discourse.processing.org/t/player-health-collision-not-working-properly-together/27244 "2021-01-20T21:25:41Z")

</div>

For some reason, in the game that I am attempting to make for a class project whenever the player hits an asteroid at speed, the playerHealth variable goes down by multiple numbers instead of by one. The below are functi…

---

## [Help needed please in code](https://discourse.processing.org/t/help-needed-please-in-code/27241)

<div class="topic-metadata">

**Author:** [@IRIGIMA](https://discourse.processing.org/u/IRIGIMA)\
**Replies:** 6\
**Last updated:** [January 20, 2021, 5:54pm UTC](https://discourse.processing.org/t/help-needed-please-in-code/27241 "2021-01-20T17:54:56Z")

</div>

Within setup and main. I am creating a pg graphics at x,y resolution, placing a value in centre. Then randomly choosing a point. If the point = centre then x,y found. Wth am I doing wrong?? PGraphics pg; float col=10; …

---

## [Can anyone help me with collision for player (Platformer)](https://discourse.processing.org/t/can-anyone-help-me-with-collision-for-player-platformer/27164)

<div class="topic-metadata">

**Author:** [@deiwy](https://discourse.processing.org/u/deiwy)\
**Replies:** 2\
**Last updated:** [January 20, 2021, 5:34pm UTC](https://discourse.processing.org/t/can-anyone-help-me-with-collision-for-player-platformer/27164 "2021-01-20T17:34:58Z")

</div>

player p; ArrayList\<Platform\> platforms = new ArrayList(); boolean\[\] keys = new boolean\[2\]; int\[\]\[\] map = { {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, {1, 1, 1, 0, 0, 1, 0, 0, 0…

---

## [Timer after button pressed](https://discourse.processing.org/t/timer-after-button-pressed/27209)

<div class="topic-metadata">

**Author:** [@saaqib.m](https://discourse.processing.org/u/saaqib.m)\
**Replies:** 9\
**Last updated:** [January 19, 2021, 10:24pm UTC](https://discourse.processing.org/t/timer-after-button-pressed/27209 "2021-01-19T22:24:53Z")

</div>

please format code with \</\> button \* homework policy \* asking questions After I run a program, I want my timer to start. Currently I am using millis()/1000 just for the seconds but I want to make the timer so that it…

---

## [Replace words with different synonyms and print each combination in a text file](https://discourse.processing.org/t/replace-words-with-different-synonyms-and-print-each-combination-in-a-text-file/27110)

<div class="topic-metadata">

**Author:** [@Sophie](https://discourse.processing.org/u/Sophie)\
**Replies:** 17\
**Last updated:** [January 18, 2021, 9:23am UTC](https://discourse.processing.org/t/replace-words-with-different-synonyms-and-print-each-combination-in-a-text-file/27110 "2021-01-18T09:23:58Z")

</div>

Hello, My goal is to replace words from a String with synonyms. Right now the code can replace one word with another one and write the sentence in my text file. But I would like to have different opportunities to replac…

---

## [Replace first character of string](https://discourse.processing.org/t/replace-first-character-of-string/27000)

<div class="topic-metadata">

**Author:** [@vestergaard12](https://discourse.processing.org/u/vestergaard12)\
**Replies:** 21\
**Last updated:** [January 19, 2021, 11:01am UTC](https://discourse.processing.org/t/replace-first-character-of-string/27000 "2021-01-19T11:01:27Z")

</div>

Hello Processing Foundation I have this coding question, which I really hope someone will help me to solve: This is my code so far: String\[\] words = {"hello", "how", "helicopter", "who", "which", "that", "okay"}; //ju…

---

## [Moved PImage from one side to the screen to another in loop](https://discourse.processing.org/t/moved-pimage-from-one-side-to-the-screen-to-another-in-loop/27194)

<div class="topic-metadata">

**Author:** [@mchangxe](https://discourse.processing.org/u/mchangxe)\
**Replies:** 4\
**Last updated:** [January 20, 2021, 2:52am UTC](https://discourse.processing.org/t/moved-pimage-from-one-side-to-the-screen-to-another-in-loop/27194 "2021-01-20T02:52:53Z")

</div>

Hi guys, i want to move an image across the screen from right to the left. However, one complication is that when part of the image moves beyond the left side of the screen, i want it to show up on the right side of the…

---

## [Update screen immediately](https://discourse.processing.org/t/update-screen-immediately/26856)

<div class="topic-metadata">

**Author:** [@edumanilha](https://discourse.processing.org/u/edumanilha)\
**Replies:** 9\
**Last updated:** [January 19, 2021, 11:45pm UTC](https://discourse.processing.org/t/update-screen-immediately/26856 "2021-01-19T23:45:07Z")

</div>

Hi everyone! How are you people doing? I need some help… I put a button on my script to change some values on screen, but I set framerate to update every second, so every time I click the value take some time to update…

---

## [Screenshot with CTRL + S](https://discourse.processing.org/t/screenshot-with-ctrl-s/27203)

<div class="topic-metadata">

**Author:** [@Lukerfull](https://discourse.processing.org/u/Lukerfull)\
**Replies:** 4\
**Last updated:** [January 19, 2021, 6:36pm UTC](https://discourse.processing.org/t/screenshot-with-ctrl-s/27203 "2021-01-19T18:36:17Z")

</div>

Hi, I’ve been struggling with this for a long time today. I’m trying to make screenshots with ctrl and s but it doesn’t work. Can anyone help me? Thanks. This is what I tried: boolean ctrlPressed; void keyPressed() { …

---

## [Sketch GUI in different Operating Systems](https://discourse.processing.org/t/sketch-gui-in-different-operating-systems/27176)

<div class="topic-metadata">

**Author:** [@r.jaoui](https://discourse.processing.org/u/r.jaoui)\
**Replies:** 2\
**Last updated:** [January 19, 2021, 5:12pm UTC](https://discourse.processing.org/t/sketch-gui-in-different-operating-systems/27176 "2021-01-19T17:12:01Z")

</div>

Hello ! Alright so I’ve been trying to work with OpenGL recently, writing and executing shaders… But another issue that I’m facing is that having a resizable P2D sketch isn’t actually that simple, the resizing is very b…

---

## [Highlighting tiles in range x](https://discourse.processing.org/t/highlighting-tiles-in-range-x/27193)

<div class="topic-metadata">

**Author:** [@lancelot](https://discourse.processing.org/u/lancelot)\
**Replies:** 4\
**Last updated:** [January 19, 2021, 4:15pm UTC](https://discourse.processing.org/t/highlighting-tiles-in-range-x/27193 "2021-01-19T16:15:45Z")

</div>

please format code with \</\> button \* homework policy \* asking questions Hello everybody, I’ve been working on this code a few days, and I’m out of ideas. My goal is to highlight tiles inside of the movement range. I…

---

## [Why is my Ico-Sphere not a Sphere](https://discourse.processing.org/t/why-is-my-ico-sphere-not-a-sphere/27190)

<div class="topic-metadata">

**Author:** [@JALAJ\_0106](https://discourse.processing.org/u/JALAJ_0106)\
**Replies:** 3\
**Last updated:** [January 19, 2021, 2:46pm UTC](https://discourse.processing.org/t/why-is-my-ico-sphere-not-a-sphere/27190 "2021-01-19T14:46:59Z")

</div>

please format code with \</\> button \* homework policy \* asking questions \<public class isoSphere { Icosehedron ico = new Icosehedron(); ArrayList vNew; ArrayList cul; ArrayList vecL = new ArrayList(); ArrayList d…

---

## [Write a string in multiple code lines](https://discourse.processing.org/t/write-a-string-in-multiple-code-lines/27196)

<div class="topic-metadata">

**Author:** [@JonasAvory1](https://discourse.processing.org/u/JonasAvory1)\
**Replies:** 5\
**Last updated:** [January 19, 2021, 1:15pm UTC](https://discourse.processing.org/t/write-a-string-in-multiple-code-lines/27196 "2021-01-19T13:15:48Z")

</div>

So, I’m trying to write a simple HTML server with processing (I know processing isn’t the best program to use, but I didn’t want to learn a new tool). The String my server’s supposed to send back is very long, so I want…

---

## [Record your programm?](https://discourse.processing.org/t/record-your-programm/27175)

<div class="topic-metadata">

**Author:** [@NumericPrime](https://discourse.processing.org/u/NumericPrime)\
**Replies:** 3\
**Last updated:** [January 18, 2021, 8:17pm UTC](https://discourse.processing.org/t/record-your-programm/27175 "2021-01-18T20:17:49Z")

</div>

I have written a programm, that paints images using epicycles and now I want to record it. However everything I managed to find was recording videos using a cam. Could you help me with this?

---

## [How should i create a permanent reference to an object](https://discourse.processing.org/t/how-should-i-create-a-permanent-reference-to-an-object/27162)

<div class="topic-metadata">

**Author:** [@canslp](https://discourse.processing.org/u/canslp)\
**Replies:** 5\
**Last updated:** [January 18, 2021, 4:46pm UTC](https://discourse.processing.org/t/how-should-i-create-a-permanent-reference-to-an-object/27162 "2021-01-18T16:46:53Z")

</div>

okay so i’ve recently learned that there are no formal pointers in javascript(??) what’s the best way to create a permanent reference to a dynamic object? i have a class in a game called ‘level’ that has all the informat…

---

## [Beginner question, changing background in pong when ball hits paddle](https://discourse.processing.org/t/beginner-question-changing-background-in-pong-when-ball-hits-paddle/27158)

<div class="topic-metadata">

**Author:** [@lucyteio](https://discourse.processing.org/u/lucyteio)\
**Replies:** 2\
**Last updated:** [January 18, 2021, 2:59pm UTC](https://discourse.processing.org/t/beginner-question-changing-background-in-pong-when-ball-hits-paddle/27158 "2021-01-18T14:59:00Z")

</div>

Hello to all I have an assignment for art school. we have been given the pong game and we must change the code to create a story… I wish to change the background each time the pong hits a paddle. any help would be grat…

---

## [Process folder of PNGs after quicksorting pixels?](https://discourse.processing.org/t/process-folder-of-pngs-after-quicksorting-pixels/27104)

<div class="topic-metadata">

**Author:** [@polokus](https://discourse.processing.org/u/polokus)\
**Replies:** 1\
**Last updated:** [January 18, 2021, 10:33am UTC](https://discourse.processing.org/t/process-folder-of-pngs-after-quicksorting-pixels/27104 "2021-01-18T10:33:18Z")

</div>

Hi everyone! So I’m sort of new to Processing / coding and am having a great time, but stuck at a bit of a hurdle here. I’ve made a modified version of one of these pixel sorting projects by volfegan (specifically the …

---

## [\[NOOB\] Making a sinewave clock](https://discourse.processing.org/t/noob-making-a-sinewave-clock/27154)

<div class="topic-metadata">

**Author:** [@arazym](https://discourse.processing.org/u/arazym)\
**Replies:** 0\
**Last updated:** [January 18, 2021, 5:08am UTC](https://discourse.processing.org/t/noob-making-a-sinewave-clock/27154 "2021-01-18T05:08:03Z")

</div>

Hi there, i am trying to make a clock that displays time in an abstract way, I want to use sine waves that resemble seconds,minutes,hours,day,month,year. I wanted to display this via various frequencies. I found follow…

---

## [Fruit is not being eaten by Snake](https://discourse.processing.org/t/fruit-is-not-being-eaten-by-snake/27132)

<div class="topic-metadata">

**Author:** [@Learning-Everyday](https://discourse.processing.org/u/Learning-Everyday)\
**Replies:** 3\
**Last updated:** [January 17, 2021, 10:05pm UTC](https://discourse.processing.org/t/fruit-is-not-being-eaten-by-snake/27132 "2021-01-17T22:05:43Z")

</div>

Hi, I am a beginner in Processing and am having an issue where snakes isn’t eating the fruit. Could you assist with fixing this bug. Thanks in advance Provided below is the code =====================================…

---

## [Checking for a point within a 2D shape (v3.5)](https://discourse.processing.org/t/checking-for-a-point-within-a-2d-shape-v3-5/26874)

<div class="topic-metadata">

**Author:** [@Anon0908](https://discourse.processing.org/u/Anon0908)\
**Replies:** 17\
**Last updated:** [January 17, 2021, 9:59pm UTC](https://discourse.processing.org/t/checking-for-a-point-within-a-2d-shape-v3-5/26874 "2021-01-17T21:59:50Z")

</div>

Say I have a convex polygon and the coordinates of its vertices. Say I wish to check if a coordinate point is within that polygon. How do I do this without an absurd amount of rectangles? My idea is adding the coordinat…

---

## [Use millis to display real time](https://discourse.processing.org/t/use-millis-to-display-real-time/27144)

<div class="topic-metadata">

**Author:** [@saaqib.m](https://discourse.processing.org/u/saaqib.m)\
**Replies:** 7\
**Last updated:** [January 17, 2021, 8:38pm UTC](https://discourse.processing.org/t/use-millis-to-display-real-time/27144 "2021-01-17T20:38:04Z")

</div>

please format code with \</\> button \* homework policy \* asking questions How do I use millis() to display a real time clock? Just a simple hh:mm:ss:ms time display. ms is the milliseconds for every second. If it works…

---

## [Why is frameRate limited when Processing runs in a window?](https://discourse.processing.org/t/why-is-framerate-limited-when-processing-runs-in-a-window/23719)

<div class="topic-metadata">

**Author:** [@Shwaa](https://discourse.processing.org/u/Shwaa)\
**Replies:** 0\
**Last updated:** [September 6, 2020, 10:55pm UTC](https://discourse.processing.org/t/why-is-framerate-limited-when-processing-runs-in-a-window/23719 "2020-09-06T22:55:19Z")

</div>

I’m working on a project in P3D, and I noticed something about performance when the window isn’t focused: the framerate immediately jumps up. I’m working on a relatively beefy PC, so I don’t consider myself limited by pe…

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

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