# Coding Questions

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

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

**Page:** 101

---

## [How can I check that the pixel has color?](https://discourse.processing.org/t/how-can-i-check-that-the-pixel-has-color/19633)

<div class="topic-metadata">

**Author:** [@Tauter](https://discourse.processing.org/u/Tauter)\
**Replies:** 2\
**Last updated:** [April 10, 2020, 4:31pm UTC](https://discourse.processing.org/t/how-can-i-check-that-the-pixel-has-color/19633 "2020-04-10T16:31:31Z")

</div>

I’m allowed to use only get(), background() methods and color data type. How can I check that the given pixel (x,y), is background colored(black) or not ? I can’t figure it out from the references.

---

## [How do you create 3D bars to be display on a 2D image?](https://discourse.processing.org/t/how-do-you-create-3d-bars-to-be-display-on-a-2d-image/19631)

<div class="topic-metadata">

**Author:** [@Stage1](https://discourse.processing.org/u/Stage1)\
**Replies:** 6\
**Last updated:** [April 10, 2020, 3:09pm UTC](https://discourse.processing.org/t/how-do-you-create-3d-bars-to-be-display-on-a-2d-image/19631 "2020-04-10T15:09:48Z")

</div>

Hi there. I would like to know how you can display 3D bars on a image using processing 3. For example, i have a 2D map and on that map i want to display the coordinates using the latitude and longitude of a certain cit…

---

## [PImage attractor for Particle system?](https://discourse.processing.org/t/pimage-attractor-for-particle-system/19628)

<div class="topic-metadata">

**Author:** [@Tickie](https://discourse.processing.org/u/Tickie)\
**Replies:** 1\
**Last updated:** [April 10, 2020, 1:53pm UTC](https://discourse.processing.org/t/pimage-attractor-for-particle-system/19628 "2020-04-10T13:53:26Z")

</div>

Hello, I’m trying to write this processing code where particles are either attracted to the mouse when it’s pressed or repelled when it’s released. I have PImage representing a basic arrow in b&w, with a keypressed funct…

---

## [The rectangle is moving down the screen! I want the rectangle to stop and start with the Space Bar](https://discourse.processing.org/t/the-rectangle-is-moving-down-the-screen-i-want-the-rectangle-to-stop-and-start-with-the-space-bar/19584)

<div class="topic-metadata">

**Author:** [@bellievr](https://discourse.processing.org/u/bellievr)\
**Replies:** 2\
**Last updated:** [April 10, 2020, 1:22pm UTC](https://discourse.processing.org/t/the-rectangle-is-moving-down-the-screen-i-want-the-rectangle-to-stop-and-start-with-the-space-bar/19584 "2020-04-10T13:22:14Z")

</div>

Please help me create this program I have done with the steps of moving rectangle up and down . Just confused with using spacebar for starting and stopping it.

---

## [JavaFX Processing Sketch doesnt draw()](https://discourse.processing.org/t/javafx-processing-sketch-doesnt-draw/12797)

<div class="topic-metadata">

**Author:** [@poboyd](https://discourse.processing.org/u/poboyd)\
**Replies:** 1\
**Last updated:** [April 10, 2020, 1:15pm UTC](https://discourse.processing.org/t/javafx-processing-sketch-doesnt-draw/12797 "2020-04-10T13:15:30Z")

</div>

Hi, I am running a processing sketch by calling it from a JavaFX application… public class Main extends Application { public pro sketch; @Override public void init() throws Exception { sketch = new pro(); sketch.ru…

---

## [Show given number of significant numbers of float in text()](https://discourse.processing.org/t/show-given-number-of-significant-numbers-of-float-in-text/19603)

<div class="topic-metadata">

**Author:** [@juanjoc](https://discourse.processing.org/u/juanjoc)\
**Replies:** 2\
**Last updated:** [April 10, 2020, 8:40am UTC](https://discourse.processing.org/t/show-given-number-of-significant-numbers-of-float-in-text/19603 "2020-04-10T08:40:28Z")

</div>

Hi everyone. I want to show a float number in a text, but it show like 4 significant numbers. float number = 1; void setup() { background(0); size(100,100); } void draw() { fill(255); text(number,50,50); delay…

---

## [Obj texture framerate hit](https://discourse.processing.org/t/obj-texture-framerate-hit/19554)

<div class="topic-metadata">

**Author:** [@mala](https://discourse.processing.org/u/mala)\
**Replies:** 4\
**Last updated:** [April 10, 2020, 8:26am UTC](https://discourse.processing.org/t/obj-texture-framerate-hit/19554 "2020-04-10T08:26:27Z")

</div>

I’m finding that using a texture on an imported .obj is leading to a severe slow down in my sketch. The obj is one part of a PShape Group, it is loaded and added to the Group in setup(). It is then used by a Class whic…

---

## [How to rotate an image continuously?](https://discourse.processing.org/t/how-to-rotate-an-image-continuously/19564)

<div class="topic-metadata">

**Author:** [@NKF](https://discourse.processing.org/u/NKF)\
**Replies:** 12\
**Last updated:** [April 9, 2020, 11:28am UTC](https://discourse.processing.org/t/how-to-rotate-an-image-continuously/19564 "2020-04-09T11:28:37Z")

</div>

I know how to rotate an image but I don’t know how to make it rotates continuously by itself Could someone teach me pls void setup() { size(500,500, P3D); background(255); } void draw() { translate(width/2, height…

---

## [How to spell your three names in three lines](https://discourse.processing.org/t/how-to-spell-your-three-names-in-three-lines/19574)

<div class="topic-metadata">

**Author:** [@karakara](https://discourse.processing.org/u/karakara)\
**Replies:** 2\
**Last updated:** [April 9, 2020, 10:55am UTC](https://discourse.processing.org/t/how-to-spell-your-three-names-in-three-lines/19574 "2020-04-09T10:55:42Z")

</div>

Help please! To write a program on the Processing screen of 1000/1000 sizes. Spell your three names in three lines of your choice. Each name should begin with a capital letter. Choose the right font and the right color f…

---

## [Looking for help to improve my code](https://discourse.processing.org/t/looking-for-help-to-improve-my-code/19362)

<div class="topic-metadata">

**Author:** [@vincentstrebelle](https://discourse.processing.org/u/vincentstrebelle)\
**Replies:** 6\
**Last updated:** [April 9, 2020, 10:27am UTC](https://discourse.processing.org/t/looking-for-help-to-improve-my-code/19362 "2020-04-09T10:27:31Z")

</div>

Hi everyone, i hope everything is allright for all of you. I’m looking for advices and/or help to improve a specific part of my code. So here’s my code so you can run it: first the main class: import java.util.Iterat…

---

## [Some questions about millis()](https://discourse.processing.org/t/some-questions-about-millis/19541)

<div class="topic-metadata">

**Author:** [@NKF](https://discourse.processing.org/u/NKF)\
**Replies:** 4\
**Last updated:** [April 9, 2020, 6:13am UTC](https://discourse.processing.org/t/some-questions-about-millis/19541 "2020-04-09T06:13:31Z")

</div>

I know millis() is the number of milliseconds since starting the program, but how can I reset millis() to 0 in order to re-counting the time?

---

## [Mathematic function](https://discourse.processing.org/t/mathematic-function/19535)

<div class="topic-metadata">

**Author:** [@mcaaaalvo](https://discourse.processing.org/u/mcaaaalvo)\
**Replies:** 16\
**Last updated:** [April 8, 2020, 5:34pm UTC](https://discourse.processing.org/t/mathematic-function/19535 "2020-04-08T17:34:41Z")

</div>

Hello, Does any body how to represent a curve in Processing, I have the equation of the curve but I don’t know how to represent it. If somebody could help me and telling me how to draw it I would thank it a lot

---

## [How to line between to objects when interacting same distance?](https://discourse.processing.org/t/how-to-line-between-to-objects-when-interacting-same-distance/19518)

<div class="topic-metadata">

**Author:** [@newbietot](https://discourse.processing.org/u/newbietot)\
**Replies:** 6\
**Last updated:** [April 8, 2020, 12:56pm UTC](https://discourse.processing.org/t/how-to-line-between-to-objects-when-interacting-same-distance/19518 "2020-04-08T12:56:52Z")

</div>

---

## [Intersection Two Objects](https://discourse.processing.org/t/intersection-two-objects/19523)

<div class="topic-metadata">

**Author:** [@newbietot](https://discourse.processing.org/u/newbietot)\
**Replies:** 1\
**Last updated:** [April 8, 2020, 1:01pm UTC](https://discourse.processing.org/t/intersection-two-objects/19523 "2020-04-08T13:01:54Z")

</div>

How to create a line between two objects if the Car1 intersect same Yaxis of Car2

---

## [How to move an object one pixel at a time up and down the screen and how to change the shape according to aspect ratio](https://discourse.processing.org/t/how-to-move-an-object-one-pixel-at-a-time-up-and-down-the-screen-and-how-to-change-the-shape-according-to-aspect-ratio/19502)

<div class="topic-metadata">

**Author:** [@s6277](https://discourse.processing.org/u/s6277)\
**Replies:** 2\
**Last updated:** [April 8, 2020, 8:42am UTC](https://discourse.processing.org/t/how-to-move-an-object-one-pixel-at-a-time-up-and-down-the-screen-and-how-to-change-the-shape-according-to-aspect-ratio/19502 "2020-04-08T08:42:56Z")

</div>

Hey, i’m new to processing and I’ve tried and researched so much on this but i can’t find a solution. My goal is to basically move a shape up and down one pixel at a time from the left of the screen (without using frame…

---

## [Some problems about millis()](https://discourse.processing.org/t/some-problems-about-millis/19530)

<div class="topic-metadata">

**Author:** [@NKF](https://discourse.processing.org/u/NKF)\
**Replies:** 1\
**Last updated:** [April 8, 2020, 8:36am UTC](https://discourse.processing.org/t/some-problems-about-millis/19530 "2020-04-08T08:36:31Z")

</div>

Why I can’t make a 30-second timer with the below codes? int time; int startTime; void setup() { background(0); size(800, 1000); time = millis(); startTime = 30; } void draw() { fill(250, 255, 8); textS…

---

## [I encounter some troubles when I do my game design project](https://discourse.processing.org/t/i-encounter-some-troubles-when-i-do-my-game-design-project/19525)

<div class="topic-metadata">

**Author:** [@NKF](https://discourse.processing.org/u/NKF)\
**Replies:** 0\
**Last updated:** [April 8, 2020, 4:26am UTC](https://discourse.processing.org/t/i-encounter-some-troubles-when-i-do-my-game-design-project/19525 "2020-04-08T04:26:50Z")

</div>

I’m new to Processing and I cannot solve the problem below : In my game, why some of the bullets can smash the meteorites, but some of the bullets cannot? The code: PImage mete; PImage bg; PImage spship; PImage bullet…

---

## [How to map points onto a shape in P3D mode?](https://discourse.processing.org/t/how-to-map-points-onto-a-shape-in-p3d-mode/19488)

<div class="topic-metadata">

**Author:** [@Samizen](https://discourse.processing.org/u/Samizen)\
**Replies:** 11\
**Last updated:** [April 8, 2020, 2:51am UTC](https://discourse.processing.org/t/how-to-map-points-onto-a-shape-in-p3d-mode/19488 "2020-04-08T02:51:08Z")

</div>

How can I map my coordinates to the box object that I have used in the following sketch. I want to create something like this: I have ended up with the following result: Following are the codes that I’ve written th…

---

## [Bounce Ball Inside A Square](https://discourse.processing.org/t/bounce-ball-inside-a-square/19512)

<div class="topic-metadata">

**Author:** [@mtm](https://discourse.processing.org/u/mtm)\
**Replies:** 0\
**Last updated:** [April 7, 2020, 6:43pm UTC](https://discourse.processing.org/t/bounce-ball-inside-a-square/19512 "2020-04-07T18:43:11Z")

</div>

Hi! I am trying to create a black square instead of the black circle in this code. The point is to have the white little ball inside the square, in movement. And all the others black little circles should move outside t…

---

## [How can i make this?](https://discourse.processing.org/t/how-can-i-make-this/19464)

<div class="topic-metadata">

**Author:** [@Tauter](https://discourse.processing.org/u/Tauter)\
**Replies:** 2\
**Last updated:** [April 7, 2020, 8:49am UTC](https://discourse.processing.org/t/how-can-i-make-this/19464 "2020-04-07T08:49:05Z")

</div>

Hi! So i have to create a program but i can’t even start. So my program shoud do this: One click, save the point from that point a dynamic line is created from the point to the cursor coordinate, as I move the cursor t…

---

## [Texture on primitive object appear inverted?](https://discourse.processing.org/t/texture-on-primitive-object-appear-inverted/19487)

<div class="topic-metadata">

**Author:** [@Samizen](https://discourse.processing.org/u/Samizen)\
**Replies:** 2\
**Last updated:** [April 7, 2020, 2:45am UTC](https://discourse.processing.org/t/texture-on-primitive-object-appear-inverted/19487 "2020-04-07T02:45:24Z")

</div>

I have used a primitive box and textured it, though the texture appears to be inverted. How do I flip it horizontally? I think its got something to do with transformation but it confused me a lot. Here is the code P…

---

## [saveStrings()/loadStrings() Causes Gray Screen on Exported Application](https://discourse.processing.org/t/savestrings-loadstrings-causes-gray-screen-on-exported-application/19486)

<div class="topic-metadata">

**Author:** [@ericv](https://discourse.processing.org/u/ericv)\
**Replies:** 0\
**Last updated:** [April 7, 2020, 12:50am UTC](https://discourse.processing.org/t/savestrings-loadstrings-causes-gray-screen-on-exported-application/19486 "2020-04-07T00:50:07Z")

</div>

Hello, I have a sketch that works perfectly in Processing (3.5.4) but when I export it as a stand-alone application, people have been reporting a gray screen. I think I’ve narrowed the problem down to the use of saveStr…

---

## [Cannot make a static reference to the non static method draw() in the type myStockProject.draw](https://discourse.processing.org/t/cannot-make-a-static-reference-to-the-non-static-method-draw-in-the-type-mystockproject-draw/19470)

<div class="topic-metadata">

**Author:** [@smep](https://discourse.processing.org/u/smep)\
**Replies:** 5\
**Last updated:** [April 6, 2020, 8:07pm UTC](https://discourse.processing.org/t/cannot-make-a-static-reference-to-the-non-static-method-draw-in-the-type-mystockproject-draw/19470 "2020-04-06T20:07:22Z")

</div>

I’ve been creating a stock market and I am unable to figure a solution to the error in the title. at the point graph.draw in the class myStockProject is where I get the error. I have uploaded that class and the graph cl…

---

## [How to make object curve?](https://discourse.processing.org/t/how-to-make-object-curve/19408)

<div class="topic-metadata">

**Author:** [@Cybernet](https://discourse.processing.org/u/Cybernet)\
**Replies:** 10\
**Last updated:** [April 6, 2020, 2:46pm UTC](https://discourse.processing.org/t/how-to-make-object-curve/19408 "2020-04-06T14:46:47Z")

</div>

So I have this ellipse, and every time the user presses the left or right key, the ellipse will curve to that side. I know I have to use rotate, but I don’t know where I can start. I tried so many ways, but none of them …

---

## [Digital Clock Made from image](https://discourse.processing.org/t/digital-clock-made-from-image/19460)

<div class="topic-metadata">

**Author:** [@F\_War](https://discourse.processing.org/u/F_War)\
**Replies:** 9\
**Last updated:** [April 6, 2020, 2:04pm UTC](https://discourse.processing.org/t/digital-clock-made-from-image/19460 "2020-04-06T14:04:35Z")

</div>

Hi! I am very very new to processing. I did a few classes with the basics but I cannot wrap my head around it. I am trying to make a clock from pictures of numbers that I have taken. I have pictures of 0,1, 2, 3 … 9 a…

---

## [Inability to save alpha channel](https://discourse.processing.org/t/inability-to-save-alpha-channel/19448)

<div class="topic-metadata">

**Author:** [@Odermonicon](https://discourse.processing.org/u/Odermonicon)\
**Replies:** 1\
**Last updated:** [April 6, 2020, 6:11am UTC](https://discourse.processing.org/t/inability-to-save-alpha-channel/19448 "2020-04-06T06:11:22Z")

</div>

I’m feeding it this image: And the code gives back complete black. PImage IMG; void setup() { background(128); size(500, 500); IMG = loadImage("test.png"); colorMode(HSB, 255); IMG.loadPixels(); for (int …

---

## [Difficulty trying to maintain lighting on a wall](https://discourse.processing.org/t/difficulty-trying-to-maintain-lighting-on-a-wall/19253)

<div class="topic-metadata">

**Author:** [@fchavat](https://discourse.processing.org/u/fchavat)\
**Replies:** 2\
**Last updated:** [April 5, 2020, 10:00pm UTC](https://discourse.processing.org/t/difficulty-trying-to-maintain-lighting-on-a-wall/19253 "2020-04-05T22:00:00Z")

</div>

Hello!, I’m trying to simulate a moving wall and I have a ‘pointLight’ lighting from the position of the camera (approximately). The problem I’m having is that when the wall moves, the lighting starts to get darker (ev…

---

## [Difficulty having two balls bounce against eachother without clipping](https://discourse.processing.org/t/difficulty-having-two-balls-bounce-against-eachother-without-clipping/19445)

<div class="topic-metadata">

**Author:** [@worm888](https://discourse.processing.org/u/worm888)\
**Replies:** 1\
**Last updated:** [April 5, 2020, 9:17pm UTC](https://discourse.processing.org/t/difficulty-having-two-balls-bounce-against-eachother-without-clipping/19445 "2020-04-05T21:17:43Z")

</div>

planangle = new PVector(location.x-plan.location.x, location.y-plan.location.y); // if (-90\<velocity.heading() && velocity.heading()\<90) { // planangle.rotate(PI); //} if (dist(location.x, location.y, plan.location.x, pl…

---

## [How do you turn an ellipse into a button and when clicked it would show the data on the same screen?](https://discourse.processing.org/t/how-do-you-turn-an-ellipse-into-a-button-and-when-clicked-it-would-show-the-data-on-the-same-screen/19366)

<div class="topic-metadata">

**Author:** [@Stage1](https://discourse.processing.org/u/Stage1)\
**Replies:** 13\
**Last updated:** [April 5, 2020, 8:49pm UTC](https://discourse.processing.org/t/how-do-you-turn-an-ellipse-into-a-button-and-when-clicked-it-would-show-the-data-on-the-same-screen/19366 "2020-04-05T20:49:49Z")

</div>

Hello, im trying to figure out how i can turn my ellipse shapes to show some form of data but first it would need to be turned into a button. For example when you click the shape it should show the text next to it on the…

---

## [Get array to loop images](https://discourse.processing.org/t/get-array-to-loop-images/19435)

<div class="topic-metadata">

**Author:** [@Banana132](https://discourse.processing.org/u/Banana132)\
**Replies:** 2\
**Last updated:** [April 5, 2020, 6:39pm UTC](https://discourse.processing.org/t/get-array-to-loop-images/19435 "2020-04-05T18:39:06Z")

</div>

Hi ther, So im trying to get an array of images to loop however, i have set up the array and loops correctly, however it only shows one image where as i need it to loop and then stop at the last image. //explosion imag…

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

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