# Processing

**URL:** https://discourse.processing.org/c/processing/6.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

---

## [Need to obtain object name in constructor(Solution:Referencing)](https://discourse.processing.org/t/need-to-obtain-object-name-in-constructor-solution-referencing/25039)

<div class="topic-metadata">

**Author:** [@xX\_pokeman2003\_Xx](https://discourse.processing.org/u/xX_pokeman2003_Xx)\
**Replies:** 10\
**Last updated:** [October 30, 2020, 9:13pm UTC](https://discourse.processing.org/t/need-to-obtain-object-name-in-constructor-solution-referencing/25039 "2020-10-30T21:13:29Z")

</div>

For transparency sake, I left the original post here, but the solution for the actual question itself is pretty simple:You can’t. HOWEVER, there is a work around that lets you do something similar, by referencing the obj…

---

## [How to create shuffling effect when mouse pressed and choose one when mouse is released](https://discourse.processing.org/t/how-to-create-shuffling-effect-when-mouse-pressed-and-choose-one-when-mouse-is-released/25054)

<div class="topic-metadata">

**Author:** [@ljna227](https://discourse.processing.org/u/ljna227)\
**Replies:** 0\
**Last updated:** [October 30, 2020, 5:50pm UTC](https://discourse.processing.org/t/how-to-create-shuffling-effect-when-mouse-pressed-and-choose-one-when-mouse-is-released/25054 "2020-10-30T17:50:45Z")

</div>

So I have an array of pictures and another array of names of the pictures. When the mouse is pressed, the names and pictures appear on the screen and shuffles. When the mouse is realeased, it stops at one image and corre…

---

## [LATEX in processing](https://discourse.processing.org/t/latex-in-processing/19691)

<div class="topic-metadata">

**Author:** [@shahroze](https://discourse.processing.org/u/shahroze)\
**Replies:** 14\
**Last updated:** [October 30, 2020, 1:54pm UTC](https://discourse.processing.org/t/latex-in-processing/19691 "2020-10-30T13:54:03Z")

</div>

how to use latex in processing for displaying equations. Is there a library for using latex or can i create it please give a detailed solution.

---

## [Processing on Microcontrollers?(Teensy, Arduino, etc.)](https://discourse.processing.org/t/processing-on-microcontrollers-teensy-arduino-etc/24962)

<div class="topic-metadata">

**Author:** [@onionwasabi](https://discourse.processing.org/u/onionwasabi)\
**Replies:** 5\
**Last updated:** [October 30, 2020, 9:47am UTC](https://discourse.processing.org/t/processing-on-microcontrollers-teensy-arduino-etc/24962 "2020-10-30T09:47:34Z")

</div>

Hi everyone. I am pretty sure there is a similar question but I couldn’t find the answer I want. Sorry if this is redundant. (I am a noob, still learning) My Question: Is there any way to run Processing on Microcontrol…

---

## [I feel like this is bad practice but I'm not sure why](https://discourse.processing.org/t/i-feel-like-this-is-bad-practice-but-im-not-sure-why/24937)

<div class="topic-metadata">

**Author:** [@wyattsworlddd](https://discourse.processing.org/u/wyattsworlddd)\
**Replies:** 9\
**Last updated:** [October 30, 2020, 9:36am UTC](https://discourse.processing.org/t/i-feel-like-this-is-bad-practice-but-im-not-sure-why/24937 "2020-10-30T09:36:04Z")

</div>

So this code below works, but I feel like maybe I should be doing something else to be more proper. if (s\<=9){ secs = "0" + s; } else { secs = "" + s; } Really simply, all I’m doing is adding a 0 to the f…

---

## [Need to run something after declaring an object](https://discourse.processing.org/t/need-to-run-something-after-declaring-an-object/25038)

<div class="topic-metadata">

**Author:** [@xX\_pokeman2003\_Xx](https://discourse.processing.org/u/xX_pokeman2003_Xx)\
**Replies:** 2\
**Last updated:** [October 30, 2020, 5:28am UTC](https://discourse.processing.org/t/need-to-run-something-after-declaring-an-object/25038 "2020-10-30T05:28:18Z")

</div>

I’m currently writing a bit of code I want to reuse in other projects. It’s a GUI framework. The problem is that I don’t want to constantly keep typing in a specific line of code every single time I start using whatever …

---

## [Controlp5 - Multiple buttons that use one function](https://discourse.processing.org/t/controlp5-multiple-buttons-that-use-one-function/4638)

<div class="topic-metadata">

**Author:** [@Zac-04](https://discourse.processing.org/u/Zac-04)\
**Replies:** 12\
**Last updated:** [October 30, 2020, 3:40am UTC](https://discourse.processing.org/t/controlp5-multiple-buttons-that-use-one-function/4638 "2020-10-30T03:40:38Z")

</div>

So let’s say I had a class that’s display was a button. How would I make it so that all of these classes’ buttons point to one function. e.g. //In my class: button = cp5.addButton("doThis"); //global scope: void doTh…

---

## [I need help with my game (snake game)](https://discourse.processing.org/t/i-need-help-with-my-game-snake-game/24984)

<div class="topic-metadata">

**Author:** [@umar](https://discourse.processing.org/u/umar)\
**Replies:** 9\
**Last updated:** [October 29, 2020, 11:44pm UTC](https://discourse.processing.org/t/i-need-help-with-my-game-snake-game/24984 "2020-10-29T23:44:32Z")

</div>

It’s actually a snake game, but with 16 by 8 blocks window size, where yellow is for banana(+10 points), red is for apple(+5 points) and green block is for cameleon(-5 points). The problem I’m facing is that my fruits ar…

---

## [Debug to processing pjs from processing 3](https://discourse.processing.org/t/debug-to-processing-pjs-from-processing-3/25004)

<div class="topic-metadata">

**Author:** [@adrianmc](https://discourse.processing.org/u/adrianmc)\
**Replies:** 4\
**Last updated:** [October 29, 2020, 6:13pm UTC](https://discourse.processing.org/t/debug-to-processing-pjs-from-processing-3/25004 "2020-10-29T18:13:47Z")

</div>

please format code with \</\> button \* homework policy \* asking questions Hi all I’m having a problem trying to upload this code to a website, I understand pjs runs with and older version of processing, however I’m not…

---

## [Need some help in creating a simulation](https://discourse.processing.org/t/need-some-help-in-creating-a-simulation/24999)

<div class="topic-metadata">

**Author:** [@Toninuin](https://discourse.processing.org/u/Toninuin)\
**Replies:** 4\
**Last updated:** [October 29, 2020, 10:02pm UTC](https://discourse.processing.org/t/need-some-help-in-creating-a-simulation/24999 "2020-10-29T22:02:32Z")

</div>

Hey people! I’m really new to processing and programming as a whole and I’m trying to do a simulation of a terrain with pseudo-realistic river flow logic. Its a 2D array with perlin noise that does the trick for the terr…

---

## [.lenght function](https://discourse.processing.org/t/lenght-function/25015)

<div class="topic-metadata">

**Author:** [@moms\_spaghetti](https://discourse.processing.org/u/moms_spaghetti)\
**Replies:** 1\
**Last updated:** [October 29, 2020, 3:56pm UTC](https://discourse.processing.org/t/lenght-function/25015 "2020-10-29T15:56:40Z")

</div>

Hello Am I the only one where the .lenght doesnt work?? String name = “test”; int lenght = name.lenght(); this gives me the error “The function “.lenght()” does not exist” while here https://processing.org/reference…

---

## [Moving a picture](https://discourse.processing.org/t/moving-a-picture/25018)

<div class="topic-metadata">

**Author:** [@AntiQliMax](https://discourse.processing.org/u/AntiQliMax)\
**Replies:** 1\
**Last updated:** [October 29, 2020, 4:02pm UTC](https://discourse.processing.org/t/moving-a-picture/25018 "2020-10-29T16:02:26Z")

</div>

Well at this point i worked a bit further, The goal is that a fish should jump from a random start position to another (hard coded route) to another end point. I know you guys don’t have the pictures and I am sorry for …

---

## [How to create button that makes lines of text appear randomly](https://discourse.processing.org/t/how-to-create-button-that-makes-lines-of-text-appear-randomly/25017)

<div class="topic-metadata">

**Author:** [@dreabirdflies](https://discourse.processing.org/u/dreabirdflies)\
**Replies:** 1\
**Last updated:** [October 29, 2020, 4:00pm UTC](https://discourse.processing.org/t/how-to-create-button-that-makes-lines-of-text-appear-randomly/25017 "2020-10-29T16:00:30Z")

</div>

please format code with \</\> button \* homework policy \* asking questions Wondering how to do this?

---

## [Need help with centipede / snake game](https://discourse.processing.org/t/need-help-with-centipede-snake-game/24982)

<div class="topic-metadata">

**Author:** [@zezo](https://discourse.processing.org/u/zezo)\
**Replies:** 8\
**Last updated:** [October 29, 2020, 3:45pm UTC](https://discourse.processing.org/t/need-help-with-centipede-snake-game/24982 "2020-10-29T15:45:26Z")

</div>

Hello guys! So I’ve been working on a snake game (kind of ) for school recently but I’m kinda stuck on a part. Because I need to add (invisible) pieces of food on screen and when the snake eats it, the snake needs to be…

---

## [If statement problems](https://discourse.processing.org/t/if-statement-problems/25012)

<div class="topic-metadata">

**Author:** [@AntiQliMax](https://discourse.processing.org/u/AntiQliMax)\
**Replies:** 4\
**Last updated:** [October 29, 2020, 1:40pm UTC](https://discourse.processing.org/t/if-statement-problems/25012 "2020-10-29T13:40:52Z")

</div>

Hello, I am new to processing and programming in general, as of a project for school I ran into a problem. The goal is that a random number will be generated, with a click on a the mouse, after that it should go to the …

---

## [Saving images from the window](https://discourse.processing.org/t/saving-images-from-the-window/24964)

<div class="topic-metadata">

**Author:** [@HumanoidX](https://discourse.processing.org/u/HumanoidX)\
**Replies:** 3\
**Last updated:** [October 29, 2020, 1:38am UTC](https://discourse.processing.org/t/saving-images-from-the-window/24964 "2020-10-29T01:38:10Z")

</div>

My question is, what is the difference between save() and saveFrame()? Which one must I use if I want to save, only the drawings inside the windows, not savijng mouse.

---

## [Planet Generation](https://discourse.processing.org/t/planet-generation/24966)

<div class="topic-metadata">

**Author:** [@HumanoidX](https://discourse.processing.org/u/HumanoidX)\
**Replies:** 2\
**Last updated:** [October 29, 2020, 1:37am UTC](https://discourse.processing.org/t/planet-generation/24966 "2020-10-29T01:37:29Z")

</div>

I’m doing a planet generation program. My code: import peasy.\*; PVector resolution = new PVector(200,200); PVector\[\]\[\] basicGlobe = new PVector\[round(resolution.x) + 1\]\[round(resolution.y) + 1\]; float radius = 400; P…

---

## [I need help with my snake game](https://discourse.processing.org/t/i-need-help-with-my-snake-game/24986)

<div class="topic-metadata">

**Author:** [@umar](https://discourse.processing.org/u/umar)\
**Replies:** 2\
**Last updated:** [October 28, 2020, 9:40pm UTC](https://discourse.processing.org/t/i-need-help-with-my-snake-game/24986 "2020-10-28T21:40:33Z")

</div>

but with 16 by 8 blocks window size, where yellow is for banana(+10 points), red is for apple(+5 points) and green block is for cameleon(-5 points). The problem I’m facing is that my fruits are never in the same coordina…

---

## [How to use for loop to draw a 9-sided polygon](https://discourse.processing.org/t/how-to-use-for-loop-to-draw-a-9-sided-polygon/24968)

<div class="topic-metadata">

**Author:** [@mengtong](https://discourse.processing.org/u/mengtong)\
**Replies:** 8\
**Last updated:** [October 28, 2020, 9:42pm UTC](https://discourse.processing.org/t/how-to-use-for-loop-to-draw-a-9-sided-polygon/24968 "2020-10-28T21:42:12Z")

</div>

I am trying to draw a 9-sided polygon, only use for loop, here is my code, but I don’t know what’s wrong with it. int points=9;//9-sided polygon size(600,600);//no setup and draw function float angle=0;//angle start f…

---

## [Avoid click audio](https://discourse.processing.org/t/avoid-click-audio/24961)

<div class="topic-metadata">

**Author:** [@Kompozitorz](https://discourse.processing.org/u/Kompozitorz)\
**Replies:** 5\
**Last updated:** [October 28, 2020, 5:10pm UTC](https://discourse.processing.org/t/avoid-click-audio/24961 "2020-10-28T17:10:57Z")

</div>

Hi! I have create a sketch in which two sound run simultaneously and I can switch between them… the problem is that when I switch between them (using mouse pressed and release) I hear a click. How can I solve the problem…

---

## [Calculate something written in a string](https://discourse.processing.org/t/calculate-something-written-in-a-string/24977)

<div class="topic-metadata">

**Author:** [@NumericPrime](https://discourse.processing.org/u/NumericPrime)\
**Replies:** 2\
**Last updated:** [October 28, 2020, 4:29pm UTC](https://discourse.processing.org/t/calculate-something-written-in-a-string/24977 "2020-10-28T16:29:02Z")

</div>

I’m currently writing a programm to solve equations. I have the following Problem: My equation will be in the form of a string. What I need is some kind of method to do something like. String calculation="5×(4+1\*3)";…

---

## [Processing library equivalent to p5's "Play" library?](https://discourse.processing.org/t/processing-library-equivalent-to-p5s-play-library/24973)

<div class="topic-metadata">

**Author:** [@SheCurvesMobius](https://discourse.processing.org/u/SheCurvesMobius)\
**Replies:** 0\
**Last updated:** [October 28, 2020, 3:23pm UTC](https://discourse.processing.org/t/processing-library-equivalent-to-p5s-play-library/24973 "2020-10-28T15:23:54Z")

</div>

Hi all, I’m wondering if Processing has a library that has similar functionality to p5’s play library? (The Play library contains functions that make collision, sprite animation, and mouse events much, much faster) Tha…

---

## [Color Gradient in Stroke](https://discourse.processing.org/t/color-gradient-in-stroke/24910)

<div class="topic-metadata">

**Author:** [@Ladan](https://discourse.processing.org/u/Ladan)\
**Replies:** 4\
**Last updated:** [October 28, 2020, 1:05pm UTC](https://discourse.processing.org/t/color-gradient-in-stroke/24910 "2020-10-28T13:05:46Z")

</div>

Hello! Is there any way, I can make a color gradient in the stroke of a button?

---

## [Help: How can I make this generator pause and resume between random videos?](https://discourse.processing.org/t/help-how-can-i-make-this-generator-pause-and-resume-between-random-videos/24881)

<div class="topic-metadata">

**Author:** [@malani](https://discourse.processing.org/u/malani)\
**Replies:** 4\
**Last updated:** [October 28, 2020, 10:39am UTC](https://discourse.processing.org/t/help-how-can-i-make-this-generator-pause-and-resume-between-random-videos/24881 "2020-10-28T10:39:04Z")

</div>

Hi all! I’m working on a random video generator that imitates TV with the mouseClicked to switch through the “channels”/videos. I am aiming to make it so that even if you aren’t on the “channel”, it still plays in the b…

---

## [Need help with these codes! (array)](https://discourse.processing.org/t/need-help-with-these-codes-array/24940)

<div class="topic-metadata">

**Author:** [@BettyBai](https://discourse.processing.org/u/BettyBai)\
**Replies:** 2\
**Last updated:** [October 28, 2020, 4:59am UTC](https://discourse.processing.org/t/need-help-with-these-codes-array/24940 "2020-10-28T04:59:53Z")

</div>

please format code with \</\> button \* homework policy \* asking questions My teacher is asking us to use Array and for loop functions to draw the same image many times. I tried to create new arrays for different variab…

---

## [Cant get sequence of images to save](https://discourse.processing.org/t/cant-get-sequence-of-images-to-save/24630)

<div class="topic-metadata">

**Author:** [@DeadMusik](https://discourse.processing.org/u/DeadMusik)\
**Replies:** 7\
**Last updated:** [October 28, 2020, 4:26am UTC](https://discourse.processing.org/t/cant-get-sequence-of-images-to-save/24630 "2020-10-28T04:26:07Z")

</div>

Hello, so I picked this code up off the net, its not mine but after doing some tweaks I was trying to get it to save images so I could upload into after effects, can you please tell me where I need to put my if statement…

---

## [Smooothing out Z height with sin()?](https://discourse.processing.org/t/smooothing-out-z-height-with-sin/24959)

<div class="topic-metadata">

**Author:** [@DeadMusik](https://discourse.processing.org/u/DeadMusik)\
**Replies:** 0\
**Last updated:** [October 28, 2020, 3:47am UTC](https://discourse.processing.org/t/smooothing-out-z-height-with-sin/24959 "2020-10-28T03:47:14Z")

</div>

Hello I have a sketch here I got watching the great Dan S. , I altered his Perlin noise terrain with some color now I want to be able to get the terrain to smooth out after going into the more extreme levels of z height.…

---

## [Different Paint tools for color picker](https://discourse.processing.org/t/different-paint-tools-for-color-picker/24931)

<div class="topic-metadata">

**Author:** [@kasper1](https://discourse.processing.org/u/kasper1)\
**Replies:** 6\
**Last updated:** [October 27, 2020, 10:44pm UTC](https://discourse.processing.org/t/different-paint-tools-for-color-picker/24931 "2020-10-27T22:44:02Z")

</div>

Hello everyone I am a beginner and I am trying to make four different drawing tools (one of them is a simple draw tool, i.e. dragging the mouse pointer draws pixels in the selected color; the other three tools could be, …

---

## [Random position of class objects](https://discourse.processing.org/t/random-position-of-class-objects/24950)

<div class="topic-metadata">

**Author:** [@MaxMax](https://discourse.processing.org/u/MaxMax)\
**Replies:** 3\
**Last updated:** [October 27, 2020, 9:13pm UTC](https://discourse.processing.org/t/random-position-of-class-objects/24950 "2020-10-27T21:13:39Z")

</div>

Hi, I managed to make my player ( the car ) collide with the obstacles that are falling down. I tried to make a class so I would be able to make the position, speed, and size of each obstacle random. But it doesn’t work …

---

## [Get non sketch active focused window size and position possible?](https://discourse.processing.org/t/get-non-sketch-active-focused-window-size-and-position-possible/24944)

<div class="topic-metadata">

**Author:** [@mrmatthewfelton](https://discourse.processing.org/u/mrmatthewfelton)\
**Replies:** 2\
**Last updated:** [October 27, 2020, 2:25pm UTC](https://discourse.processing.org/t/get-non-sketch-active-focused-window-size-and-position-possible/24944 "2020-10-27T14:25:53Z")

</div>

Hi. I’m super new to processing 3. is it possible to find the the size and position of an active window. by that I mean whatever window is currently the main focused and active window ? just need to know if its possible …

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

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