# Coding Questions

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

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

**Page:** 37

---

## [My RUN window has gone part off the pc screen!](https://discourse.processing.org/t/my-run-window-has-gone-part-off-the-pc-screen/34408)

<div class="topic-metadata">

**Author:** [@NigelWoollard](https://discourse.processing.org/u/NigelWoollard)\
**Replies:** 1\
**Last updated:** [January 2, 2022, 9:03am UTC](https://discourse.processing.org/t/my-run-window-has-gone-part-off-the-pc-screen/34408 "2022-01-02T09:03:03Z")

</div>

Some programs that I have written are running the active window off my screen (there is about a third of the height sticking down from the top off the screen . I have tried copy and pasting into a new file but this has n…

---

## [Make two characters change color after colliding](https://discourse.processing.org/t/make-two-characters-change-color-after-colliding/34230)

<div class="topic-metadata">

**Author:** [@mpsch](https://discourse.processing.org/u/mpsch)\
**Replies:** 8\
**Last updated:** [December 30, 2021, 2:51pm UTC](https://discourse.processing.org/t/make-two-characters-change-color-after-colliding/34230 "2021-12-30T14:51:46Z")

</div>

I want to make an animation to persuade people to get vaccinated for a school project. I want when a “person” that has red head which indicates that he is not vaccinated, gets in touch with the vaccine change his color t…

---

## [Multi Core Processing](https://discourse.processing.org/t/multi-core-processing/34366)

<div class="topic-metadata">

**Author:** [@IRIGIMA](https://discourse.processing.org/u/IRIGIMA)\
**Replies:** 1\
**Last updated:** [December 30, 2021, 11:16am UTC](https://discourse.processing.org/t/multi-core-processing/34366 "2021-12-30T11:16:41Z")

</div>

Hi. Does Processing support Multi Core ? Like if I had a 16 Core CPU, would my code run super fast ? Thanks in advance.

---

## [Issues exporting sketch to PDF: sketch gets cropped!](https://discourse.processing.org/t/issues-exporting-sketch-to-pdf-sketch-gets-cropped/34344)

<div class="topic-metadata">

**Author:** [@tommsmoro](https://discourse.processing.org/u/tommsmoro)\
**Replies:** 15\
**Last updated:** [December 29, 2021, 5:54pm UTC](https://discourse.processing.org/t/issues-exporting-sketch-to-pdf-sketch-gets-cropped/34344 "2021-12-29T17:54:40Z")

</div>

UPDATE: PROBLEM SOLVED The issue is that I was using pixelDensity(2). See full solution to the problem here: java - Issues exporting Processing sketch to PDF: sketch gets cropped - Stack Overflow ######## ORIGINAL POS…

---

## [Rect() function not working when used inside of a function inside of a class](https://discourse.processing.org/t/rect-function-not-working-when-used-inside-of-a-function-inside-of-a-class/34347)

<div class="topic-metadata">

**Author:** [@A\_game\_programmer](https://discourse.processing.org/u/A_game_programmer)\
**Replies:** 1\
**Last updated:** [December 29, 2021, 8:04am UTC](https://discourse.processing.org/t/rect-function-not-working-when-used-inside-of-a-function-inside-of-a-class/34347 "2021-12-29T08:04:15Z")

</div>

Can someone please clarify why the rect() function is not being called? I have checked it and code in the if function is being executed as normal, just functions to do with drawing are not working. public class FadeCu…

---

## [Creating a floor plan! urgent! final assignment due](https://discourse.processing.org/t/creating-a-floor-plan-urgent-final-assignment-due/34132)

<div class="topic-metadata">

**Author:** [@ineedtosleep](https://discourse.processing.org/u/ineedtosleep)\
**Replies:** 11\
**Last updated:** [December 28, 2021, 1:22pm UTC](https://discourse.processing.org/t/creating-a-floor-plan-urgent-final-assignment-due/34132 "2021-12-28T13:22:00Z")

</div>

please format code with \</\> button \* homework policy \* asking questions Please can someone help me create a floor plan!!! this is an elective course im no longer going to take it later on, however i have this final a…

---

## [Stroke doesn't look correct when using P3D in the 3rd argument of size()](https://discourse.processing.org/t/stroke-doesnt-look-correct-when-using-p3d-in-the-3rd-argument-of-size/34324)

<div class="topic-metadata">

**Author:** [@Dwight](https://discourse.processing.org/u/Dwight)\
**Replies:** 0\
**Last updated:** [December 27, 2021, 9:53pm UTC](https://discourse.processing.org/t/stroke-doesnt-look-correct-when-using-p3d-in-the-3rd-argument-of-size/34324 "2021-12-27T21:53:45Z")

</div>

When I make a rectangle with a strokeWeight of 20, and when I don’t use P3D in the 3rd argument of the size() function, it looks like this: But when I use P3D, the stroke is beveled a little bit: How do I remove …

---

## [3D Lidar point cloud to Blender](https://discourse.processing.org/t/3d-lidar-point-cloud-to-blender/34198)

<div class="topic-metadata">

**Author:** [@StainlessHolz](https://discourse.processing.org/u/StainlessHolz)\
**Replies:** 7\
**Last updated:** [December 27, 2021, 9:50pm UTC](https://discourse.processing.org/t/3d-lidar-point-cloud-to-blender/34198 "2021-12-27T21:50:03Z")

</div>

please format code with \</\> button \* homework policy \* asking questions Hi Everyone, I want to scan in 3D and mill these with CAM. I have access to some nice tools to do so: Livox Mid-40 LiDAR Fusion 360 and its …

---

## [Simple way to encode and decode a string according to a password?](https://discourse.processing.org/t/simple-way-to-encode-and-decode-a-string-according-to-a-password/34298)

<div class="topic-metadata">

**Author:** [@mungle](https://discourse.processing.org/u/mungle)\
**Replies:** 1\
**Last updated:** [December 27, 2021, 7:34pm UTC](https://discourse.processing.org/t/simple-way-to-encode-and-decode-a-string-according-to-a-password/34298 "2021-12-27T19:34:07Z")

</div>

Hello everyone, Does Processing have built-in functions, libraries or a simple way of encoding/decoding strings using a password? Something like this: encode('My String', password = 'mypass') //'ajdnfladfa739adl23' d…

---

## [How to properly export this simple 3D sketch to PDF?](https://discourse.processing.org/t/how-to-properly-export-this-simple-3d-sketch-to-pdf/34290)

<div class="topic-metadata">

**Author:** [@sorenkirk](https://discourse.processing.org/u/sorenkirk)\
**Replies:** 1\
**Last updated:** [December 26, 2021, 9:16am UTC](https://discourse.processing.org/t/how-to-properly-export-this-simple-3d-sketch-to-pdf/34290 "2021-12-26T09:16:53Z")

</div>

I have a somewhat simple sketch but whenever I export to pdf it looks really bad. What is the best way to get a vector file for this sketch that will look like how it does when run in Processing? import processing.pdf.\*…

---

## [Drawing a board using GUI](https://discourse.processing.org/t/drawing-a-board-using-gui/34276)

<div class="topic-metadata">

**Author:** [@f.y](https://discourse.processing.org/u/f.y)\
**Replies:** 2\
**Last updated:** [December 25, 2021, 1:42pm UTC](https://discourse.processing.org/t/drawing-a-board-using-gui/34276 "2021-12-25T13:42:05Z")

</div>

Hello, below is a code I wrote to draw a board using GUI. I want to locate the board in the center of my screen but I don\`t know-how. Can someone help, please? And, can you tell me how can I get access to each of the ce…

---

## [Snake eating the apple](https://discourse.processing.org/t/snake-eating-the-apple/34275)

<div class="topic-metadata">

**Author:** [@f.y](https://discourse.processing.org/u/f.y)\
**Replies:** 0\
**Last updated:** [December 24, 2021, 8:08am UTC](https://discourse.processing.org/t/snake-eating-the-apple/34275 "2021-12-24T08:08:33Z")

</div>

Hello everyone, I need some help with the code I am writing. this is a simple snake game but I don\`t know how to make the snake eat the apples besides there is one more problem. whenever the snake moves from left to rig…

---

## [Need help with a health system in a game i'm making](https://discourse.processing.org/t/need-help-with-a-health-system-in-a-game-im-making/33687)

<div class="topic-metadata">

**Author:** [@UltimateDoug9](https://discourse.processing.org/u/UltimateDoug9)\
**Replies:** 5\
**Last updated:** [December 23, 2021, 11:23pm UTC](https://discourse.processing.org/t/need-help-with-a-health-system-in-a-game-im-making/33687 "2021-12-23T23:23:34Z")

</div>

please format code with \</\> button \* homework policy \* asking questions Making a game of my computer studies class and i’m struggling to make a health system with just variables and if statement (that 's all were allowe…

---

## [Snake game eating the apples](https://discourse.processing.org/t/snake-game-eating-the-apples/34264)

<div class="topic-metadata">

**Author:** [@f.y](https://discourse.processing.org/u/f.y)\
**Replies:** 0\
**Last updated:** [December 23, 2021, 9:15am UTC](https://discourse.processing.org/t/snake-game-eating-the-apples/34264 "2021-12-23T09:15:00Z")

</div>

import processing.core.\*; public class Problem04 extends PApplet { float scale = height / 18f; float foodX; float foodY; float circleX; float circleY; float circleR; int score = 0; String scoreTxt = "Score: " + …

---

## [I want to sort many arrays in many different ways](https://discourse.processing.org/t/i-want-to-sort-many-arrays-in-many-different-ways/34249)

<div class="topic-metadata">

**Author:** [@jazz](https://discourse.processing.org/u/jazz)\
**Replies:** 3\
**Last updated:** [December 22, 2021, 9:22pm UTC](https://discourse.processing.org/t/i-want-to-sort-many-arrays-in-many-different-ways/34249 "2021-12-22T21:22:11Z")

</div>

for one of my projects, I have two arrays, one storing X coordinates, and one with Y coordinates. my goal is to sort the X coordinates from least to greatest using the “sort” function. the problem is, then none of the X…

---

## [5 Bit Barker Code](https://discourse.processing.org/t/5-bit-barker-code/31141)

<div class="topic-metadata">

**Author:** [@jafal](https://discourse.processing.org/u/jafal)\
**Replies:** 24\
**Last updated:** [December 22, 2021, 5:05pm UTC](https://discourse.processing.org/t/5-bit-barker-code/31141 "2021-12-22T17:05:24Z")

</div>

hi all I want to perform multiplication and addition for this array so that the result is as follows thanks in advance int \[\] intArray = new int\[\] {1, 1, 1,-1, 1}; println("Original Array:"); for (int i=0; i\<intArra…

---

## [How to change the icon of your application using PJOGL.setIcon()?](https://discourse.processing.org/t/how-to-change-the-icon-of-your-application-using-pjogl-seticon/34236)

<div class="topic-metadata">

**Author:** [@Dwight](https://discourse.processing.org/u/Dwight)\
**Replies:** 1\
**Last updated:** [December 22, 2021, 3:01pm UTC](https://discourse.processing.org/t/how-to-change-the-icon-of-your-application-using-pjogl-seticon/34236 "2021-12-22T15:01:50Z")

</div>

Hello there. I’m writing an application in processing, and I want to change application’s default icon on the taskbar. I know how this can be done by using surface.setIcon(PImage). But this doesn’t work when I’m using P…

---

## [Multiple transformations](https://discourse.processing.org/t/multiple-transformations/34243)

<div class="topic-metadata">

**Author:** [@Chihiro](https://discourse.processing.org/u/Chihiro)\
**Replies:** 3\
**Last updated:** [December 22, 2021, 12:23pm UTC](https://discourse.processing.org/t/multiple-transformations/34243 "2021-12-22T12:23:29Z")

</div>

Hi! I’m pretty new to coding, and am having an issue with the transformations in my code. My program is quite long so I’ve just used a rectangle as an example here. I’m trying to make the object spiral in a small circle …

---

## [Basic white triangle grid homework pls help](https://discourse.processing.org/t/basic-white-triangle-grid-homework-pls-help/34178)

<div class="topic-metadata">

**Author:** [@myhatzulu](https://discourse.processing.org/u/myhatzulu)\
**Replies:** 3\
**Last updated:** [December 22, 2021, 5:57am UTC](https://discourse.processing.org/t/basic-white-triangle-grid-homework-pls-help/34178 "2021-12-22T05:57:30Z")

</div>

could anyone sort me out with this I’m trying to make a grid of upside down white triangles exactly like \[Album\] imgur.com …

---

## [A question regarding depth sorting in raytracers](https://discourse.processing.org/t/a-question-regarding-depth-sorting-in-raytracers/34231)

<div class="topic-metadata">

**Author:** [@heawn](https://discourse.processing.org/u/heawn)\
**Replies:** 0\
**Last updated:** [December 21, 2021, 5:27pm UTC](https://discourse.processing.org/t/a-question-regarding-depth-sorting-in-raytracers/34231 "2021-12-21T17:27:55Z")

</div>

How do properly depth sort in raytracers So this is more or less a debugging kind of problem, which im unable to solve. My problem is that the rays for some reason dont return the color of the closest intersection, alld…

---

## [How to check if a key exists within a JSON file](https://discourse.processing.org/t/how-to-check-if-a-key-exists-within-a-json-file/34214)

<div class="topic-metadata">

**Author:** [@ybr](https://discourse.processing.org/u/ybr)\
**Replies:** 1\
**Last updated:** [December 20, 2021, 11:20pm UTC](https://discourse.processing.org/t/how-to-check-if-a-key-exists-within-a-json-file/34214 "2021-12-20T23:20:51Z")

</div>

Hi, I’m importing a JSON file using an API. For most elements within the array the key “rating” exists, for some it doesn’t. At that point my code stops with a null pointer exception. I’m trying to do a check whether a k…

---

## [Just a bit lost](https://discourse.processing.org/t/just-a-bit-lost/34179)

<div class="topic-metadata">

**Author:** [@Jamii](https://discourse.processing.org/u/Jamii)\
**Replies:** 4\
**Last updated:** [December 18, 2021, 2:03pm UTC](https://discourse.processing.org/t/just-a-bit-lost/34179 "2021-12-18T14:03:57Z")

</div>

I’ve been working on this for god knows how long, but I’m just not that sure how to make this better. Thoughts or comments? I couldn’t figure out how to make the lines not touch each other, so it constantly looks so mess…

---

## [Drawing an faulty advent calendar](https://discourse.processing.org/t/drawing-an-faulty-advent-calendar/34171)

<div class="topic-metadata">

**Author:** [@thorbensson](https://discourse.processing.org/u/thorbensson)\
**Replies:** 4\
**Last updated:** [December 18, 2021, 12:16am UTC](https://discourse.processing.org/t/drawing-an-faulty-advent-calendar/34171 "2021-12-18T00:16:23Z")

</div>

Hey guys, I hope you are having a nice pre-christmas time… For my university homework I’ll have to draw an advent calendar which (in the first step) has to be drawn by a loop and a draw\_advent\_calendar\_door(float x, flo…

---

## [How to decrease GPU load when displaying an image in the window?](https://discourse.processing.org/t/how-to-decrease-gpu-load-when-displaying-an-image-in-the-window/34152)

<div class="topic-metadata">

**Author:** [@BenjaminColligan](https://discourse.processing.org/u/BenjaminColligan)\
**Replies:** 4\
**Last updated:** [December 17, 2021, 4:41pm UTC](https://discourse.processing.org/t/how-to-decrease-gpu-load-when-displaying-an-image-in-the-window/34152 "2021-12-17T16:41:42Z")

</div>

Hi there, My first question so please dismiss any silly mistakes with my wording. I am developing a knock off of Photoshop, suitably named ‘Fotoshop’, as a part of my 2nd year university graphics coursework. I am doing …

---

## [StrokeWeight growing with loop](https://discourse.processing.org/t/strokeweight-growing-with-loop/34042)

<div class="topic-metadata">

**Author:** [@humano](https://discourse.processing.org/u/humano)\
**Replies:** 17\
**Last updated:** [December 14, 2021, 10:07pm UTC](https://discourse.processing.org/t/strokeweight-growing-with-loop/34042 "2021-12-14T22:07:01Z")

</div>

Hi there! I have made a loop with rectangles and I am trying to Increase gradually the Stroke , so have made another loop for that, but It does not work. Could you please help me? Thanks! size(1000,1000); background(25…

---

## [Loading a .wav file into memory](https://discourse.processing.org/t/loading-a-wav-file-into-memory/34114)

<div class="topic-metadata">

**Author:** [@rebeccajkaye](https://discourse.processing.org/u/rebeccajkaye)\
**Replies:** 0\
**Last updated:** [December 14, 2021, 5:49pm UTC](https://discourse.processing.org/t/loading-a-wav-file-into-memory/34114 "2021-12-14T17:49:17Z")

</div>

Hello Apologies for posting this - it’s probably a simple question but my online search has failed (although even just a pointer to anywhere I could read about this online would be massively helpful). So, I’m wanting t…

---

## [Loop inside another loop](https://discourse.processing.org/t/loop-inside-another-loop/33957)

<div class="topic-metadata">

**Author:** [@aya](https://discourse.processing.org/u/aya)\
**Replies:** 3\
**Last updated:** [December 14, 2021, 1:14am UTC](https://discourse.processing.org/t/loop-inside-another-loop/33957 "2021-12-14T01:14:12Z")

</div>

please format code with \</\> button \* homework policy \* asking questions I was able to create the tree in the image but the code consists of two loops one for the trunk and one and branches, and I could not combine …

---

## [How do I get a PShape location after transforming it?](https://discourse.processing.org/t/how-do-i-get-a-pshape-location-after-transforming-it/34064)

<div class="topic-metadata">

**Author:** [@TT3overnot](https://discourse.processing.org/u/TT3overnot)\
**Replies:** 6\
**Last updated:** [December 12, 2021, 3:59pm UTC](https://discourse.processing.org/t/how-do-i-get-a-pshape-location-after-transforming-it/34064 "2021-12-12T15:59:35Z")

</div>

cameraTarget = createShape(SPHERE, 30); cameraTarget.rotateX(-mouseX / 200.0); cameraTarget.rotateY(-mouseY / 200.0); cameraTarget.translate(200, 0, 0); I’m making a project and don’t want to replace any code. I was…

---

## [Add text above rect](https://discourse.processing.org/t/add-text-above-rect/34034)

<div class="topic-metadata">

**Author:** [@MoonAlien822](https://discourse.processing.org/u/MoonAlien822)\
**Replies:** 3\
**Last updated:** [December 11, 2021, 6:13pm UTC](https://discourse.processing.org/t/add-text-above-rect/34034 "2021-12-11T18:13:26Z")

</div>

I tried to add text on top of the rects in the shop, but the text appeared behind the rects, why is this? int clicks = 0; color cookie; color black; color white; PImage home; boolean shop= false; void setup() { re…

---

## [Array processing function](https://discourse.processing.org/t/array-processing-function/34026)

<div class="topic-metadata">

**Author:** [@bcabc](https://discourse.processing.org/u/bcabc)\
**Replies:** 8\
**Last updated:** [December 10, 2021, 4:37pm UTC](https://discourse.processing.org/t/array-processing-function/34026 "2021-12-10T16:37:33Z")

</div>

I’m attempting to create a function to do basic array manipulation. I’d like to pass it an empty array and have the new array returned. I’ve included the code below, but I am not sure how to get it to work correctly. I…

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

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