# Coding Questions

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

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

**Page:** 53

---

## [ArrayOutOfBoundException for pixels](https://discourse.processing.org/t/arrayoutofboundexception-for-pixels/30214)

<div class="topic-metadata">

**Author:** [@res56](https://discourse.processing.org/u/res56)\
**Replies:** 3\
**Last updated:** [May 23, 2021, 10:00am UTC](https://discourse.processing.org/t/arrayoutofboundexception-for-pixels/30214 "2021-05-23T10:00:36Z")

</div>

Why do I get an ArrayOutOfBoundException for this code? void setup(){ size(400,400); } void draw(){ background(44); loadPixels(); for(int x=0; x \< width; x++){ for(int y=0; y \< height; y++){ int index=(x+y\*width…

---

## [Debugging ArrayIndexOutOfBoundsException](https://discourse.processing.org/t/debugging-arrayindexoutofboundsexception/29988)

<div class="topic-metadata">

**Author:** [@elenanito](https://discourse.processing.org/u/elenanito)\
**Replies:** 5\
**Last updated:** [May 9, 2021, 10:01pm UTC](https://discourse.processing.org/t/debugging-arrayindexoutofboundsexception/29988 "2021-05-09T22:01:40Z")

</div>

I got this exception and the console says: java.lang.ArrayIndexOutOfBoundsException: 8 at programName.function(projectName.java:84) But there is nothing but comments on line 84 . my program has over 2000 lines so…

---

## [Resizing a PGraphics](https://discourse.processing.org/t/resizing-a-pgraphics/30227)

<div class="topic-metadata">

**Author:** [@paulgoux](https://discourse.processing.org/u/paulgoux)\
**Replies:** 3\
**Last updated:** [May 23, 2021, 10:29am UTC](https://discourse.processing.org/t/resizing-a-pgraphics/30227 "2021-05-23T10:29:34Z")

</div>

I’ve seen there’s been a previous post about this and thats great as the answer has technically already been posted, however I wanted to know what limitations this might have if i’m planning on making use of resize every…

---

## [If (int(geschlecht.charAt(0)) == 119) works, but if (geschlecht == "m") not](https://discourse.processing.org/t/if-int-geschlecht-charat-0-119-works-but-if-geschlecht-m-not/30212)

<div class="topic-metadata">

**Author:** [@Joghurt](https://discourse.processing.org/u/Joghurt)\
**Replies:** 7\
**Last updated:** [May 22, 2021, 1:16pm UTC](https://discourse.processing.org/t/if-int-geschlecht-charat-0-119-works-but-if-geschlecht-m-not/30212 "2021-05-22T13:16:52Z")

</div>

Hi I have a comprehension problem right now. I have a csv table which has, among other things, the column “GESCHLECHT\_HUND” with the possible entries “w” and “m” of type String. When I program it like this it doesn’t w…

---

## [Overlap multiple PGraphics with copy() function](https://discourse.processing.org/t/overlap-multiple-pgraphics-with-copy-function/30177)

<div class="topic-metadata">

**Author:** [@afkqs](https://discourse.processing.org/u/afkqs)\
**Replies:** 1\
**Last updated:** [May 22, 2021, 10:20am UTC](https://discourse.processing.org/t/overlap-multiple-pgraphics-with-copy-function/30177 "2021-05-22T10:20:42Z")

</div>

Hi there, I’m trying to overlap multiple fades using the copy() function that was suggested to me in a previous topic. My issue is that, as the top layer is fading away, because the shape is copied to the top of the ca…

---

## [How to use Processing 3d in IntelliJ using core library?](https://discourse.processing.org/t/how-to-use-processing-3d-in-intellij-using-core-library/30207)

<div class="topic-metadata">

**Author:** [@Eliott](https://discourse.processing.org/u/Eliott)\
**Replies:** 2\
**Last updated:** [May 22, 2021, 9:00am UTC](https://discourse.processing.org/t/how-to-use-processing-3d-in-intellij-using-core-library/30207 "2021-05-22T09:00:23Z")

</div>

i have this code: import processing.core.PApplet; public class Main extends PApplet { public void settings() { size(800,600, P3D); } public void setup() { } public void draw() { b…

---

## [How to text array](https://discourse.processing.org/t/how-to-text-array/30192)

<div class="topic-metadata">

**Author:** [@jafal](https://discourse.processing.org/u/jafal)\
**Replies:** 22\
**Last updated:** [May 21, 2021, 6:23pm UTC](https://discourse.processing.org/t/how-to-text-array/30192 "2021-05-21T18:23:41Z")

</div>

hi all how to text array elements i have try but i could not do it looks random and wrong code any help thanks in advance void setup () { size ( 800 , 800 ); } void draw () { fill(0); int\[\] x = { 50,…

---

## [Object-oriented programming for the GAME](https://discourse.processing.org/t/object-oriented-programming-for-the-game/30203)

<div class="topic-metadata">

**Author:** [@UnderHok](https://discourse.processing.org/u/UnderHok)\
**Replies:** 1\
**Last updated:** [May 21, 2021, 7:43am UTC](https://discourse.processing.org/t/object-oriented-programming-for-the-game/30203 "2021-05-21T07:43:00Z")

</div>

please format code with \</\> button \* homework policy \* asking questions help. How do I get the text input code to choose one of the two options and show the game board import java.util.Random; import java.util.Arra…

---

## [Lock app screen, home](https://discourse.processing.org/t/lock-app-screen-home/30191)

<div class="topic-metadata">

**Author:** [@Ezikaalex](https://discourse.processing.org/u/Ezikaalex)\
**Replies:** 1\
**Last updated:** [May 20, 2021, 1:02pm UTC](https://discourse.processing.org/t/lock-app-screen-home/30191 "2021-05-20T13:02:12Z")

</div>

please format code with \</\> button \* homework policy \* asking questions yes

---

## [How can I make an object remain in the x position it was fired from?](https://discourse.processing.org/t/how-can-i-make-an-object-remain-in-the-x-position-it-was-fired-from/30187)

<div class="topic-metadata">

**Author:** [@burritonacho](https://discourse.processing.org/u/burritonacho)\
**Replies:** 1\
**Last updated:** [May 20, 2021, 11:57am UTC](https://discourse.processing.org/t/how-can-i-make-an-object-remain-in-the-x-position-it-was-fired-from/30187 "2021-05-20T11:57:25Z")

</div>

I have a character moving back and forth across the screen that fires a projectile, and I want the projectile to stay on screen. The Y position part of my code is working, but I cannot get my projectiles to stay in the …

---

## [I am stuck with one small invisible error](https://discourse.processing.org/t/i-am-stuck-with-one-small-invisible-error/30170)

<div class="topic-metadata">

**Author:** [@zang](https://discourse.processing.org/u/zang)\
**Replies:** 5\
**Last updated:** [May 20, 2021, 11:39am UTC](https://discourse.processing.org/t/i-am-stuck-with-one-small-invisible-error/30170 "2021-05-20T11:39:32Z")

</div>

what i want to do is that when i click and mouse inside the quadrilateral，it will be divided to four pieces. there will be four mouse position for each piece .the four mouse position will move to four different position. …

---

## [How to make squares bounce off of each other?](https://discourse.processing.org/t/how-to-make-squares-bounce-off-of-each-other/30159)

<div class="topic-metadata">

**Author:** [@cannonman](https://discourse.processing.org/u/cannonman)\
**Replies:** 3\
**Last updated:** [May 19, 2021, 9:10pm UTC](https://discourse.processing.org/t/how-to-make-squares-bounce-off-of-each-other/30159 "2021-05-19T21:10:55Z")

</div>

please format code with \</\> button \* homework policy \* asking questions int \[\]xspeed; int \[\]yspeed; int \[\]xcor; int \[\]ycor; int \[\]direction; int \[\]steps; boolean movin\[\]; boolean gamemode; float r\[\]; float b\[\]; float…

---

## [Updating Digital Clock Reading to Always Match Current Time](https://discourse.processing.org/t/updating-digital-clock-reading-to-always-match-current-time/12363)

<div class="topic-metadata">

**Author:** [@per0\_22](https://discourse.processing.org/u/per0_22)\
**Replies:** 4\
**Last updated:** [May 18, 2021, 9:35pm UTC](https://discourse.processing.org/t/updating-digital-clock-reading-to-always-match-current-time/12363 "2021-05-18T21:35:33Z")

</div>

Hello. This is my first post so please correct me if my formatting is awful. I am trying to have a simple date and time print onto the monitor. I am able to print the values using their corresponding functions from proc…

---

## [Saving every frame in SVG](https://discourse.processing.org/t/saving-every-frame-in-svg/30152)

<div class="topic-metadata">

**Author:** [@ecce13](https://discourse.processing.org/u/ecce13)\
**Replies:** 1\
**Last updated:** [May 18, 2021, 12:01pm UTC](https://discourse.processing.org/t/saving-every-frame-in-svg/30152 "2021-05-18T12:01:26Z")

</div>

Hey, I’m completely new to this, and this is an assignment for me, so pardon if there’s any errors in the code. I’ve been trying to implement SVG saving so I can edit the file in Illustrator, but I can’t seem to save the…

---

## [Find direction vector is in](https://discourse.processing.org/t/find-direction-vector-is-in/30161)

<div class="topic-metadata">

**Author:** [@fede4961](https://discourse.processing.org/u/fede4961)\
**Replies:** 2\
**Last updated:** [May 18, 2021, 9:12pm UTC](https://discourse.processing.org/t/find-direction-vector-is-in/30161 "2021-05-18T21:12:48Z")

</div>

I currently have 2 vectors: PVector a = new PVector ( 100, 100 ); PVector b = new PVector ( 500, 500 ); I need to set a’s heading so that it lines up with b. I’ve been struggling with this for a few days: I tried using…

---

## [Drawing Line with Bouncing Ball](https://discourse.processing.org/t/drawing-line-with-bouncing-ball/30130)

<div class="topic-metadata">

**Author:** [@SodaPopPop](https://discourse.processing.org/u/SodaPopPop)\
**Replies:** 8\
**Last updated:** [May 18, 2021, 3:23am UTC](https://discourse.processing.org/t/drawing-line-with-bouncing-ball/30130 "2021-05-18T03:23:32Z")

</div>

Hello! I am a beginner, and I’m very new to processing! I have a project in mind that I have no idea how to execute. I want to create something from the bouncing ball example. Supposedly, the code will draw a line from …

---

## [Objects in P3D look weird (clipping)](https://discourse.processing.org/t/objects-in-p3d-look-weird-clipping/30094)

<div class="topic-metadata">

**Author:** [@Eastern](https://discourse.processing.org/u/Eastern)\
**Replies:** 4\
**Last updated:** [May 17, 2021, 6:59am UTC](https://discourse.processing.org/t/objects-in-p3d-look-weird-clipping/30094 "2021-05-17T06:59:14Z")

</div>

Demonstration video: HERE I was making a first person maze game in P3D and encountered this problem. It seems like when I get too close to an object, I see through it. The camera haven’t even reached the surface of the …

---

## [Moving boundaries in box2D](https://discourse.processing.org/t/moving-boundaries-in-box2d/23844)

<div class="topic-metadata">

**Author:** [@arcadeperfect](https://discourse.processing.org/u/arcadeperfect)\
**Replies:** 2\
**Last updated:** [May 16, 2021, 3:27am UTC](https://discourse.processing.org/t/moving-boundaries-in-box2d/23844 "2021-05-16T03:27:10Z")

</div>

Hi, I’m looking for some kind of ChainShape or similar that I can update the position of manually to act as a moving boundary for dynamic objects. They should collide but not respond to forces. I’m trying to make a sim…

---

## [Initialize subclass of PGraphics](https://discourse.processing.org/t/initialize-subclass-of-pgraphics/30113)

<div class="topic-metadata">

**Author:** [@Tomfoolery](https://discourse.processing.org/u/Tomfoolery)\
**Replies:** 2\
**Last updated:** [May 16, 2021, 12:26am UTC](https://discourse.processing.org/t/initialize-subclass-of-pgraphics/30113 "2021-05-16T00:26:10Z")

</div>

I’m working in the Eclipse environment and am looking to create a new class (TGraphics) that extends PGraphics. I want to do this so that I can polymorph the beginDraw() method to send an message to my event bus every t…

---

## [Is there a way to stop the register method?](https://discourse.processing.org/t/is-there-a-way-to-stop-the-register-method/30107)

<div class="topic-metadata">

**Author:** [@Flolo](https://discourse.processing.org/u/Flolo)\
**Replies:** 1\
**Last updated:** [May 15, 2021, 12:50pm UTC](https://discourse.processing.org/t/is-there-a-way-to-stop-the-register-method/30107 "2021-05-15T12:50:23Z")

</div>

Hey it’s me again i wanted to ask how to remove the register method. Because it now calls for every object created in the background and I don’t want that. Here is a small example that I made. The function destroy () …

---

## [Making a keyPressed do a launch and launch sequence?](https://discourse.processing.org/t/making-a-keypressed-do-a-launch-and-launch-sequence/30077)

<div class="topic-metadata">

**Author:** [@yagirl\_belle](https://discourse.processing.org/u/yagirl_belle)\
**Replies:** 2\
**Last updated:** [May 14, 2021, 2:48pm UTC](https://discourse.processing.org/t/making-a-keypressed-do-a-launch-and-launch-sequence/30077 "2021-05-14T14:48:03Z")

</div>

Hey everyone, I’m trying to do a launch sequence by pressing the same key twice. 1st press = start launch, 2nd press = launch object I’m not certain how to do this and what I need to use. I’m using booleans to run the …

---

## [Making an object stop, and move forward when key pressed (power bar)](https://discourse.processing.org/t/making-an-object-stop-and-move-forward-when-key-pressed-power-bar/29936)

<div class="topic-metadata">

**Author:** [@Trish](https://discourse.processing.org/u/Trish)\
**Replies:** 3\
**Last updated:** [May 13, 2021, 8:26pm UTC](https://discourse.processing.org/t/making-an-object-stop-and-move-forward-when-key-pressed-power-bar/29936 "2021-05-13T20:26:13Z")

</div>

Hello, I’m trying to code a ball that, when the program is executed, moves side to side. When a key is pressed (and held down), a power bar appears displaying how much power the ball is going to shoot with when the key i…

---

## [How to draw a circle in 3D when i have an array of n points that lay on the circle](https://discourse.processing.org/t/how-to-draw-a-circle-in-3d-when-i-have-an-array-of-n-points-that-lay-on-the-circle/30083)

<div class="topic-metadata">

**Author:** [@knoedel](https://discourse.processing.org/u/knoedel)\
**Replies:** 2\
**Last updated:** [May 13, 2021, 3:16pm UTC](https://discourse.processing.org/t/how-to-draw-a-circle-in-3d-when-i-have-an-array-of-n-points-that-lay-on-the-circle/30083 "2021-05-13T15:16:51Z")

</div>

Hello everyone! I am working on a project where I want to visualize the Hopf Fibration using the stereographic projection from 4D onto 3D. The maths part is working fine, but I have problems plotting the circles in 3D …

---

## [Change moving angle by changing the moving directions/speeds](https://discourse.processing.org/t/change-moving-angle-by-changing-the-moving-directions-speeds/30065)

<div class="topic-metadata">

**Author:** [@helloscoopz](https://discourse.processing.org/u/helloscoopz)\
**Replies:** 12\
**Last updated:** [May 13, 2021, 3:12pm UTC](https://discourse.processing.org/t/change-moving-angle-by-changing-the-moving-directions-speeds/30065 "2021-05-13T15:12:00Z")

</div>

void turn(float angle) { // need to change xSpeed and ySpeed so that object will move // with that changed angle } My problem is that I need to change the direction of the moving object counterclockwise with the a…

---

## [Is there any feasible way to use a model created using teachable machine in processing?](https://discourse.processing.org/t/is-there-any-feasible-way-to-use-a-model-created-using-teachable-machine-in-processing/30085)

<div class="topic-metadata">

**Author:** [@bontempos](https://discourse.processing.org/u/bontempos)\
**Replies:** 0\
**Last updated:** [May 13, 2021, 1:53pm UTC](https://discourse.processing.org/t/is-there-any-feasible-way-to-use-a-model-created-using-teachable-machine-in-processing/30085 "2021-05-13T13:53:59Z")

</div>

I’m in between converting to P5 a huge amount of matrix calculations I made a while ago for processing… because, then, I can use the ml5 library with image classification. But that’s a bit silly if I can have a simple w…

---

## [Implement friction and gravity in a simple Spring](https://discourse.processing.org/t/implement-friction-and-gravity-in-a-simple-spring/30070)

<div class="topic-metadata">

**Author:** [@ikermorales](https://discourse.processing.org/u/ikermorales)\
**Replies:** 1\
**Last updated:** [May 12, 2021, 9:00pm UTC](https://discourse.processing.org/t/implement-friction-and-gravity-in-a-simple-spring/30070 "2021-05-12T21:00:45Z")

</div>

Hello, Im trying to make a Spring in Proccesing, I need to add “friction” and “gravity” to my Spring to finish the project but I dont figure it out how. I have managed to get here, I have created a basic Spring, but I d…

---

## [TicTacToe Game Support](https://discourse.processing.org/t/tictactoe-game-support/30050)

<div class="topic-metadata">

**Author:** [@Syntax64](https://discourse.processing.org/u/Syntax64)\
**Replies:** 6\
**Last updated:** [May 12, 2021, 3:54pm UTC](https://discourse.processing.org/t/tictactoe-game-support/30050 "2021-05-12T15:54:22Z")

</div>

What am I missing? Right Click works, but not Left Click. Most, if not all the code should be correct. Am i messing up a loop somewhere? I tried debugging but to no avail char\[\]\[\] mat; boolean xturn; void setup(){ siz…

---

## [Data type for ArrayList get() function (class, OOP)](https://discourse.processing.org/t/data-type-for-arraylist-get-function-class-oop/30049)

<div class="topic-metadata">

**Author:** [@MBMNGT](https://discourse.processing.org/u/MBMNGT)\
**Replies:** 5\
**Last updated:** [May 12, 2021, 9:31am UTC](https://discourse.processing.org/t/data-type-for-arraylist-get-function-class-oop/30049 "2021-05-12T09:31:31Z")

</div>

Hi For Array List functions, I would like to know the type of data returned by the Particle part = particles.get(0) function ? after some try, ;;; it’s not float or int or string … so, what is ? Thank in advance Eric …

---

## [How to make flag?](https://discourse.processing.org/t/how-to-make-flag/30055)

<div class="topic-metadata">

**Author:** [@savaxn](https://discourse.processing.org/u/savaxn)\
**Replies:** 1\
**Last updated:** [May 11, 2021, 7:46pm UTC](https://discourse.processing.org/t/how-to-make-flag/30055 "2021-05-11T19:46:03Z")

</div>

please format code with \</\> button \* homework policy \* asking questions The flag should move once every few seconds to the right and then to the left

---

## [How to save login](https://discourse.processing.org/t/how-to-save-login/30033)

<div class="topic-metadata">

**Author:** [@jessie\_lorentzen1](https://discourse.processing.org/u/jessie_lorentzen1)\
**Replies:** 1\
**Last updated:** [May 11, 2021, 8:10am UTC](https://discourse.processing.org/t/how-to-save-login/30033 "2021-05-11T08:10:57Z")

</div>

Hi guys. I’m coding an app at the moment, but i’m having trouble makeing it save the sign up data in the program. Any tips or exampels to what i might do?

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

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