# Coding Questions

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

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

**Page:** 123

---

## [keyPressed and keyReleased with java(eclipse)](https://discourse.processing.org/t/keypressed-and-keyreleased-with-java-eclipse/12994)

<div class="topic-metadata">

**Author:** [@vincentstrebelle](https://discourse.processing.org/u/vincentstrebelle)\
**Replies:** 21\
**Last updated:** [October 30, 2019, 3:45pm UTC](https://discourse.processing.org/t/keypressed-and-keyreleased-with-java-eclipse/12994 "2019-10-30T15:45:41Z")

</div>

Hi i found the code “Player Move” from @GoToLoop and i have several questions. i put some of my question in the code: static final int DIAM = 48, SPD = 4, FPS = 60; static final color BG = 0350; Player p; void setu…

---

## [Battleships game in processing](https://discourse.processing.org/t/battleships-game-in-processing/15050)

<div class="topic-metadata">

**Author:** [@aDavid903](https://discourse.processing.org/u/aDavid903)\
**Replies:** 1\
**Last updated:** [October 30, 2019, 3:35pm UTC](https://discourse.processing.org/t/battleships-game-in-processing/15050 "2019-10-30T15:35:45Z")

</div>

So I’m pretty new to Processing 3, and I need to make a game of battleships for an assignment. I have come to the part where I need to make a grid and be able to check which grid is being clicked. This is where I have a …

---

## [Key events (how to stop keyPressed() repeating)](https://discourse.processing.org/t/key-events-how-to-stop-keypressed-repeating/15042)

<div class="topic-metadata">

**Author:** [@paulstgeorge](https://discourse.processing.org/u/paulstgeorge)\
**Replies:** 3\
**Last updated:** [October 30, 2019, 2:54pm UTC](https://discourse.processing.org/t/key-events-how-to-stop-keypressed-repeating/15042 "2019-10-30T14:54:07Z")

</div>

Help please. In the following code I want to change the value of varH and so the color of the letter H once and only once. So, when the H or h key is pressed the value of varH should increase by 1. If the key is kept pre…

---

## [Get array of vertex's from loaded 3D Model?](https://discourse.processing.org/t/get-array-of-vertexs-from-loaded-3d-model/15029)

<div class="topic-metadata">

**Author:** [@KeirMeDear](https://discourse.processing.org/u/KeirMeDear)\
**Replies:** 2\
**Last updated:** [October 30, 2019, 2:33am UTC](https://discourse.processing.org/t/get-array-of-vertexs-from-loaded-3d-model/15029 "2019-10-30T02:33:34Z")

</div>

So, I was wondering if there is a function or a library which allows you to access an array of vertex’s from a loaded object. For instance if you used the LoadShape() function to import a .obj file of a cube, you could …

---

## [Rotation in relations to another object](https://discourse.processing.org/t/rotation-in-relations-to-another-object/14990)

<div class="topic-metadata">

**Author:** [@volous](https://discourse.processing.org/u/volous)\
**Replies:** 2\
**Last updated:** [October 30, 2019, 2:00am UTC](https://discourse.processing.org/t/rotation-in-relations-to-another-object/14990 "2019-10-30T02:00:51Z")

</div>

Hi, so i’m trying to rotate another shape in relations to another shape. but im not able to do so, how should i go about it(object/class based)?.

---

## [Making of: Tetris](https://discourse.processing.org/t/making-of-tetris/15024)

<div class="topic-metadata">

**Author:** [@ImDaGr3en](https://discourse.processing.org/u/ImDaGr3en)\
**Replies:** 1\
**Last updated:** [October 29, 2019, 4:44pm UTC](https://discourse.processing.org/t/making-of-tetris/15024 "2019-10-29T16:44:51Z")

</div>

Hey all! Today at school I started coding a Tetris-like mini game, based on shapes which fall to the ground and land on the bottom of the window… but I’m now stuck! The fact is, everything goes right when I create a ne…

---

## [Save Function not quite right](https://discourse.processing.org/t/save-function-not-quite-right/15027)

<div class="topic-metadata">

**Author:** [@ozman](https://discourse.processing.org/u/ozman)\
**Replies:** 5\
**Last updated:** [October 29, 2019, 5:36pm UTC](https://discourse.processing.org/t/save-function-not-quite-right/15027 "2019-10-29T17:36:02Z")

</div>

Hi! i’m trying to have a save function that allows you to name the file and choose where you would like your save to go. So far with the code I have, its allows you to save and make/choose a folder but then places it o…

---

## [Error with this save function](https://discourse.processing.org/t/error-with-this-save-function/15026)

<div class="topic-metadata">

**Author:** [@ozman](https://discourse.processing.org/u/ozman)\
**Replies:** 2\
**Last updated:** [October 29, 2019, 4:50pm UTC](https://discourse.processing.org/t/error-with-this-save-function/15026 "2019-10-29T16:50:38Z")

</div>

Hi! Im trying to have a save function that allows you to select the folder it goes into. void keyPressed() { if(key == 'r'){ { setup(); } if(key ==' ') { selectFolder("select a folder to process","folderS…

---

## [Need help - very beginner](https://discourse.processing.org/t/need-help-very-beginner/14964)

<div class="topic-metadata">

**Author:** [@actuallyagod](https://discourse.processing.org/u/actuallyagod)\
**Replies:** 14\
**Last updated:** [October 29, 2019, 3:52pm UTC](https://discourse.processing.org/t/need-help-very-beginner/14964 "2019-10-29T15:52:53Z")

</div>

I have gotten a little school project, should be rather easy but i am completely lost. hope to find some help here. I am supposed to make something like this: https://gyazo.com/d9f0a1921c3eea3fc2fe6c691838be37 On the …

---

## [Putting a point to the nearest grid intersection](https://discourse.processing.org/t/putting-a-point-to-the-nearest-grid-intersection/14999)

<div class="topic-metadata">

**Author:** [@johnsmith17](https://discourse.processing.org/u/johnsmith17)\
**Replies:** 1\
**Last updated:** [October 29, 2019, 10:31am UTC](https://discourse.processing.org/t/putting-a-point-to-the-nearest-grid-intersection/14999 "2019-10-29T10:31:28Z")

</div>

Hi im trying to make a grid with 10 columns and 10 rows and when mouse pressed a circle is placed to the nearest grid intersection. any idea how i can do this using arrays and loops to compare the distance between each c…

---

## [Poisson-disc Sampling](https://discourse.processing.org/t/poisson-disc-sampling/14869)

<div class="topic-metadata">

**Author:** [@TimoL](https://discourse.processing.org/u/TimoL)\
**Replies:** 8\
**Last updated:** [October 28, 2019, 1:28pm UTC](https://discourse.processing.org/t/poisson-disc-sampling/14869 "2019-10-28T13:28:12Z")

</div>

Hi there, I’ve been working from one of Daniel Shiffman’s coding challenges and have been trying to implement it from P5.js to Processing. Im almost there but I always get an Array Index Out Of Bounds error (line 68). …

---

## [Noise Buffering](https://discourse.processing.org/t/noise-buffering/14640)

<div class="topic-metadata">

**Author:** [@LordCacops](https://discourse.processing.org/u/LordCacops)\
**Replies:** 5\
**Last updated:** [October 26, 2019, 7:51pm UTC](https://discourse.processing.org/t/noise-buffering/14640 "2019-10-26T19:51:54Z")

</div>

Hey there! I am in a necessity to know how to create a buffer of perlin noise so that I can access that same stable noise data in different scenarios, and across different runs of the same program. In another thread som…

---

## [Creating Snake Game](https://discourse.processing.org/t/creating-snake-game/14954)

<div class="topic-metadata">

**Author:** [@Ephilorex](https://discourse.processing.org/u/Ephilorex)\
**Replies:** 3\
**Last updated:** [October 26, 2019, 2:30pm UTC](https://discourse.processing.org/t/creating-snake-game/14954 "2019-10-26T14:30:51Z")

</div>

Hi everyone! I am a beginner in Processing and for my assignment I would like to create a snake game. Here are my steps: Draw background Create apple system; spawn one in on the grid when another is eaten Death system…

---

## [Snake Game in Processing](https://discourse.processing.org/t/snake-game-in-processing/14921)

<div class="topic-metadata">

**Author:** [@Ephilorex](https://discourse.processing.org/u/Ephilorex)\
**Replies:** 10\
**Last updated:** [October 25, 2019, 2:14pm UTC](https://discourse.processing.org/t/snake-game-in-processing/14921 "2019-10-25T14:14:30Z")

</div>

Hello! I’m a complete beginner with Processing. For my assignment, I want to make a snake game in Processing. Here is what I want to do; Draw background Create apple system; spawn one in on the grid when another is eat…

---

## [Turning Depth Buffer into a PGraphics element](https://discourse.processing.org/t/turning-depth-buffer-into-a-pgraphics-element/14184)

<div class="topic-metadata">

**Author:** [@dehyde](https://discourse.processing.org/u/dehyde)\
**Replies:** 8\
**Last updated:** [October 25, 2019, 11:10am UTC](https://discourse.processing.org/t/turning-depth-buffer-into-a-pgraphics-element/14184 "2019-10-25T11:10:04Z")

</div>

I want to create 2d outlines for objects on 3d space, to simulate some sort of “technical illustration” or Ikea instructions style rendering, similar to what SolidWorks Composer is doing (notice how external stroke is h…

---

## [Shape from Stroke](https://discourse.processing.org/t/shape-from-stroke/14893)

<div class="topic-metadata">

**Author:** [@dehyde](https://discourse.processing.org/u/dehyde)\
**Replies:** 7\
**Last updated:** [October 25, 2019, 11:02am UTC](https://discourse.processing.org/t/shape-from-stroke/14893 "2019-10-25T11:02:44Z")

</div>

Is there a known way to take the stroke of a bezier curve or PShape and turn it into a closed path / shape? for example:

---

## [Rotate and zoom question](https://discourse.processing.org/t/rotate-and-zoom-question/14891)

<div class="topic-metadata">

**Author:** [@companje](https://discourse.processing.org/u/companje)\
**Replies:** 3\
**Last updated:** [October 23, 2019, 4:53pm UTC](https://discourse.processing.org/t/rotate-and-zoom-question/14891 "2019-10-23T16:53:30Z")

</div>

Hi everyone, I’m trying to zoom in on a sphere. Instead of zooming in from the center I would like to zoom in such a way that the red square stays in the yellow ellipse. What would be a good way to achieve this do you …

---

## [Spawning Enemies](https://discourse.processing.org/t/spawning-enemies/14875)

<div class="topic-metadata">

**Author:** [@OrangeJuice](https://discourse.processing.org/u/OrangeJuice)\
**Replies:** 3\
**Last updated:** [October 23, 2019, 3:33pm UTC](https://discourse.processing.org/t/spawning-enemies/14875 "2019-10-23T15:33:35Z")

</div>

I’m trying to create a side scrolling shoot 'em up type game and I’m having trouble spawning the enemies, this is my code right now. if (r==1 && enemy==true) buggieY+=5; buggieX=750; buggieY=300; if (buggieY\>600 || …

---

## [Help with functions](https://discourse.processing.org/t/help-with-functions/14885)

<div class="topic-metadata">

**Author:** [@JackBarrie1341](https://discourse.processing.org/u/JackBarrie1341)\
**Replies:** 1\
**Last updated:** [October 23, 2019, 1:36am UTC](https://discourse.processing.org/t/help-with-functions/14885 "2019-10-23T01:36:00Z")

</div>

Hello, I am trying to make a function that returns the string str in all lowercase. The console is saying that String allLowercase (String str) must return a result of type string. I’m stumped and obviously a little lo…

---

## [Extending PGraphicsJava2D: Space between triangles / vertices](https://discourse.processing.org/t/extending-pgraphicsjava2d-space-between-triangles-vertices/14797)

<div class="topic-metadata">

**Author:** [@companje](https://discourse.processing.org/u/companje)\
**Replies:** 3\
**Last updated:** [October 23, 2019, 1:34am UTC](https://discourse.processing.org/t/extending-pgraphicsjava2d-space-between-triangles-vertices/14797 "2019-10-23T01:34:15Z")

</div>

Hello, When extending PGraphicsJava2D (as described by @GoToLoop on the old forum https://forum.processing.org/two/discussion/16314/pshape-inside-a-class-or-extend-pshape#Item\_4 from) and drawing a TRIANGLE\_STRIP I ge…

---

## [Unwanted Color Changes](https://discourse.processing.org/t/unwanted-color-changes/14855)

<div class="topic-metadata">

**Author:** [@Ozhan](https://discourse.processing.org/u/Ozhan)\
**Replies:** 1\
**Last updated:** [October 22, 2019, 4:13am UTC](https://discourse.processing.org/t/unwanted-color-changes/14855 "2019-10-22T04:13:50Z")

</div>

Hi All. I wrote the following codes to follow my mouse when I pressed the left button with red and when I pressed the right button with green colors but color of all the shapes changes when I changed the mouse buttons. …

---

## [Waiting for mousePressed() in draw](https://discourse.processing.org/t/waiting-for-mousepressed-in-draw/14795)

<div class="topic-metadata">

**Author:** [@stefan\_98](https://discourse.processing.org/u/stefan_98)\
**Replies:** 8\
**Last updated:** [October 21, 2019, 5:39pm UTC](https://discourse.processing.org/t/waiting-for-mousepressed-in-draw/14795 "2019-10-21T17:39:49Z")

</div>

Hello, I’m very new to programming with Processing, and I just wanted to know, how I can force the program in draw() to wait for the mousePressed() function. Nice greetings

---

## [I can\`t load an Image as background](https://discourse.processing.org/t/i-can-t-load-an-image-as-background/14849)

<div class="topic-metadata">

**Author:** [@CyberDodo](https://discourse.processing.org/u/CyberDodo)\
**Replies:** 4\
**Last updated:** [October 21, 2019, 9:54am UTC](https://discourse.processing.org/t/i-can-t-load-an-image-as-background/14849 "2019-10-21T09:54:32Z")

</div>

I can\`t load an Image as background. Exception in thread “Thread-212” void setup() { size( 1366, 768); PImage bg; bg = loadImage("qrC6FvL.jpg"); } void draw() { background(bg); fill(0, 255, 0); rect (300, …

---

## [Wrap the text and Change the specific word colour in a text file](https://discourse.processing.org/t/wrap-the-text-and-change-the-specific-word-colour-in-a-text-file/14814)

<div class="topic-metadata">

**Author:** [@do11134](https://discourse.processing.org/u/do11134)\
**Replies:** 2\
**Last updated:** [October 21, 2019, 3:53am UTC](https://discourse.processing.org/t/wrap-the-text-and-change-the-specific-word-colour-in-a-text-file/14814 "2019-10-21T03:53:04Z")

</div>

the first thing I want to do is wrap the text and the second thing is to make the color change of specific words, but I found it is hard to do. Please somebody can help me!!! void setup() { size(600, 600); background(…

---

## [Text that is not affected by rotations](https://discourse.processing.org/t/text-that-is-not-affected-by-rotations/14800)

<div class="topic-metadata">

**Author:** [@biran4454](https://discourse.processing.org/u/biran4454)\
**Replies:** 4\
**Last updated:** [October 21, 2019, 3:43am UTC](https://discourse.processing.org/t/text-that-is-not-affected-by-rotations/14800 "2019-10-21T03:43:40Z")

</div>

I am writing a piece of code that draws 3D objects onto the canvas using P3D render. I have coded it such that one can rotate the camera and pan and zoom, etc. I want to write some info text onto the screen, but when I…

---

## [My infinity watch project](https://discourse.processing.org/t/my-infinity-watch-project/14743)

<div class="topic-metadata">

**Author:** [@andi](https://discourse.processing.org/u/andi)\
**Replies:** 1\
**Last updated:** [October 18, 2019, 2:21pm UTC](https://discourse.processing.org/t/my-infinity-watch-project/14743 "2019-10-18T14:21:50Z")

</div>

Hi guys, I want to create a watch wich runs on an infinity symbol (24 h one whole turn). Therefore I created some code with a friend. (you can see below) main: float amp = 0.0; float amp\_offset = 150.0; float amp\_stre…

---

## [Limiting draw() to run a limited amount of times!](https://discourse.processing.org/t/limiting-draw-to-run-a-limited-amount-of-times/14809)

<div class="topic-metadata">

**Author:** [@tsunii](https://discourse.processing.org/u/tsunii)\
**Replies:** 20\
**Last updated:** [October 20, 2019, 9:14pm UTC](https://discourse.processing.org/t/limiting-draw-to-run-a-limited-amount-of-times/14809 "2019-10-20T21:14:53Z")

</div>

Hello, i’m trying to make a application that works like this: We have a certain amount on “Main Circles” the black one, and “Secondary Circles” the white ones, what i want is to have a fixed number of Main Circles and a …

---

## [Painting with pixels using PVector](https://discourse.processing.org/t/painting-with-pixels-using-pvector/14829)

<div class="topic-metadata">

**Author:** [@JoseBri93](https://discourse.processing.org/u/JoseBri93)\
**Replies:** 5\
**Last updated:** [October 20, 2019, 8:38pm UTC](https://discourse.processing.org/t/painting-with-pixels-using-pvector/14829 "2019-10-20T20:38:20Z")

</div>

Hi people, I want ths image to be drawn by the forms i created. So they all will start at one point and then expand to all directions. The PVector function gives me the curvature i like them to have while i’m hoping the …

---

## [Firework: Circle with cosine & sine but in 3D....?](https://discourse.processing.org/t/firework-circle-with-cosine-sine-but-in-3d/14670)

<div class="topic-metadata">

**Author:** [@Chrisir](https://discourse.processing.org/u/Chrisir)\
**Replies:** 5\
**Last updated:** [October 20, 2019, 12:23pm UTC](https://discourse.processing.org/t/firework-circle-with-cosine-sine-but-in-3d/14670 "2019-10-20T12:23:52Z")

</div>

Hello all, I made a fire work in 2D (its movement is 2D anyway) with a simple formula using cos and sin. void move() { // Spark move // move x = centerX+cos(angle)\*radius; y = centerY+sin(angle)\*r…

---

## [Decimal point or comma](https://discourse.processing.org/t/decimal-point-or-comma/14819)

<div class="topic-metadata">

**Author:** [@micha](https://discourse.processing.org/u/micha)\
**Replies:** 2\
**Last updated:** [October 20, 2019, 11:25am UTC](https://discourse.processing.org/t/decimal-point-or-comma/14819 "2019-10-20T11:25:46Z")

</div>

I am working with Processing 3.5.3 on a Mac with german system osx 10.11.6 When I say float number = 0.2; println(nf(number, 1, 2)); it prints 0,20 with decimal comma (common in everyday german life) Is there a wa…

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

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