# Coding Questions

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

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

**Page:** 174

---

## [Anyone have any Improvements?](https://discourse.processing.org/t/anyone-have-any-improvements/3812)

<div class="topic-metadata">

**Author:** [@Godemperor949](https://discourse.processing.org/u/Godemperor949)\
**Replies:** 12\
**Last updated:** [September 25, 2018, 10:42pm UTC](https://discourse.processing.org/t/anyone-have-any-improvements/3812 "2018-09-25T22:42:13Z")

</div>

//Jeopardy, by Isaiah Johnson. PFont digits;//font Cell\[\] grid; //makes each individual cells int cols; //how many colloms int rows; // how many rows int numA=0;// number of questions answered int p;// the cell that was …

---

## [Recursively delete directory](https://discourse.processing.org/t/recursively-delete-directory/3766)

<div class="topic-metadata">

**Author:** [@elaner](https://discourse.processing.org/u/elaner)\
**Replies:** 3\
**Last updated:** [September 25, 2018, 5:41pm UTC](https://discourse.processing.org/t/recursively-delete-directory/3766 "2018-09-25T17:41:33Z")

</div>

I need to delete a directory that has files in it. Anyone have code to do this? I have tried a number of Java routines I found online but without luck.

---

## [Rotate Camera around it's own axis](https://discourse.processing.org/t/rotate-camera-around-its-own-axis/3774)

<div class="topic-metadata">

**Author:** [@Keheck](https://discourse.processing.org/u/Keheck)\
**Replies:** 1\
**Last updated:** [September 25, 2018, 4:56pm UTC](https://discourse.processing.org/t/rotate-camera-around-its-own-axis/3774 "2018-09-25T16:56:53Z")

</div>

I’d like to know if there is a way to rotate a 3D camera atound it’s own axis. I want to create a 3D game like Minecraft and for that I of course need to make the camera be rotatable I tried following code (unnecessary c…

---

## [Generative code](https://discourse.processing.org/t/generative-code/3725)

<div class="topic-metadata">

**Author:** [@mturel](https://discourse.processing.org/u/mturel)\
**Replies:** 4\
**Last updated:** [September 25, 2018, 5:44am UTC](https://discourse.processing.org/t/generative-code/3725 "2018-09-25T05:44:04Z")

</div>

Hi, I’m a beginner at coding and I’m wondering if anyone could help me with some code I’m writing. I have a bunch of seed vector files that I would like the code to randomly overlay zoom in, rotate to create new pieces …

---

## [Null pointer when accessing variable from another class](https://discourse.processing.org/t/null-pointer-when-accessing-variable-from-another-class/3702)

<div class="topic-metadata">

**Author:** [@ddownn](https://discourse.processing.org/u/ddownn)\
**Replies:** 3\
**Last updated:** [September 20, 2018, 7:45pm UTC](https://discourse.processing.org/t/null-pointer-when-accessing-variable-from-another-class/3702 "2018-09-20T19:45:10Z")

</div>

Okay, I’m having another learning experience here. I don’t know what’s going wrong with this. I’m experimenting with how classes work together, and how to pass data between them. When I run this code, I get a NullPointe…

---

## [Repeat lines until an event happens](https://discourse.processing.org/t/repeat-lines-until-an-event-happens/3753)

<div class="topic-metadata">

**Author:** [@Schred](https://discourse.processing.org/u/Schred)\
**Replies:** 4\
**Last updated:** [September 24, 2018, 3:07pm UTC](https://discourse.processing.org/t/repeat-lines-until-an-event-happens/3753 "2018-09-24T15:07:58Z")

</div>

Hello, I’m new here, and I’m simply searching for a way to repeat a line of code unlimited times (in one draw passing) until the wanted event happens. Is there any way to do so?

---

## [\[SOLVED\] Problems with PVectors](https://discourse.processing.org/t/solved-problems-with-pvectors/3715)

<div class="topic-metadata">

**Author:** [@OrigamiBoy](https://discourse.processing.org/u/OrigamiBoy)\
**Replies:** 2\
**Last updated:** [September 24, 2018, 1:23pm UTC](https://discourse.processing.org/t/solved-problems-with-pvectors/3715 "2018-09-24T13:23:01Z")

</div>

Hey all, I am having some problems with changing the values with PVectors. Here is my code: Rocket rocket = new Rocket(); void keyPressed() { switch(key) { case 'w': rocket.up(); case 's': rocket.dow…

---

## [Start/Stop button | can't figure this out](https://discourse.processing.org/t/start-stop-button-cant-figure-this-out/3784)

<div class="topic-metadata">

**Author:** [@SolDrakibane](https://discourse.processing.org/u/SolDrakibane)\
**Replies:** 2\
**Last updated:** [September 24, 2018, 11:10am UTC](https://discourse.processing.org/t/start-stop-button-cant-figure-this-out/3784 "2018-09-24T11:10:34Z")

</div>

So, the code below creates a bullseye that moves from the middle to the right and starts at the left again and loops. When i click the Start button the bullseye moves, the text switches to Stop. When i click the button a…

---

## [Transform text to colored pixels?](https://discourse.processing.org/t/transform-text-to-colored-pixels/3633)

<div class="topic-metadata">

**Author:** [@MAKESHADY](https://discourse.processing.org/u/MAKESHADY)\
**Replies:** 3\
**Last updated:** [September 24, 2018, 2:03am UTC](https://discourse.processing.org/t/transform-text-to-colored-pixels/3633 "2018-09-24T02:03:20Z")

</div>

I would like to create and image composed by a text. I would like to say on processing " a = blue pixel, b = red pixel … ". Transform 100 letters on 10x10 image ( or larger ). THX !

---

## [Drag and Drop Rectangle](https://discourse.processing.org/t/drag-and-drop-rectangle/3762)

<div class="topic-metadata">

**Author:** [@butterycowegg](https://discourse.processing.org/u/butterycowegg)\
**Replies:** 3\
**Last updated:** [September 23, 2018, 6:01pm UTC](https://discourse.processing.org/t/drag-and-drop-rectangle/3762 "2018-09-23T18:01:48Z")

</div>

I am new to Processing and am trying to write a program that allows you to drag and drop a rectangle. Whenever I click on the rectangle, the mouse locations becomes the new top left corner of the rectangle. How can I mak…

---

## [From 0 to 100 script](https://discourse.processing.org/t/from-0-to-100-script/3667)

<div class="topic-metadata">

**Author:** [@netillo](https://discourse.processing.org/u/netillo)\
**Replies:** 4\
**Last updated:** [September 23, 2018, 4:43am UTC](https://discourse.processing.org/t/from-0-to-100-script/3667 "2018-09-23T04:43:22Z")

</div>

Hello everyone, I’m trying to write a script that goes from which goes from 0 to 100 in 10 minutes with the look of a digital clock. I hope someone can help. Thank you! Cordially, Netillo

---

## [Nested loops, ending "early"](https://discourse.processing.org/t/nested-loops-ending-early/3726)

<div class="topic-metadata">

**Author:** [@ddownn](https://discourse.processing.org/u/ddownn)\
**Replies:** 3\
**Last updated:** [September 22, 2018, 4:49pm UTC](https://discourse.processing.org/t/nested-loops-ending-early/3726 "2018-09-22T16:49:00Z")

</div>

Now I have this question about nested loops. With the buildTiles() method, I would like to have the option to create fewer Tile objects than grid cells, but still number them in the “id” field, and assign the grid cell …

---

## [Accessing functions from Java Generics](https://discourse.processing.org/t/accessing-functions-from-java-generics/3391)

<div class="topic-metadata">

**Author:** [@Sarah](https://discourse.processing.org/u/Sarah)\
**Replies:** 18\
**Last updated:** [September 10, 2018, 11:58am UTC](https://discourse.processing.org/t/accessing-functions-from-java-generics/3391 "2018-09-10T11:58:30Z")

</div>

Hi! Recently I’ve been making some classes to carry out functions, but when making them, I’ve only been able to use 1 class for one object. For example, class Sorter { Point\[\] points; Sorter(Point\[\] points\_) { …

---

## [Centering a point cloud/OBJ object](https://discourse.processing.org/t/centering-a-point-cloud-obj-object/3493)

<div class="topic-metadata">

**Author:** [@solub](https://discourse.processing.org/u/solub)\
**Replies:** 11\
**Last updated:** [September 22, 2018, 6:11am UTC](https://discourse.processing.org/t/centering-a-point-cloud-obj-object/3493 "2018-09-22T06:11:25Z")

</div>

Hi all, I have a problem locating on the canvas a large point cloud file (.txt / .xyz) that I have created with Meshlab. I’ve tried to translate the coordinates numerous times with the translate() function but not onl…

---

## [\[SOLVED\] Making the contents of a frame relative to its size](https://discourse.processing.org/t/solved-making-the-contents-of-a-frame-relative-to-its-size/3595)

<div class="topic-metadata">

**Author:** [@delsey](https://discourse.processing.org/u/delsey)\
**Replies:** 4\
**Last updated:** [September 21, 2018, 10:56am UTC](https://discourse.processing.org/t/solved-making-the-contents-of-a-frame-relative-to-its-size/3595 "2018-09-21T10:56:15Z")

</div>

Is there a way of making the contents in a frame relative to its size to make it completely resizable without losing functionality? I already have an idea of how to it but a small tutorial would be quite nice.

---

## [Dragging a constrained object, and problems with conditional fill color](https://discourse.processing.org/t/dragging-a-constrained-object-and-problems-with-conditional-fill-color/3554)

<div class="topic-metadata">

**Author:** [@ddownn](https://discourse.processing.org/u/ddownn)\
**Replies:** 7\
**Last updated:** [September 20, 2018, 5:29pm UTC](https://discourse.processing.org/t/dragging-a-constrained-object-and-problems-with-conditional-fill-color/3554 "2018-09-20T17:29:51Z")

</div>

Hello. I have a sketch that draws a grid, and places a rectangular cursor which is constrained to the grid area, and snaps to the center of the nearest grid cell when the mouse is released. The center “Tile” for a grid c…

---

## [Using colors with variables](https://discourse.processing.org/t/using-colors-with-variables/3679)

<div class="topic-metadata">

**Author:** [@Lore](https://discourse.processing.org/u/Lore)\
**Replies:** 13\
**Last updated:** [September 20, 2018, 4:56pm UTC](https://discourse.processing.org/t/using-colors-with-variables/3679 "2018-09-20T16:56:12Z")

</div>

Hello. My problem is that when you press tab (to make the ellipse color be random) it works fine. But, when you change the size of the ellipse (with keys 1-3) the ellipse color isn’t random anymore, but on the last rando…

---

## [Need help with mouseY](https://discourse.processing.org/t/need-help-with-mousey/3680)

<div class="topic-metadata">

**Author:** [@Lore](https://discourse.processing.org/u/Lore)\
**Replies:** 1\
**Last updated:** [September 19, 2018, 8:40pm UTC](https://discourse.processing.org/t/need-help-with-mousey/3680 "2018-09-19T20:40:34Z")

</div>

Hello, below I have pasted my code. What I have been working on, but couldn’t figure out how to preform it, is to not be able to draw the ellipse (when pressing on the mouse) on the text at the top of the screen. I have …

---

## [Need help with PGraphics](https://discourse.processing.org/t/need-help-with-pgraphics/3678)

<div class="topic-metadata">

**Author:** [@Lore](https://discourse.processing.org/u/Lore)\
**Replies:** 2\
**Last updated:** [September 19, 2018, 8:13pm UTC](https://discourse.processing.org/t/need-help-with-pgraphics/3678 "2018-09-19T20:13:09Z")

</div>

Hello, I am fairly new to processing and I have a problem with my code. What I want the code to do is if the mouse is pressed, to draw on the surface, and if the mouse isn’t pressed, to not draw but to still having an el…

---

## [Cutting cards in an image](https://discourse.processing.org/t/cutting-cards-in-an-image/3650)

<div class="topic-metadata">

**Author:** [@josephh](https://discourse.processing.org/u/josephh)\
**Replies:** 17\
**Last updated:** [September 19, 2018, 4:34pm UTC](https://discourse.processing.org/t/cutting-cards-in-an-image/3650 "2018-09-19T16:34:33Z")

</div>

Hi there, Currently I am selling Yu-Gi-Oh! cards on Ebay and each time, I need to scan them (8 at a time). My problem is the following : usually I trim them by hand so it’s tedious. :anguished: Then I said to me : why…

---

## [Shared PVector values in Classes](https://discourse.processing.org/t/shared-pvector-values-in-classes/3662)

<div class="topic-metadata">

**Author:** [@blosh](https://discourse.processing.org/u/blosh)\
**Replies:** 3\
**Last updated:** [September 19, 2018, 8:34am UTC](https://discourse.processing.org/t/shared-pvector-values-in-classes/3662 "2018-09-19T08:34:59Z")

</div>

I have created a new Class, “Polygon” that uses a PVector to store the position on the screen that a shape is displayed. However, whenever I update the position of one the Polygons it updates the position of all the othe…

---

## [Timed Events On A Loop](https://discourse.processing.org/t/timed-events-on-a-loop/3631)

<div class="topic-metadata">

**Author:** [@Vigil](https://discourse.processing.org/u/Vigil)\
**Replies:** 1\
**Last updated:** [September 18, 2018, 5:59pm UTC](https://discourse.processing.org/t/timed-events-on-a-loop/3631 "2018-09-18T17:59:46Z")

</div>

Greetings Everyone! I found a timer class here on the forum and I have been tinkering with it. My goal is to have a series of events loop with the timer active and for the loop to be disabled and enabled. I am wondering …

---

## [How to make head wiggle?](https://discourse.processing.org/t/how-to-make-head-wiggle/3657)

<div class="topic-metadata">

**Author:** [@RienziDeal](https://discourse.processing.org/u/RienziDeal)\
**Replies:** 2\
**Last updated:** [September 18, 2018, 10:34pm UTC](https://discourse.processing.org/t/how-to-make-head-wiggle/3657 "2018-09-18T22:34:36Z")

</div>

Hi this is my code void setup() { size(200,250); background(255); smooth(); ellipseMode(CENTER); rectMode(CENTER); } void draw() { background (255, 50,0); body(); head(); float x = 0; …

---

## [Integer cannot be cast into Float?](https://discourse.processing.org/t/integer-cannot-be-cast-into-float/3647)

<div class="topic-metadata">

**Author:** [@aaronshenhao](https://discourse.processing.org/u/aaronshenhao)\
**Replies:** 6\
**Last updated:** [September 18, 2018, 4:08pm UTC](https://discourse.processing.org/t/integer-cannot-be-cast-into-float/3647 "2018-09-18T16:08:30Z")

</div>

Hi everyone, I have a “Node” class which contains an ‘attributes’ variable. The variable contains a variety of data types associated with a String key. I’m using a HashMap to implement it. However, when I try and retrie…

---

## [Change the output location of beginRecord?](https://discourse.processing.org/t/change-the-output-location-of-beginrecord/3643)

<div class="topic-metadata">

**Author:** [@Cam](https://discourse.processing.org/u/Cam)\
**Replies:** 2\
**Last updated:** [September 18, 2018, 3:10pm UTC](https://discourse.processing.org/t/change-the-output-location-of-beginrecord/3643 "2018-09-18T15:10:06Z")

</div>

import processing.pdf.\*; class secondWindow extends PApplet { secondWindow() { super(); PApplet.runSketch(new String\[\] {this.getClass().getSimpleName()}, this); } void settings() { size(100, 100); } …

---

## [Autosave in your program](https://discourse.processing.org/t/autosave-in-your-program/3504)

<div class="topic-metadata">

**Author:** [@MxFxM](https://discourse.processing.org/u/MxFxM)\
**Replies:** 3\
**Last updated:** [September 17, 2018, 11:36pm UTC](https://discourse.processing.org/t/autosave-in-your-program/3504 "2018-09-17T23:36:50Z")

</div>

Hi. Just like me you might want some code in your tool that saves the file you are working on in a set interval. I searched the forum but there was no topic like this before. A little research in the java documentation…

---

## [How to make different sizes for one renderer](https://discourse.processing.org/t/how-to-make-different-sizes-for-one-renderer/3323)

<div class="topic-metadata">

**Author:** [@mloiz](https://discourse.processing.org/u/mloiz)\
**Replies:** 5\
**Last updated:** [September 17, 2018, 4:30pm UTC](https://discourse.processing.org/t/how-to-make-different-sizes-for-one-renderer/3323 "2018-09-17T16:30:11Z")

</div>

Hi, I have to make one image at three different sizes : A3 for printing at 300 DPI, would need 3508 x 4961 pix A5 for printing at 300 DPI, would need 1748 \* 2480 pix and a banner for the web at 960 × 334 pixels how w…

---

## [Detecting mouse click on circle](https://discourse.processing.org/t/detecting-mouse-click-on-circle/3599)

<div class="topic-metadata">

**Author:** [@Tristan](https://discourse.processing.org/u/Tristan)\
**Replies:** 9\
**Last updated:** [September 17, 2018, 1:40pm UTC](https://discourse.processing.org/t/detecting-mouse-click-on-circle/3599 "2018-09-17T13:40:40Z")

</div>

I am trying to detect a mouse press on a circle. I know how to do so with a square and am using that for the hitbox right now. I would like to know what is supposed to go into my IF statement to detect MouseX and mouseY …

---

## [Enhanced For Loops and selecting every nth](https://discourse.processing.org/t/enhanced-for-loops-and-selecting-every-nth/3593)

<div class="topic-metadata">

**Author:** [@omerpekin](https://discourse.processing.org/u/omerpekin)\
**Replies:** 4\
**Last updated:** [September 17, 2018, 8:15am UTC](https://discourse.processing.org/t/enhanced-for-loops-and-selecting-every-nth/3593 "2018-09-17T08:15:01Z")

</div>

Hi, I have a simple question about enhanced for loops. I created a new arraylist and filled them with objects. and now I am trying to select every nth object. I tried to use: if(arraylist.size() % 2 == 0) {} but it d…

---

## [How do I import an "idx3-ubyte" file?](https://discourse.processing.org/t/how-do-i-import-an-idx3-ubyte-file/3577)

<div class="topic-metadata">

**Author:** [@Tsskyx](https://discourse.processing.org/u/Tsskyx)\
**Replies:** 2\
**Last updated:** [September 16, 2018, 5:56pm UTC](https://discourse.processing.org/t/how-do-i-import-an-idx3-ubyte-file/3577 "2018-09-16T17:56:01Z")

</div>

I am wondering how to import the files found on this website into Processing: http://yann.lecun.com/exdb/mnist/ They’re supposed to contain thousands of 28x28 byte arrangements, each with its own “grayscale” value. In e…

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

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