# Coding Questions

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

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

**Page:** 52

---

## [Using object type as variable](https://discourse.processing.org/t/using-object-type-as-variable/30531)

<div class="topic-metadata">

**Author:** [@StainlessHolz](https://discourse.processing.org/u/StainlessHolz)\
**Replies:** 4\
**Last updated:** [June 6, 2021, 4:03pm UTC](https://discourse.processing.org/t/using-object-type-as-variable/30531 "2021-06-06T16:03:44Z")

</div>

Hi all, I´ve made a program where the user can manipulate data with nodes. You can add input, output and different manipulation nodes. It is like the shader editor from Blender or the program whith which you can progra…

---

## [Help with Function (easing)](https://discourse.processing.org/t/help-with-function-easing/30527)

<div class="topic-metadata">

**Author:** [@tatyo](https://discourse.processing.org/u/tatyo)\
**Replies:** 3\
**Last updated:** [June 6, 2021, 11:03am UTC](https://discourse.processing.org/t/help-with-function-easing/30527 "2021-06-06T11:03:34Z")

</div>

Hi there! I am beginer to programming and i try to make a function for eg: easing: float x; float y; float easing = 0.005; void setup() { size(640, 360); } void easFunc(float a, float b, float c) { b = b+(a - b) …

---

## [How can I continue or separate mousePressed?](https://discourse.processing.org/t/how-can-i-continue-or-separate-mousepressed/30509)

<div class="topic-metadata">

**Author:** [@tzmy](https://discourse.processing.org/u/tzmy)\
**Replies:** 3\
**Last updated:** [June 5, 2021, 1:30pm UTC](https://discourse.processing.org/t/how-can-i-continue-or-separate-mousepressed/30509 "2021-06-05T13:30:30Z")

</div>

I want to make a very simple screen-changing game with processing. I am a beginner in coding and processing, so I use mousePressed for screen changing. But I found that I can’t do some functions. How can I continue …

---

## [Help with a hangman hangman game](https://discourse.processing.org/t/help-with-a-hangman-hangman-game/6481)

<div class="topic-metadata">

**Author:** [@thatone](https://discourse.processing.org/u/thatone)\
**Replies:** 6\
**Last updated:** [December 10, 2018, 8:51pm UTC](https://discourse.processing.org/t/help-with-a-hangman-hangman-game/6481 "2018-12-10T20:51:15Z")

</div>

Hello, I’m trying to make a hangman game, but I’m new to processing and a bit unsure on how to make it work. I would like to letters the array of words aren’t shown or something but when you press them it appears. I’ve…

---

## [Object-oriented programming, I need a description about how this code works](https://discourse.processing.org/t/object-oriented-programming-i-need-a-description-about-how-this-code-works/30498)

<div class="topic-metadata">

**Author:** [@UnderHok](https://discourse.processing.org/u/UnderHok)\
**Replies:** 4\
**Last updated:** [June 4, 2021, 9:46pm UTC](https://discourse.processing.org/t/object-oriented-programming-i-need-a-description-about-how-this-code-works/30498 "2021-06-04T21:46:17Z")

</div>

please format code with \</\> button \* homework policy \* asking questions help \*\*I need a description about how this code

---

## [Why constrain doesnt work](https://discourse.processing.org/t/why-constrain-doesnt-work/30489)

<div class="topic-metadata">

**Author:** [@zang](https://discourse.processing.org/u/zang)\
**Replies:** 1\
**Last updated:** [June 4, 2021, 8:27pm UTC](https://discourse.processing.org/t/why-constrain-doesnt-work/30489 "2021-06-04T20:27:31Z")

</div>

int cols, rows; int w = 20; ArrayList\<Cell\> grid = new ArrayList\<Cell\>(); ArrayList\<Cell\> stack = new ArrayList\<Cell\>(); Cell current; Ball begain; void setup() { size(820, 820,P3D); camera(width/2+100,height,7…

---

## [Switch between floors in house layout by clicking button](https://discourse.processing.org/t/switch-between-floors-in-house-layout-by-clicking-button/30475)

<div class="topic-metadata">

**Author:** [@lightbombs](https://discourse.processing.org/u/lightbombs)\
**Replies:** 9\
**Last updated:** [June 4, 2021, 9:00am UTC](https://discourse.processing.org/t/switch-between-floors-in-house-layout-by-clicking-button/30475 "2021-06-04T09:00:18Z")

</div>

This is the house layout of ground floor and first floor, the lights, radiators and windows turn on and off by clicking on them. What i want to do is, when i click top left the OG button it will show the first floor and…

---

## [Custom contains method for shapes](https://discourse.processing.org/t/custom-contains-method-for-shapes/30424)

<div class="topic-metadata">

**Author:** [@Frinkel](https://discourse.processing.org/u/Frinkel)\
**Replies:** 1\
**Last updated:** [June 4, 2021, 8:03am UTC](https://discourse.processing.org/t/custom-contains-method-for-shapes/30424 "2021-06-04T08:03:22Z")

</div>

Hi, I’m currently trying to create a “custom” version of the contains method, that is implemented for shapes of the type path. The main reason I’m not using the path shape is, that I would like to map a texture onto my …

---

## [Maze little problem](https://discourse.processing.org/t/maze-little-problem/30463)

<div class="topic-metadata">

**Author:** [@zang](https://discourse.processing.org/u/zang)\
**Replies:** 3\
**Last updated:** [June 4, 2021, 5:18am UTC](https://discourse.processing.org/t/maze-little-problem/30463 "2021-06-04T05:18:49Z")

</div>

int cols, rows; int w = 20; ArrayList\<Cell\> grid = new ArrayList\<Cell\>(); ArrayList\<Cell\> stack = new ArrayList\<Cell\>(); Cell current; void setup() { size(820, 820); cols = floor(width/w); rows = floor(heigh…

---

## [Save String to .txt file when the program is a standalone application](https://discourse.processing.org/t/save-string-to-txt-file-when-the-program-is-a-standalone-application/26898)

<div class="topic-metadata">

**Author:** [@THWU0412](https://discourse.processing.org/u/THWU0412)\
**Replies:** 5\
**Last updated:** [June 3, 2021, 11:15pm UTC](https://discourse.processing.org/t/save-string-to-txt-file-when-the-program-is-a-standalone-application/26898 "2021-06-03T23:15:08Z")

</div>

My program loads a .txt file via the loadStrings() command. Then it creates a new String and saves it to the .txt file via the saveStrings() command. My problem is that when i create a standalone application it creates…

---

## [Breaking a string into separate variables](https://discourse.processing.org/t/breaking-a-string-into-separate-variables/30445)

<div class="topic-metadata">

**Author:** [@xysogram](https://discourse.processing.org/u/xysogram)\
**Replies:** 3\
**Last updated:** [June 2, 2021, 5:31pm UTC](https://discourse.processing.org/t/breaking-a-string-into-separate-variables/30445 "2021-06-02T17:31:13Z")

</div>

Hi. Noob question—what is the best way to break a text string (sourced from an imported .csv) into individual variables (new char variable or similar for each character in the string)? The goal is to input text and conv…

---

## [See if two Strings are the same using recursivity (recursion)](https://discourse.processing.org/t/see-if-two-strings-are-the-same-using-recursivity-recursion/30419)

<div class="topic-metadata">

**Author:** [@oussama10](https://discourse.processing.org/u/oussama10)\
**Replies:** 8\
**Last updated:** [June 2, 2021, 8:02am UTC](https://discourse.processing.org/t/see-if-two-strings-are-the-same-using-recursivity-recursion/30419 "2021-06-02T08:02:41Z")

</div>

For a given character string, called, write a recursive function Boolean check(String s, String pattern) Which determines whether the given pattern matches the string. The pattern consists of letters and the special ch…

---

## [Making lines converge to a point](https://discourse.processing.org/t/making-lines-converge-to-a-point/30425)

<div class="topic-metadata">

**Author:** [@Th3cG](https://discourse.processing.org/u/Th3cG)\
**Replies:** 2\
**Last updated:** [June 1, 2021, 8:13pm UTC](https://discourse.processing.org/t/making-lines-converge-to-a-point/30425 "2021-06-01T20:13:39Z")

</div>

Hi, I’m working on my n-th mini project. I would like to have multiple parallel lines pointing to mouse position on a click. Here’s the code I wrote: //introducing vectors PVector vMouse, u, w; //introducing arrays //…

---

## [How to check if the response from get is the same as color?](https://discourse.processing.org/t/how-to-check-if-the-response-from-get-is-the-same-as-color/30417)

<div class="topic-metadata">

**Author:** [@MoonAlien822](https://discourse.processing.org/u/MoonAlien822)\
**Replies:** 7\
**Last updated:** [June 1, 2021, 6:28pm UTC](https://discourse.processing.org/t/how-to-check-if-the-response-from-get-is-the-same-as-color/30417 "2021-06-01T18:28:11Z")

</div>

int x=1; int y=1; import java.awt.Robot; import java.awt.image.BufferedImage; import java.awt.Rectangle; color pas = color(11, 96, 133); //this is the color Robot robot; void setup() { size(1500, 3000); try { ro…

---

## [Help with error in Robot class and createScreenCapture() method](https://discourse.processing.org/t/help-with-error-in-robot-class-and-createscreencapture-method/30396)

<div class="topic-metadata">

**Author:** [@MoonAlien822](https://discourse.processing.org/u/MoonAlien822)\
**Replies:** 5\
**Last updated:** [June 1, 2021, 11:22am UTC](https://discourse.processing.org/t/help-with-error-in-robot-class-and-createscreencapture-method/30396 "2021-06-01T11:22:25Z")

</div>

PImage screenshot; import java.awt.Robot; void setup() { size(400,300); } void draw() { try { Robot robot = new Robot(); screenshot = new PImage(robot.createScreenCapture(new Rectangle(0,0,screen.width,screen.hei…

---

## [AI reinforcement learning](https://discourse.processing.org/t/ai-reinforcement-learning/30369)

<div class="topic-metadata">

**Author:** [@ctremblay](https://discourse.processing.org/u/ctremblay)\
**Replies:** 8\
**Last updated:** [May 31, 2021, 3:31pm UTC](https://discourse.processing.org/t/ai-reinforcement-learning/30369 "2021-05-31T15:31:42Z")

</div>

I’m trying to learn reinforcement learning for AI so far i been told the way to program it is make a table with the actions I want the player to do, but when looking at youtube reinforcement learning ai they are getting …

---

## [Please guys help me, I am trying to complete this morphing between obj](https://discourse.processing.org/t/please-guys-help-me-i-am-trying-to-complete-this-morphing-between-obj/30383)

<div class="topic-metadata">

**Author:** [@bello](https://discourse.processing.org/u/bello)\
**Replies:** 2\
**Last updated:** [May 31, 2021, 3:30pm UTC](https://discourse.processing.org/t/please-guys-help-me-i-am-trying-to-complete-this-morphing-between-obj/30383 "2021-05-31T15:30:34Z")

</div>

please format code with \</\> button \* homework policy \* asking questions \< PShape obj; PShape objB; PShape objC; PShape objD; int children = obj.getChildCount(); //onj=teapot objB=pianta objC=teschio objD=mano Ar…

---

## [A condition expression should not be reduced to an assignment](https://discourse.processing.org/t/a-condition-expression-should-not-be-reduced-to-an-assignment/30395)

<div class="topic-metadata">

**Author:** [@zang](https://discourse.processing.org/u/zang)\
**Replies:** 2\
**Last updated:** [May 31, 2021, 2:50pm UTC](https://discourse.processing.org/t/a-condition-expression-should-not-be-reduced-to-an-assignment/30395 "2021-05-31T14:50:02Z")

</div>

boolean check(){ for (int j = 0; j \< grid.size(); j++) { if (grid.get(j-1).visited = true ) { return true; } } } i want run some fuction after the class in a arraylist all been visited. …

---

## [Why does my program return the error, Cannot find a class or type named “Robot”?](https://discourse.processing.org/t/why-does-my-program-return-the-error-cannot-find-a-class-or-type-named-robot/30394)

<div class="topic-metadata">

**Author:** [@MoonAlien822](https://discourse.processing.org/u/MoonAlien822)\
**Replies:** 1\
**Last updated:** [May 31, 2021, 2:40pm UTC](https://discourse.processing.org/t/why-does-my-program-return-the-error-cannot-find-a-class-or-type-named-robot/30394 "2021-05-31T14:40:44Z")

</div>

why does my program return the error, Cannot find a class or type named “Robot”?

---

## [How do i pass a class type into a function](https://discourse.processing.org/t/how-do-i-pass-a-class-type-into-a-function/30337)

<div class="topic-metadata">

**Author:** [@canslp](https://discourse.processing.org/u/canslp)\
**Replies:** 10\
**Last updated:** [May 30, 2021, 2:19pm UTC](https://discourse.processing.org/t/how-do-i-pass-a-class-type-into-a-function/30337 "2021-05-30T14:19:10Z")

</div>

maybe i’m going about this wrong, but i have a base class with a run function, and i want each child class to be able to pass a different class type into it when they use it. the base class is called ‘spawner’, and each…

---

## [SpriteSheet Loader Nullpointer Why?](https://discourse.processing.org/t/spritesheet-loader-nullpointer-why/30334)

<div class="topic-metadata">

**Author:** [@Tanghe](https://discourse.processing.org/u/Tanghe)\
**Replies:** 1\
**Last updated:** [May 28, 2021, 11:06am UTC](https://discourse.processing.org/t/spritesheet-loader-nullpointer-why/30334 "2021-05-28T11:06:58Z")

</div>

Hello so when i try using the code below i get a nullpointer on line 36 and i dont c why. Anny help is welcomed. class Sprite { int numRows, numCols; int posX, posY; int counter; PImage img; int partW, partH;…

---

## [\[Help\] Add random flicker to pixel sorting](https://discourse.processing.org/t/help-add-random-flicker-to-pixel-sorting/30299)

<div class="topic-metadata">

**Author:** [@cwe2000](https://discourse.processing.org/u/cwe2000)\
**Replies:** 3\
**Last updated:** [May 28, 2021, 9:20am UTC](https://discourse.processing.org/t/help-add-random-flicker-to-pixel-sorting/30299 "2021-05-28T09:20:27Z")

</div>

Hey so I’m attempting to add a random flicker to the rendered image having the script select two random values for the pixel sort and have it flick between them. Potentially saving as a GIF or video. Here is the scri…

---

## [Trying to create a billiard game](https://discourse.processing.org/t/trying-to-create-a-billiard-game/30318)

<div class="topic-metadata">

**Author:** [@iox007](https://discourse.processing.org/u/iox007)\
**Replies:** 5\
**Last updated:** [May 26, 2021, 8:21pm UTC](https://discourse.processing.org/t/trying-to-create-a-billiard-game/30318 "2021-05-26T20:21:58Z")

</div>

Hey everyone, So my teacher gave me a task to create a billiard game which in all honesty is very very challenging. So far i have managed to create something but im stuggling with two issues: How can i aim the white ba…

---

## [P3D running extremely slow](https://discourse.processing.org/t/p3d-running-extremely-slow/30302)

<div class="topic-metadata">

**Author:** [@123](https://discourse.processing.org/u/123)\
**Replies:** 3\
**Last updated:** [May 26, 2021, 3:58pm UTC](https://discourse.processing.org/t/p3d-running-extremely-slow/30302 "2021-05-26T15:58:40Z")

</div>

Guys pls help I don’t know why this code runs really slow. //SEQUENCES OF MOVING CIRCLES float xPosition = 0; float yPosition; float aPosition = 0; float bPosition; float onePosition = 0; float twoPosition; float…

---

## [Collision of Circles and Lines](https://discourse.processing.org/t/collision-of-circles-and-lines/30296)

<div class="topic-metadata">

**Author:** [@SodaPopPop](https://discourse.processing.org/u/SodaPopPop)\
**Replies:** 1\
**Last updated:** [May 26, 2021, 3:28am UTC](https://discourse.processing.org/t/collision-of-circles-and-lines/30296 "2021-05-26T03:28:45Z")

</div>

Update: oh silly me, it seems like the code is working after all. I just wasn’t proficient at the game enough at first. Hello! I want to keep track of scores every time the “tail end” of a line touches a bouncing circle…

---

## [Loops with different colors](https://discourse.processing.org/t/loops-with-different-colors/30257)

<div class="topic-metadata">

**Author:** [@Kenga123456](https://discourse.processing.org/u/Kenga123456)\
**Replies:** 2\
**Last updated:** [May 25, 2021, 1:52pm UTC](https://discourse.processing.org/t/loops-with-different-colors/30257 "2021-05-25T13:52:28Z")

</div>

why doesn’t this code work? color\[\] c = new color \[6\]; int x; int l; void setup(){ size(900, 550); c\[0\]=color(8,100, 0); c\[1\]=color(12); c\[2\]=color(16); c\[3\]=color(4); c\[4\]=color(4); c\[5\]=color(4)…

---

## [Eyeball moving effect](https://discourse.processing.org/t/eyeball-moving-effect/30261)

<div class="topic-metadata">

**Author:** [@isaf12](https://discourse.processing.org/u/isaf12)\
**Replies:** 1\
**Last updated:** [May 24, 2021, 9:50pm UTC](https://discourse.processing.org/t/eyeball-moving-effect/30261 "2021-05-24T21:50:59Z")

</div>

Hi, I’m new to this. I wanted to created one simple eyeball with two ellipses. One being bigger for the white part of the eye and the other ellipse a little smaller which is the iris, the black part of the eye. I can get…

---

## [An undo and redo button for my drawing program](https://discourse.processing.org/t/an-undo-and-redo-button-for-my-drawing-program/30194)

<div class="topic-metadata">

**Author:** [@Kenga123456](https://discourse.processing.org/u/Kenga123456)\
**Replies:** 17\
**Last updated:** [May 24, 2021, 9:07pm UTC](https://discourse.processing.org/t/an-undo-and-redo-button-for-my-drawing-program/30194 "2021-05-24T21:07:18Z")

</div>

I have seen other peoples code of how to do it but I can’t seem to fully understand how it works. Especially when they have arrays and stuff. Someone please explain to me.

---

## [Connecting Points with a Line](https://discourse.processing.org/t/connecting-points-with-a-line/30243)

<div class="topic-metadata">

**Author:** [@SodaPopPop](https://discourse.processing.org/u/SodaPopPop)\
**Replies:** 5\
**Last updated:** [May 24, 2021, 1:05pm UTC](https://discourse.processing.org/t/connecting-points-with-a-line/30243 "2021-05-24T13:05:22Z")

</div>

Hello all! This is a continuation of my project from here! It is a bouncing ball that starts in random location with a random gravity acting on it. If you press with a mouse the velocity increases. There’s a chance the …

---

## [It's a question about how to use the code of ''Clear''](https://discourse.processing.org/t/its-a-question-about-how-to-use-the-code-of-clear/30236)

<div class="topic-metadata">

**Author:** [@yun](https://discourse.processing.org/u/yun)\
**Replies:** 6\
**Last updated:** [May 23, 2021, 12:54pm UTC](https://discourse.processing.org/t/its-a-question-about-how-to-use-the-code-of-clear/30236 "2021-05-23T12:54:15Z")

</div>

I have some problems when I write code. I try to design a game like a gold miner, and I want to use the left and right keys to move my hook. But when I write codes like this: function setup() { createCanvas(windowWidth…

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

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