# Coding Questions

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

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

**Page:** 133

---

## [Passing multiple values between methods/classes](https://discourse.processing.org/t/passing-multiple-values-between-methods-classes/12605)

<div class="topic-metadata">

**Author:** [@cardori](https://discourse.processing.org/u/cardori)\
**Replies:** 1\
**Last updated:** [July 12, 2019, 7:59pm UTC](https://discourse.processing.org/t/passing-multiple-values-between-methods-classes/12605 "2019-07-12T19:59:21Z")

</div>

Hi. I’m creating an Hexagonal grid I have the points for creating it already(edges). The method cell calculates the creation of one hexagon and then it is passed to the method grid where the grid is created. The proble…

---

## [PImage scale when mouse is over](https://discourse.processing.org/t/pimage-scale-when-mouse-is-over/12641)

<div class="topic-metadata">

**Author:** [@edor97](https://discourse.processing.org/u/edor97)\
**Replies:** 4\
**Last updated:** [July 12, 2019, 7:46pm UTC](https://discourse.processing.org/t/pimage-scale-when-mouse-is-over/12641 "2019-07-12T19:46:20Z")

</div>

Hello, is it possible to scale a PImage by 10% when the mouse is over it and return to its normal size after the mouse is clicked? void settings() { size(1080, 720, P2D); smooth(); } void setup() { //Sfondo U…

---

## [Change image color](https://discourse.processing.org/t/change-image-color/12685)

<div class="topic-metadata">

**Author:** [@The\_nish](https://discourse.processing.org/u/The_nish)\
**Replies:** 5\
**Last updated:** [July 12, 2019, 4:56pm UTC](https://discourse.processing.org/t/change-image-color/12685 "2019-07-12T16:56:01Z")

</div>

i have 2 images a and b which is listed below. my both images are in rgb format . i want to change color of “b” image like “a” image by processing. tell me how it is possible. …

---

## [Reaction Diffusion : add an image](https://discourse.processing.org/t/reaction-diffusion-add-an-image/12552)

<div class="topic-metadata">

**Author:** [@alice](https://discourse.processing.org/u/alice)\
**Replies:** 4\
**Last updated:** [July 11, 2019, 7:52pm UTC](https://discourse.processing.org/t/reaction-diffusion-add-an-image/12552 "2019-07-11T19:52:21Z")

</div>

Hi Everybody, I hope someone can help : I have the reaction diffusion code based on points, what I’m trying to do is to add a black and white image inside the code and say in the condition loop that I want to apply t…

---

## [All these circles make a square?](https://discourse.processing.org/t/all-these-circles-make-a-square/12674)

<div class="topic-metadata">

**Author:** [@paulgoux](https://discourse.processing.org/u/paulgoux)\
**Replies:** 3\
**Last updated:** [July 11, 2019, 6:53pm UTC](https://discourse.processing.org/t/all-these-circles-make-a-square/12674 "2019-07-11T18:53:38Z")

</div>

I’m probably missing something real basic, but I can’t seem to understand why all my circles seem to make squares. void draw(){ fill(255); text(this.electrons,this.x+30,this.y); fill(0); ellipseMode(CENT…

---

## [Antialiasing FXAA](https://discourse.processing.org/t/antialiasing-fxaa/12631)

<div class="topic-metadata">

**Author:** [@Stanlepunk](https://discourse.processing.org/u/Stanlepunk)\
**Replies:** 1\
**Last updated:** [July 11, 2019, 5:11pm UTC](https://discourse.processing.org/t/antialiasing-fxaa/12631 "2019-07-11T17:11:47Z")

</div>

I try to code an antialiasing FXAA, but the result is very far of my dream ; I’ve a feeling to code the right thing, like I found in different post…but that’s dont work and give a me a very glitch result. The problem to…

---

## [Make a camera who follow a player](https://discourse.processing.org/t/make-a-camera-who-follow-a-player/12471)

<div class="topic-metadata">

**Author:** [@vincentstrebelle](https://discourse.processing.org/u/vincentstrebelle)\
**Replies:** 3\
**Last updated:** [July 10, 2019, 11:16am UTC](https://discourse.processing.org/t/make-a-camera-who-follow-a-player/12471 "2019-07-10T11:16:41Z")

</div>

Hi everyone, i want to make a camera who follow my player ( i allready make a topic about it but now it’s a bit different) so, i need a camera who follow the player but not linked to the screen so if i change the size o…

---

## [The unit fraction problem](https://discourse.processing.org/t/the-unit-fraction-problem/12633)

<div class="topic-metadata">

**Author:** [@InferNova](https://discourse.processing.org/u/InferNova)\
**Replies:** 0\
**Last updated:** [July 9, 2019, 11:08pm UTC](https://discourse.processing.org/t/the-unit-fraction-problem/12633 "2019-07-09T23:08:05Z")

</div>

Hey Guys ! In university this year I was given a problem to solve ( or get the best possible solution ). It involves unit fractions and trying to get the largest set of unit fractions to add up to 1. So for example a se…

---

## [OpenGL - cannot load shapes(objects)](https://discourse.processing.org/t/opengl-cannot-load-shapes-objects/12629)

<div class="topic-metadata">

**Author:** [@ProgrammableBoyCZECH](https://discourse.processing.org/u/ProgrammableBoyCZECH)\
**Replies:** 1\
**Last updated:** [July 9, 2019, 4:21pm UTC](https://discourse.processing.org/t/opengl-cannot-load-shapes-objects/12629 "2019-07-09T16:21:25Z")

</div>

Hi, can you help me with this code please? I want to make program with OpenGL that shows up objects and if you click with mouse it will show another one. But it is showing only first two, but other not. HERE IS THE C…

---

## [Maybe too many \> characters?](https://discourse.processing.org/t/maybe-too-many-characters/12599)

<div class="topic-metadata">

**Author:** [@pizzamaster77](https://discourse.processing.org/u/pizzamaster77)\
**Replies:** 2\
**Last updated:** [July 9, 2019, 2:51pm UTC](https://discourse.processing.org/t/maybe-too-many-characters/12599 "2019-07-09T14:51:26Z")

</div>

Hi, I’m a noob to Processing and I was trying to create a simple circle bouncing around a screen. I got part way through to the point where I wanted it to detect when the circle got close to the edge. I started with when…

---

## [Wrap around iteration](https://discourse.processing.org/t/wrap-around-iteration/12586)

<div class="topic-metadata">

**Author:** [@ddownn](https://discourse.processing.org/u/ddownn)\
**Replies:** 9\
**Last updated:** [July 9, 2019, 12:05pm UTC](https://discourse.processing.org/t/wrap-around-iteration/12586 "2019-07-09T12:05:32Z")

</div>

Is there a way to get this effect of generating 0, 1 1, 2 2, 3 3, 0 … with a single condition, I mean either without using if/else, or taking the if/else out of the for loop? And avoid hard coding ‘0’ This just se…

---

## [Drawing java.awt.Shape](https://discourse.processing.org/t/drawing-java-awt-shape/12572)

<div class="topic-metadata">

**Author:** [@Sayeth\_We](https://discourse.processing.org/u/Sayeth_We)\
**Replies:** 1\
**Last updated:** [July 8, 2019, 10:23am UTC](https://discourse.processing.org/t/drawing-java-awt-shape/12572 "2019-07-08T10:23:36Z")

</div>

I’m using the java.awt.Shape class for collision detection with intersects() and contains(). However, this means that I’m duplication code, and in particular, magic numbers, when drawing vs checking collisions. an Examp…

---

## [Particle-interaction based on images' pixel brightness](https://discourse.processing.org/t/particle-interaction-based-on-images-pixel-brightness/12240)

<div class="topic-metadata">

**Author:** [@Namrad](https://discourse.processing.org/u/Namrad)\
**Replies:** 8\
**Last updated:** [July 8, 2019, 10:21am UTC](https://discourse.processing.org/t/particle-interaction-based-on-images-pixel-brightness/12240 "2019-07-08T10:21:26Z")

</div>

Hello, I hope someone is able and willing to aid me in figuring out how to approach a concept I want to try. The idea is rather simple: I want particles to interact with a loaded image. I have a Processing sketch with …

---

## [Svg file loading distorted](https://discourse.processing.org/t/svg-file-loading-distorted/12527)

<div class="topic-metadata">

**Author:** [@Ruchi](https://discourse.processing.org/u/Ruchi)\
**Replies:** 11\
**Last updated:** [July 8, 2019, 6:23am UTC](https://discourse.processing.org/t/svg-file-loading-distorted/12527 "2019-07-08T06:23:52Z")

</div>

I am loading an svg file which contains numerous square shapes stacked diagonally. I wrote a simple code PShape image; void setup() { size(600,600); image=loadShape(“squares.svg”); } void draw() { shapeMode(CEN…

---

## [Pixels "stutter" when drawing (now with included data)](https://discourse.processing.org/t/pixels-stutter-when-drawing-now-with-included-data/12326)

<div class="topic-metadata">

**Author:** [@tribblesontoast](https://discourse.processing.org/u/tribblesontoast)\
**Replies:** 15\
**Last updated:** [July 7, 2019, 11:06pm UTC](https://discourse.processing.org/t/pixels-stutter-when-drawing-now-with-included-data/12326 "2019-07-07T23:06:30Z")

</div>

Edit: Data can be downloaded from here, forgot it again. Hi, Sorry for the complete rebuild, but what I wrote was garbage, i’ll try to simplify. I’m visualising movie color data from three places on the screen, I have…

---

## [Stacking shapes](https://discourse.processing.org/t/stacking-shapes/12033)

<div class="topic-metadata">

**Author:** [@lindsey1](https://discourse.processing.org/u/lindsey1)\
**Replies:** 9\
**Last updated:** [July 6, 2019, 10:19am UTC](https://discourse.processing.org/t/stacking-shapes/12033 "2019-07-06T10:19:28Z")

</div>

Hi, so I am replicating the game ’ Stack’ on processing. I was wondering if anyone knew how to make the shapes stack on top of each other when the mouse is clicked. When the mouse is clicked, the rectangle that is moving…

---

## [Drawing program](https://discourse.processing.org/t/drawing-program/12510)

<div class="topic-metadata">

**Author:** [@AdrienGh](https://discourse.processing.org/u/AdrienGh)\
**Replies:** 12\
**Last updated:** [July 5, 2019, 7:52pm UTC](https://discourse.processing.org/t/drawing-program/12510 "2019-07-05T19:52:20Z")

</div>

Hello everyone, I’m new to programming. I could use your help. I want to create a simple interface to draw from a circle. The problem is that I can’t draw on this circle. And I wish I could draw on it. PImage gomme; …

---

## [Zooming-in & out through non-concentric, round image sequence](https://discourse.processing.org/t/zooming-in-out-through-non-concentric-round-image-sequence/12505)

<div class="topic-metadata">

**Author:** [@ottenm](https://discourse.processing.org/u/ottenm)\
**Replies:** 2\
**Last updated:** [July 5, 2019, 7:46pm UTC](https://discourse.processing.org/t/zooming-in-out-through-non-concentric-round-image-sequence/12505 "2019-07-05T19:46:15Z")

</div>

I need to zoom in fluidly (and back out) through a sequence of 7 images, each one detailing about 6% of the image containing it, like zooming in from ‘planet’, all the way to ‘pebble’, while maintaining a high level of f…

---

## [Bouncing ellipses](https://discourse.processing.org/t/bouncing-ellipses/12525)

<div class="topic-metadata">

**Author:** [@sileo](https://discourse.processing.org/u/sileo)\
**Replies:** 6\
**Last updated:** [July 5, 2019, 7:41pm UTC](https://discourse.processing.org/t/bouncing-ellipses/12525 "2019-07-05T19:41:05Z")

</div>

Hi everybody! I’m a new user in this forum and I’d like to know if someone could help me with this: A red ellipse that bounces vertically when you press “A” A blue ellipse that bounces horizontally when pressing “B” A…

---

## [Declare variable for PGraphics which is given image as an input](https://discourse.processing.org/t/declare-variable-for-pgraphics-which-is-given-image-as-an-input/12473)

<div class="topic-metadata">

**Author:** [@Ruchi](https://discourse.processing.org/u/Ruchi)\
**Replies:** 2\
**Last updated:** [July 5, 2019, 2:30pm UTC](https://discourse.processing.org/t/declare-variable-for-pgraphics-which-is-given-image-as-an-input/12473 "2019-07-05T14:30:47Z")

</div>

Hi. I am loading an image in PGraphics sketch. Taking the color of each pixel and drawing rotated rectangles on main Sketch with the colors of each pixel from image. My confusion is how do I define PGraphics variables. …

---

## [Choppy/Jittery fast motion - hardware or code?](https://discourse.processing.org/t/choppy-jittery-fast-motion-hardware-or-code/12448)

<div class="topic-metadata">

**Author:** [@gudmundursteinn](https://discourse.processing.org/u/gudmundursteinn)\
**Replies:** 7\
**Last updated:** [July 4, 2019, 11:39am UTC](https://discourse.processing.org/t/choppy-jittery-fast-motion-hardware-or-code/12448 "2019-07-04T11:39:11Z")

</div>

Hello. In the following example there is a stripped down version of everything I do in processing or have been doing since 2009, things moving across the screen at equal speed. All this time I have never seen a movemen…

---

## [Delay in Generating Moving Boxes](https://discourse.processing.org/t/delay-in-generating-moving-boxes/12379)

<div class="topic-metadata">

**Author:** [@Bigp0ppa](https://discourse.processing.org/u/Bigp0ppa)\
**Replies:** 23\
**Last updated:** [July 3, 2019, 6:46pm UTC](https://discourse.processing.org/t/delay-in-generating-moving-boxes/12379 "2019-07-03T18:46:46Z")

</div>

I’m attempting to make a game where boxes fly in from the left of the screen and the player must move the cursor to dodge them. However, when I add the delay where I believe it should go, the game stops working. Here is…

---

## [Having random select from limited choices](https://discourse.processing.org/t/having-random-select-from-limited-choices/12451)

<div class="topic-metadata">

**Author:** [@pauldefazio](https://discourse.processing.org/u/pauldefazio)\
**Replies:** 3\
**Last updated:** [July 3, 2019, 5:54am UTC](https://discourse.processing.org/t/having-random-select-from-limited-choices/12451 "2019-07-03T05:54:23Z")

</div>

Hello! This is a pretty basic question but I haven’t found the answer yet. I’m working with some code from the loop tutorial to fill a screen with gray rectangles, each assigned a random lightness. I’ve posted my code b…

---

## [Menubar with P3D](https://discourse.processing.org/t/menubar-with-p3d/12462)

<div class="topic-metadata">

**Author:** [@brcreswell](https://discourse.processing.org/u/brcreswell)\
**Replies:** 1\
**Last updated:** [July 3, 2019, 3:55am UTC](https://discourse.processing.org/t/menubar-with-p3d/12462 "2019-07-03T03:55:00Z")

</div>

Wondering if it’s possible to implement a system menubar while utilizing P3D. I’ve found ways of doing it with JFrame but this obviously doesn’t help me. I’ve been searching for hours but can’t seem to find anything. If…

---

## [Changing colours](https://discourse.processing.org/t/changing-colours/12390)

<div class="topic-metadata">

**Author:** [@karan26](https://discourse.processing.org/u/karan26)\
**Replies:** 4\
**Last updated:** [July 2, 2019, 2:45pm UTC](https://discourse.processing.org/t/changing-colours/12390 "2019-07-02T14:45:23Z")

</div>

hii,i want to change the colour of square with respect to change in the size of the square .i want dark colour in the centre and light colour on the edges. here is my code can anybody tell me what should i do? int squar…

---

## [I want to use two-dimensional array to sort the score by the largest to smallest](https://discourse.processing.org/t/i-want-to-use-two-dimensional-array-to-sort-the-score-by-the-largest-to-smallest/12425)

<div class="topic-metadata">

**Author:** [@henry](https://discourse.processing.org/u/henry)\
**Replies:** 2\
**Last updated:** [July 2, 2019, 6:07am UTC](https://discourse.processing.org/t/i-want-to-use-two-dimensional-array-to-sort-the-score-by-the-largest-to-smallest/12425 "2019-07-02T06:07:39Z")

</div>

String\[\]score=loadStrings(“score.csv”); for (int i=1; i\<score.length; i++) { String \[\]\[\]tokens=split(score\[i\]\[\], “,”); int scores=Integer.parseInt(tokens\[i\]\[1\]); } //a = sort(a); //a=reverse(a); scores\[i\]\[1\]=so…

---

## [Shoot image and make it shrink (Processing)](https://discourse.processing.org/t/shoot-image-and-make-it-shrink-processing/12208)

<div class="topic-metadata">

**Author:** [@Hang](https://discourse.processing.org/u/Hang)\
**Replies:** 4\
**Last updated:** [July 1, 2019, 2:45pm UTC](https://discourse.processing.org/t/shoot-image-and-make-it-shrink-processing/12208 "2019-07-01T14:45:16Z")

</div>

Hi, I’m currently learning processing and making the program of rocket moving through middle of the screen. I’m gonna use image (png file) for the rocket. I want to make a rocket shoot with mouse like a sling shot. And …

---

## [Rendering image on P3D, is it a bug?](https://discourse.processing.org/t/rendering-image-on-p3d-is-it-a-bug/12367)

<div class="topic-metadata">

**Author:** [@GuilhermeVolker](https://discourse.processing.org/u/GuilhermeVolker)\
**Replies:** 6\
**Last updated:** [July 1, 2019, 8:48am UTC](https://discourse.processing.org/t/rendering-image-on-p3d-is-it-a-bug/12367 "2019-07-01T08:48:06Z")

</div>

I have this problem (show on the first image) that one arc is overlaping other image bellow, i did try to translate translate(0,0,1); it should work just fine but insted i have this very wierd result (2° image). That loo…

---

## [How can I center an object on my screen that moves?](https://discourse.processing.org/t/how-can-i-center-an-object-on-my-screen-that-moves/12196)

<div class="topic-metadata">

**Author:** [@Pan](https://discourse.processing.org/u/Pan)\
**Replies:** 4\
**Last updated:** [July 1, 2019, 7:56am UTC](https://discourse.processing.org/t/how-can-i-center-an-object-on-my-screen-that-moves/12196 "2019-07-01T07:56:56Z")

</div>

I’m trying to make the screen follow my two spaceships and I’m trying to center the middle of the two ships to my screen The coordinates of the point between the two ships are fx and fy. Here the code: boolean pause; …

---

## [Multiplayer camera follow?](https://discourse.processing.org/t/multiplayer-camera-follow/12170)

<div class="topic-metadata">

**Author:** [@Pan](https://discourse.processing.org/u/Pan)\
**Replies:** 4\
**Last updated:** [July 1, 2019, 12:56am UTC](https://discourse.processing.org/t/multiplayer-camera-follow/12170 "2019-07-01T00:56:03Z")

</div>

Does anyone know of any method to make the camera follow several players in the Lemming Ball Z style? Thanks you for reading.

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

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