# Coding Questions

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

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

**Page:** 61

---

## [Checking objects in a certain area](https://discourse.processing.org/t/checking-objects-in-a-certain-area/28220)

<div class="topic-metadata">

**Author:** [@Criste44](https://discourse.processing.org/u/Criste44)\
**Replies:** 8\
**Last updated:** [March 3, 2021, 5:33pm UTC](https://discourse.processing.org/t/checking-objects-in-a-certain-area/28220 "2021-03-03T17:33:23Z")

</div>

İ = 8 J= 6 How can I check if there is a part between these rows and columns? If there is no part, I want to have an operation. Edit; I’m doing a chess-like game … example I want to check if there is a piece in row 6…

---

## [Rotate image with PVectors for game](https://discourse.processing.org/t/rotate-image-with-pvectors-for-game/28203)

<div class="topic-metadata">

**Author:** [@boomstick55](https://discourse.processing.org/u/boomstick55)\
**Replies:** 4\
**Last updated:** [March 3, 2021, 4:25pm UTC](https://discourse.processing.org/t/rotate-image-with-pvectors-for-game/28203 "2021-03-03T16:25:34Z")

</div>

For a project, I am making a simple top down shooter and I’m trying to incorporate a push pop rotation to the player character. I am having trouble having the character image rotate to the mouse coordinates ala pointing …

---

## [API gives NullPointerException](https://discourse.processing.org/t/api-gives-nullpointerexception/26792)

<div class="topic-metadata">

**Author:** [@AntiQliMax](https://discourse.processing.org/u/AntiQliMax)\
**Replies:** 1\
**Last updated:** [March 3, 2021, 2:08pm UTC](https://discourse.processing.org/t/api-gives-nullpointerexception/26792 "2021-03-03T14:08:56Z")

</div>

Dear users of this forum. I started learning API calls and tried it with some code I found on the old forum. The goal is i want to use the openweather API to check if it is raining, now the API works and the URL, but I…

---

## [HSL- Another colorful box](https://discourse.processing.org/t/hsl-another-colorful-box/28209)

<div class="topic-metadata">

**Author:** [@Apollo](https://discourse.processing.org/u/Apollo)\
**Replies:** 4\
**Last updated:** [March 3, 2021, 8:07am UTC](https://discourse.processing.org/t/hsl-another-colorful-box/28209 "2021-03-03T08:07:15Z")

</div>

Hey, Maybe you could help me here. I have to make an interactive HSL (Hue, Saturation, Lightness) Box in Processing. On top of the window, there should be a 500px wide and 50px tall color strip that will determine the…

---

## [Filling up the canvas with some paint](https://discourse.processing.org/t/filling-up-the-canvas-with-some-paint/28210)

<div class="topic-metadata">

**Author:** [@Apollo](https://discourse.processing.org/u/Apollo)\
**Replies:** 2\
**Last updated:** [March 3, 2021, 7:49am UTC](https://discourse.processing.org/t/filling-up-the-canvas-with-some-paint/28210 "2021-03-03T07:49:46Z")

</div>

Hi! I hope you could help me here. The code should create a 500x500 canvas and fills it in with a solid color (try maroon) using a 25px brush in 20 seconds. The brush goes from left to right for a layer/level/row, then…

---

## [Need help with this (sliding puzzle game)](https://discourse.processing.org/t/need-help-with-this-sliding-puzzle-game/28189)

<div class="topic-metadata">

**Author:** [@cocopuffs](https://discourse.processing.org/u/cocopuffs)\
**Replies:** 3\
**Last updated:** [March 3, 2021, 6:50am UTC](https://discourse.processing.org/t/need-help-with-this-sliding-puzzle-game/28189 "2021-03-03T06:50:12Z")

</div>

I’ve been working on this for quite some time and am very lost right now. I’m trying to figure out how to shuffle the image, and then have it set to where the player can rearrange the image using the white square so that…

---

## [First person camera help](https://discourse.processing.org/t/first-person-camera-help/28205)

<div class="topic-metadata">

**Author:** [@s31](https://discourse.processing.org/u/s31)\
**Replies:** 1\
**Last updated:** [March 3, 2021, 5:20am UTC](https://discourse.processing.org/t/first-person-camera-help/28205 "2021-03-03T05:20:20Z")

</div>

i’ve edited some code i found for a first person camera but cant figure out how to rotate y axis well inside the matrix and also how to stop the block from jittering around when i move the camera. any help would be appre…

---

## [How do I use mousePressed/mouseClicked for this part? (image order game)](https://discourse.processing.org/t/how-do-i-use-mousepressed-mouseclicked-for-this-part-image-order-game/28190)

<div class="topic-metadata">

**Author:** [@cocopuffs](https://discourse.processing.org/u/cocopuffs)\
**Replies:** 3\
**Last updated:** [March 3, 2021, 3:27am UTC](https://discourse.processing.org/t/how-do-i-use-mousepressed-mouseclicked-for-this-part-image-order-game/28190 "2021-03-03T03:27:02Z")

</div>

I’m just about done with this work, but I’m stuck on this part. the 4 images are shuffling as needed, but I need it to where the player clicks on the image in the correct order, and then the words “YOU WIN!” or “YOU LOSE…

---

## [How to instantiate class from String?](https://discourse.processing.org/t/how-to-instantiate-class-from-string/27641)

<div class="topic-metadata">

**Author:** [@molo32](https://discourse.processing.org/u/molo32)\
**Replies:** 7\
**Last updated:** [March 2, 2021, 8:25pm UTC](https://discourse.processing.org/t/how-to-instantiate-class-from-string/27641 "2021-03-02T20:25:02Z")

</div>

instantiate class from string I have the car class class car { ... } how can I do ArrayList \<Object\> cars = new ArrayList \<Object\> (); // Create an ArrayList object String s = "car" cars.add (new s()) I tried this…

---

## [Create a counter from 1 to 10 in secondes to my games](https://discourse.processing.org/t/create-a-counter-from-1-to-10-in-secondes-to-my-games/28193)

<div class="topic-metadata">

**Author:** [@Torikusu](https://discourse.processing.org/u/Torikusu)\
**Replies:** 1\
**Last updated:** [March 2, 2021, 8:05pm UTC](https://discourse.processing.org/t/create-a-counter-from-1-to-10-in-secondes-to-my-games/28193 "2021-03-02T20:05:14Z")

</div>

Hello, i would like to display on my games a stopwatch on my code, counting from 1 to 10 in secondes wel after 10 secondes it returns to 0 and its repeating float wait2 = 1000 - floor(millis()/1000)\*90; int lastTime = …

---

## [Arranging objects in random rows and columns](https://discourse.processing.org/t/arranging-objects-in-random-rows-and-columns/28163)

<div class="topic-metadata">

**Author:** [@Criste44](https://discourse.processing.org/u/Criste44)\
**Replies:** 10\
**Last updated:** [March 2, 2021, 12:07pm UTC](https://discourse.processing.org/t/arranging-objects-in-random-rows-and-columns/28163 "2021-03-02T12:07:54Z")

</div>

private void InitialSetup() { AddPiece(whiteRook, white, 0, 0); AddPiece(whiteKnight, white,1,2); AddPiece(whiteBishop, white,2,0); AddPiece(whiteQueen, white, 3,4); AddPiece(whiteKing, white, 4, 6); AddPiece(whit…

---

## [3d drawing with mouse](https://discourse.processing.org/t/3d-drawing-with-mouse/27738)

<div class="topic-metadata">

**Author:** [@jafal](https://discourse.processing.org/u/jafal)\
**Replies:** 36\
**Last updated:** [March 2, 2021, 11:47am UTC](https://discourse.processing.org/t/3d-drawing-with-mouse/27738 "2021-03-02T11:47:17Z")

</div>

Mr @Chrisir hi i read this post for you i need some headlights if you kind void setup() { size(600, 600, OPENGL); rectMode(CENTER); } void draw() { background(0); lights(); translate(width/2, heigh…

---

## [Vector field to an array (Aborigines Art)](https://discourse.processing.org/t/vector-field-to-an-array-aborigines-art/27839)

<div class="topic-metadata">

**Author:** [@Hiram-Belgium](https://discourse.processing.org/u/Hiram-Belgium)\
**Replies:** 14\
**Last updated:** [March 2, 2021, 11:25am UTC](https://discourse.processing.org/t/vector-field-to-an-array-aborigines-art/27839 "2021-03-02T11:25:22Z")

</div>

Hello (please excuse my poor English I am French speaking Belgian) I would like to know how I could put all the points of a vector field in an array?My goal is to replace the lines of my vector field with circles to simu…

---

## [How to add image to terrain sketch](https://discourse.processing.org/t/how-to-add-image-to-terrain-sketch/28158)

<div class="topic-metadata">

**Author:** [@jafal](https://discourse.processing.org/u/jafal)\
**Replies:** 1\
**Last updated:** [March 2, 2021, 7:55am UTC](https://discourse.processing.org/t/how-to-add-image-to-terrain-sketch/28158 "2021-03-02T07:55:31Z")

</div>

hi how to add text and image to this sketch int cols, rows; int scl = 13; int w = 1200; int h = 1600; float flying = 0; //int scl = 10; //int w = 1900; //int h = 2600; float\[\]\[\] terrain; void setup() { size (600…

---

## [Time elapsed correlated with FrameCount](https://discourse.processing.org/t/time-elapsed-correlated-with-framecount/28004)

<div class="topic-metadata">

**Author:** [@bking](https://discourse.processing.org/u/bking)\
**Replies:** 13\
**Last updated:** [March 1, 2021, 6:08pm UTC](https://discourse.processing.org/t/time-elapsed-correlated-with-framecount/28004 "2021-03-01T18:08:01Z")

</div>

Hello guys and girls, Hi made a function to see seconds elapsed from the the first frame. I did like that int Time=0; void setup (){ frameRate(30); } void TimeElapsed () { if ((frameCount%30)==0) { Time+=1; …

---

## [How to make Grid out of Boxes (3D)](https://discourse.processing.org/t/how-to-make-grid-out-of-boxes-3d/28070)

<div class="topic-metadata">

**Author:** [@jafal](https://discourse.processing.org/u/jafal)\
**Replies:** 29\
**Last updated:** [March 1, 2021, 2:59pm UTC](https://discourse.processing.org/t/how-to-make-grid-out-of-boxes-3d/28070 "2021-03-01T14:59:14Z")

</div>

@ Chrisir hi how are you int unit = 90; int count; Module\[\] mods; void setup() { size(600, 660, OPENGL); noStroke(); int wideCount = width / unit; int highCount = height / unit; int depthCount = h…

---

## [Create another window accessible with a key from the menu](https://discourse.processing.org/t/create-another-window-accessible-with-a-key-from-the-menu/28108)

<div class="topic-metadata">

**Author:** [@Torikusu](https://discourse.processing.org/u/Torikusu)\
**Replies:** 5\
**Last updated:** [March 1, 2021, 2:42pm UTC](https://discourse.processing.org/t/create-another-window-accessible-with-a-key-from-the-menu/28108 "2021-03-01T14:42:56Z")

</div>

Hello, I would like to create a third page (I have the menu and the games) except that it does not work here is the code with the error: float wait2 = 1000 - floor(millis()/1000)\*90; int lastTime = 0; int score = 0; …

---

## [Read file in zipped folder with password](https://discourse.processing.org/t/read-file-in-zipped-folder-with-password/27852)

<div class="topic-metadata">

**Author:** [@Marco0030](https://discourse.processing.org/u/Marco0030)\
**Replies:** 2\
**Last updated:** [March 1, 2021, 10:41am UTC](https://discourse.processing.org/t/read-file-in-zipped-folder-with-password/27852 "2021-03-01T10:41:10Z")

</div>

Hello. I’m new to processing. Is there a way to read and reproduce a file audio in a zipped folder with password? (i would like to avoid that someone could change the audiofiles) thank you

---

## [Can I use Blockbench for Processing, is it able to implement 3d objects and also 3d objects with animation?](https://discourse.processing.org/t/can-i-use-blockbench-for-processing-is-it-able-to-implement-3d-objects-and-also-3d-objects-with-animation/28119)

<div class="topic-metadata">

**Author:** [@SailorToei](https://discourse.processing.org/u/SailorToei)\
**Replies:** 3\
**Last updated:** [March 1, 2021, 7:37am UTC](https://discourse.processing.org/t/can-i-use-blockbench-for-processing-is-it-able-to-implement-3d-objects-and-also-3d-objects-with-animation/28119 "2021-03-01T07:37:50Z")

</div>

Hello everybody. I am just curious what is possible in Processing. I thought that at least adding a 3d object with animation to Javascript is possible, because of games like Minecraft and Yandere Simulator which were ori…

---

## [I need help with a life counter ending the game. I need it to end the program when the lives hit 0](https://discourse.processing.org/t/i-need-help-with-a-life-counter-ending-the-game-i-need-it-to-end-the-program-when-the-lives-hit-0/28154)

<div class="topic-metadata">

**Author:** [@ruvinson](https://discourse.processing.org/u/ruvinson)\
**Replies:** 1\
**Last updated:** [March 1, 2021, 6:27am UTC](https://discourse.processing.org/t/i-need-help-with-a-life-counter-ending-the-game-i-need-it-to-end-the-program-when-the-lives-hit-0/28154 "2021-03-01T06:27:07Z")

</div>

//START SCREEN int stateWaitBeforeProgram = 0; int stateNormalProgram = 1; int state = stateWaitBeforeProgram; //TIMER class Timer { int time; int duration; Timer() { duration = 100; reset(); } v…

---

## [Having trouble visualizing twitter data](https://discourse.processing.org/t/having-trouble-visualizing-twitter-data/28139)

<div class="topic-metadata">

**Author:** [@CodingNovice](https://discourse.processing.org/u/CodingNovice)\
**Replies:** 0\
**Last updated:** [February 28, 2021, 3:52pm UTC](https://discourse.processing.org/t/having-trouble-visualizing-twitter-data/28139 "2021-02-28T15:52:00Z")

</div>

Hi! I’m a processing novice and only have a limited understanding of coding, but I’m putting together a sketch for my final project in class. I have the basic code where every time the mouse is pressed, orbs spawn in a …

---

## [Test whether a button has been pressed even when the program is minimized](https://discourse.processing.org/t/test-whether-a-button-has-been-pressed-even-when-the-program-is-minimized/28114)

<div class="topic-metadata">

**Author:** [@Flolo](https://discourse.processing.org/u/Flolo)\
**Replies:** 0\
**Last updated:** [February 27, 2021, 2:24pm UTC](https://discourse.processing.org/t/test-whether-a-button-has-been-pressed-even-when-the-program-is-minimized/28114 "2021-02-27T14:24:22Z")

</div>

Hi I want to create a program that runs in the background and tests whether a key has been pressed. Like a keylogger… I need that because when I press ALT & S, for example, I want to take a screenshot. Here is the Code…

---

## [How to use nested for-loop to draw a tree](https://discourse.processing.org/t/how-to-use-nested-for-loop-to-draw-a-tree/28102)

<div class="topic-metadata">

**Author:** [@Yeladogg](https://discourse.processing.org/u/Yeladogg)\
**Replies:** 2\
**Last updated:** [February 27, 2021, 2:18am UTC](https://discourse.processing.org/t/how-to-use-nested-for-loop-to-draw-a-tree/28102 "2021-02-27T02:18:08Z")

</div>

Hi everyone, Should I use nested triple for loop to do it? This is my goal: here is my code : int x,y,w,h; void setup() { background(255); size(500, 500); x=250;//The center of the starting circle at the t…

---

## [Shear box left and right AND up and down?](https://discourse.processing.org/t/shear-box-left-and-right-and-up-and-down/28067)

<div class="topic-metadata">

**Author:** [@jetjaguar](https://discourse.processing.org/u/jetjaguar)\
**Replies:** 5\
**Last updated:** [February 25, 2021, 8:52pm UTC](https://discourse.processing.org/t/shear-box-left-and-right-and-up-and-down/28067 "2021-02-25T20:52:26Z")

</div>

Hello everyone! I am trying to skew a box left and right and up and down. If the box is rotated appropriately (I am actually using a .obj file for the box, because I’ll want to use other .obj files after this test), I c…

---

## [Loading a .PNG image into PGraphics](https://discourse.processing.org/t/loading-a-png-image-into-pgraphics/28064)

<div class="topic-metadata">

**Author:** [@IRIGIMA](https://discourse.processing.org/u/IRIGIMA)\
**Replies:** 2\
**Last updated:** [February 24, 2021, 9:53pm UTC](https://discourse.processing.org/t/loading-a-png-image-into-pgraphics/28064 "2021-02-24T21:53:51Z")

</div>

Is there a very simple way of loading an image into PGraphics? I’m currently rendering direct to PGraphics and saving this as an image file: “1.PNG” If I want to continue the render, I need to load this image back int…

---

## [How to debug smooth color change in processing?](https://discourse.processing.org/t/how-to-debug-smooth-color-change-in-processing/28057)

<div class="topic-metadata">

**Author:** [@MExley](https://discourse.processing.org/u/MExley)\
**Replies:** 2\
**Last updated:** [February 24, 2021, 8:07pm UTC](https://discourse.processing.org/t/how-to-debug-smooth-color-change-in-processing/28057 "2021-02-24T20:07:15Z")

</div>

I have written code in which the stroke color should transition smoothly through red, orange, yellow, green etc. in a loop. The rest of the code works perfectly but I am having issues attaining the color transitions. It…

---

## [Help for a beginner please (asking for input a multi-digit variable)](https://discourse.processing.org/t/help-for-a-beginner-please-asking-for-input-a-multi-digit-variable/28053)

<div class="topic-metadata">

**Author:** [@freddukas](https://discourse.processing.org/u/freddukas)\
**Replies:** 6\
**Last updated:** [February 24, 2021, 7:11pm UTC](https://discourse.processing.org/t/help-for-a-beginner-please-asking-for-input-a-multi-digit-variable/28053 "2021-02-24T19:11:48Z")

</div>

Hello everyone, I’m quite new with coding and I would like to create a prime number detector using arduino. I have a pretty good idea how to do it using a divider variable and modulos. My problem is : how can I create…

---

## [Processing collision rect and circle (PacMan)](https://discourse.processing.org/t/processing-collision-rect-and-circle-pacman/28021)

<div class="topic-metadata">

**Author:** [@dimitris](https://discourse.processing.org/u/dimitris)\
**Replies:** 19\
**Last updated:** [February 24, 2021, 5:01pm UTC](https://discourse.processing.org/t/processing-collision-rect-and-circle-pacman/28021 "2021-02-24T17:01:52Z")

</div>

So this is my code\<3 So my question is how can the main character not be able to go through the “obstacles” as you want to call them. Yes, that, I need collision or something I​ do not know:( thanks a lot\<3 Face f1; Ene…

---

## [Hide and center cursor but still move camera](https://discourse.processing.org/t/hide-and-center-cursor-but-still-move-camera/28016)

<div class="topic-metadata">

**Author:** [@yeppii](https://discourse.processing.org/u/yeppii)\
**Replies:** 10\
**Last updated:** [February 24, 2021, 3:35pm UTC](https://discourse.processing.org/t/hide-and-center-cursor-but-still-move-camera/28016 "2021-02-24T15:35:57Z")

</div>

I want to hide the cursor and position it to the center of the window. I tried using the robot class to move cursor to the center of screen and it worked but the problem is I also need to be able to rotate the QueasyCam …

---

## [Trying to make a little app that saves all the characters that i type](https://discourse.processing.org/t/trying-to-make-a-little-app-that-saves-all-the-characters-that-i-type/27704)

<div class="topic-metadata">

**Author:** [@denis](https://discourse.processing.org/u/denis)\
**Replies:** 21\
**Last updated:** [February 24, 2021, 3:18pm UTC](https://discourse.processing.org/t/trying-to-make-a-little-app-that-saves-all-the-characters-that-i-type/27704 "2021-02-24T15:18:15Z")

</div>

Hey guys, howre you? I wanted to create something that can save all the characters that i type on my computer. I think is not that difficult, but i am kind of new with all this, so i dont know how to do it. Anyone that …

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

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