# Coding Questions

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

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

**Page:** 162

---

## [Creating particle systems along a curve](https://discourse.processing.org/t/creating-particle-systems-along-a-curve/6259)

<div class="topic-metadata">

**Author:** [@tryingtogetagrip](https://discourse.processing.org/u/tryingtogetagrip)\
**Replies:** 3\
**Last updated:** [December 3, 2018, 4:31pm UTC](https://discourse.processing.org/t/creating-particle-systems-along-a-curve/6259 "2018-12-03T16:31:25Z")

</div>

Hey all, I have a question that I can’t seem to figure out. I know it is possible to use a mouseclick to create a new particle system (just as the example code I have attached beneath). However, what I would like is to …

---

## [Color selected from pallette randomly for ellipses drawn by an array](https://discourse.processing.org/t/color-selected-from-pallette-randomly-for-ellipses-drawn-by-an-array/6204)

<div class="topic-metadata">

**Author:** [@W1nDs0R](https://discourse.processing.org/u/W1nDs0R)\
**Replies:** 2\
**Last updated:** [December 2, 2018, 9:36pm UTC](https://discourse.processing.org/t/color-selected-from-pallette-randomly-for-ellipses-drawn-by-an-array/6204 "2018-12-02T21:36:20Z")

</div>

Hey there Guys, I was wondering if you could offer me some insight in to how I can color each ellipse randomly that is drawn by an array. Currently I have created a second array for colors which it draws from when the …

---

## [Questions on static methods](https://discourse.processing.org/t/questions-on-static-methods/6169)

<div class="topic-metadata">

**Author:** [@jb4x](https://discourse.processing.org/u/jb4x)\
**Replies:** 4\
**Last updated:** [December 2, 2018, 7:33pm UTC](https://discourse.processing.org/t/questions-on-static-methods/6169 "2018-12-02T19:33:43Z")

</div>

Hi everyone, I’m trying to get my head around static methods in a class. Let’s say I want to create the following class: class MyVector { float v1, v2; MyVector(float v1, float v2) { this.v1 = v1; this.…

---

## [Making 3D planets](https://discourse.processing.org/t/making-3d-planets/6136)

<div class="topic-metadata">

**Author:** [@nerdboybi](https://discourse.processing.org/u/nerdboybi)\
**Replies:** 6\
**Last updated:** [December 2, 2018, 1:42am UTC](https://discourse.processing.org/t/making-3d-planets/6136 "2018-12-02T01:42:03Z")

</div>

Hello, so I have made this program where my planet rotates around the sun. final int SUN\_SIZE=50; final int planetSize=SUN\_SIZE/2; final int X\_RADIUS=150; final int Y\_RADIUS=35; float angle=0; final float SPEED=0.03; …

---

## [How do I create regular spirograph curves around an asymmetrical shape](https://discourse.processing.org/t/how-do-i-create-regular-spirograph-curves-around-an-asymmetrical-shape/5501)

<div class="topic-metadata">

**Author:** [@Rah](https://discourse.processing.org/u/Rah)\
**Replies:** 16\
**Last updated:** [December 1, 2018, 5:22pm UTC](https://discourse.processing.org/t/how-do-i-create-regular-spirograph-curves-around-an-asymmetrical-shape/5501 "2018-12-01T17:22:27Z")

</div>

Hello! I’m desparate for a solution to my problem and very thankful for any kind of help. I’m new to this program and I need to find a way how to create regular spirograph-like curves around an asymmetrical shape. So n…

---

## [Function wont work](https://discourse.processing.org/t/function-wont-work/6134)

<div class="topic-metadata">

**Author:** [@kornFusion](https://discourse.processing.org/u/kornFusion)\
**Replies:** 4\
**Last updated:** [December 1, 2018, 5:06pm UTC](https://discourse.processing.org/t/function-wont-work/6134 "2018-12-01T17:06:43Z")

</div>

Hey Everyone, I have coded a very simple game which works perfectly except the part where the player loses. I have a function called, dead with a condition that if deadSign == true show 2 pictures (PNG) which one of t…

---

## [How to set these object in the back?](https://discourse.processing.org/t/how-to-set-these-object-in-the-back/6133)

<div class="topic-metadata">

**Author:** [@ant](https://discourse.processing.org/u/ant)\
**Replies:** 7\
**Last updated:** [December 1, 2018, 4:48pm UTC](https://discourse.processing.org/t/how-to-set-these-object-in-the-back/6133 "2018-12-01T16:48:52Z")

</div>

Having trouble getting the stars to be behind the building and the windows to be behind the water and the bridge. float time = 0; float\[\] a = new float\[2000\]; wall\[\]walls; void setup(){ size(1000,700); for (int i =…

---

## [Overlaying images with opacity using tint() in P3D](https://discourse.processing.org/t/overlaying-images-with-opacity-using-tint-in-p3d/6114)

<div class="topic-metadata">

**Author:** [@currymike](https://discourse.processing.org/u/currymike)\
**Replies:** 5\
**Last updated:** [November 30, 2018, 6:37pm UTC](https://discourse.processing.org/t/overlaying-images-with-opacity-using-tint-in-p3d/6114 "2018-11-30T18:37:17Z")

</div>

I’m playing around with overlaying two images in 3D space using P3D and tint(). When I bring the opacity of the front image down instead of seeing the image behind I get a black box. (see images below). I trying to cr…

---

## [Is there a similar function to pushMatrix() and popMatrix() but instead for transforms its for functions like stroke() and strokeWeight()?](https://discourse.processing.org/t/is-there-a-similar-function-to-pushmatrix-and-popmatrix-but-instead-for-transforms-its-for-functions-like-stroke-and-strokeweight/6088)

<div class="topic-metadata">

**Author:** [@klaik30](https://discourse.processing.org/u/klaik30)\
**Replies:** 2\
**Last updated:** [November 30, 2018, 12:39am UTC](https://discourse.processing.org/t/is-there-a-similar-function-to-pushmatrix-and-popmatrix-but-instead-for-transforms-its-for-functions-like-stroke-and-strokeweight/6088 "2018-11-30T00:39:42Z")

</div>

pushMatrix() and popMatrix() are super useful when I want to not destroy the current coordinate system and basically switch reference frame but in that reference frame, I might want to apply settings that only apply to t…

---

## [New Issue With Code / variable usage](https://discourse.processing.org/t/new-issue-with-code-variable-usage/6096)

<div class="topic-metadata">

**Author:** [@Etorphine](https://discourse.processing.org/u/Etorphine)\
**Replies:** 2\
**Last updated:** [November 30, 2018, 12:36am UTC](https://discourse.processing.org/t/new-issue-with-code-variable-usage/6096 "2018-11-30T00:36:44Z")

</div>

The issue I am currently having with my code is it having it randomly display the image I want. I attempted to have a variable named finalImage in which it would be stored once it selected the random image but I cannot h…

---

## [Multi-threading on Ethereum walelts transactions](https://discourse.processing.org/t/multi-threading-on-ethereum-walelts-transactions/5884)

<div class="topic-metadata">

**Author:** [@moba\_moba65](https://discourse.processing.org/u/moba_moba65)\
**Replies:** 18\
**Last updated:** [November 29, 2018, 11:54pm UTC](https://discourse.processing.org/t/multi-threading-on-ethereum-walelts-transactions/5884 "2018-11-29T23:54:20Z")

</div>

I am writing a code on Ethereum transactions between couple of wallets. My goal is to make an animation to show that how the transactions are being done between these wallets. So I gave each wallet an X-Y coordination an…

---

## [What is wrong with this code?](https://discourse.processing.org/t/what-is-wrong-with-this-code/6089)

<div class="topic-metadata">

**Author:** [@CowPieForever](https://discourse.processing.org/u/CowPieForever)\
**Replies:** 4\
**Last updated:** [November 29, 2018, 11:30pm UTC](https://discourse.processing.org/t/what-is-wrong-with-this-code/6089 "2018-11-29T23:30:59Z")

</div>

This is my code: however, whenever I run it, it gives me the error “expecting }, found ‘else’”. I’ve gone through it multiple times and I have no idea whats going wrong. Please help.

---

## [JoptionPane library error!](https://discourse.processing.org/t/joptionpane-library-error/6081)

<div class="topic-metadata">

**Author:** [@JeromeBatchoski](https://discourse.processing.org/u/JeromeBatchoski)\
**Replies:** 1\
**Last updated:** [November 29, 2018, 9:31pm UTC](https://discourse.processing.org/t/joptionpane-library-error/6081 "2018-11-29T21:31:58Z")

</div>

I keep getting the following error, ive searched everywhere, even reinstalled the program, still no progress. The package “javax.swing.J0ptionPane” does not exist. You might be missing a library. All the spelling are c…

---

## [Final Project Engg 233](https://discourse.processing.org/t/final-project-engg-233/6043)

<div class="topic-metadata">

**Author:** [@ih8pa1n](https://discourse.processing.org/u/ih8pa1n)\
**Replies:** 4\
**Last updated:** [November 29, 2018, 8:04pm UTC](https://discourse.processing.org/t/final-project-engg-233/6043 "2018-11-29T20:04:15Z")

</div>

Hey everyone, i have been struggling in this course. We have to make a digital dashboard of a car. Any help would be appreciated. Requirements for this class: Class SensorDataProvider This class has the following me…

---

## [How to determine right Class to use, if not equal to used variable's Class?](https://discourse.processing.org/t/how-to-determine-right-class-to-use-if-not-equal-to-used-variables-class/5940)

<div class="topic-metadata">

**Author:** [@Lexyth](https://discourse.processing.org/u/Lexyth)\
**Replies:** 12\
**Last updated:** [November 29, 2018, 12:11pm UTC](https://discourse.processing.org/t/how-to-determine-right-class-to-use-if-not-equal-to-used-variables-class/5940 "2018-11-29T12:11:15Z")

</div>

The question might be confusing and i don’t know how to explain it better, but an example should show what i mean. Lets say we have some objects with different classes \<Banana, Apple, Bread, and so on\>. And now i want …

---

## [Why does my code not work()](https://discourse.processing.org/t/why-does-my-code-not-work/6063)

<div class="topic-metadata">

**Author:** [@LordKim](https://discourse.processing.org/u/LordKim)\
**Replies:** 1\
**Last updated:** [November 29, 2018, 7:02am UTC](https://discourse.processing.org/t/why-does-my-code-not-work/6063 "2018-11-29T07:02:31Z")

</div>

here is my code SensorDataProvider s; Gauge g; int value = 0; final int Mainmenu = 0; final int Car = 1; void setup(){ fullScreen(); if (key == '1'){ s = new SensorDataProvider(); s.Initialize("car\_status\_B…

---

## [Colour transparency](https://discourse.processing.org/t/colour-transparency/6052)

<div class="topic-metadata">

**Author:** [@CowPieForever](https://discourse.processing.org/u/CowPieForever)\
**Replies:** 6\
**Last updated:** [November 29, 2018, 6:30am UTC](https://discourse.processing.org/t/colour-transparency/6052 "2018-11-29T06:30:12Z")

</div>

My code for colour looks like this: stroke(random(127.5,255),random(127.5,255),random(127.5,255)); fill(random(127.5,255),random(127.5,255),random(127.5,255)); Since I’m using the random function, it doesn’t follow the…

---

## [Binary Search Help](https://discourse.processing.org/t/binary-search-help/6053)

<div class="topic-metadata">

**Author:** [@lormanny](https://discourse.processing.org/u/lormanny)\
**Replies:** 1\
**Last updated:** [November 29, 2018, 1:15am UTC](https://discourse.processing.org/t/binary-search-help/6053 "2018-11-29T01:15:16Z")

</div>

PFont font; int titleScreen = 0; int gameScreen = 1; int resultScreen = 2; int gameState; int countDownTimer; int countUpTimer; //Reminder: Add three zeroes to the end of desired time in Game Duration i…

---

## [Coding Help Cannot Make Random Images Being Chosen](https://discourse.processing.org/t/coding-help-cannot-make-random-images-being-chosen/6057)

<div class="topic-metadata">

**Author:** [@Etorphine](https://discourse.processing.org/u/Etorphine)\
**Replies:** 1\
**Last updated:** [November 29, 2018, 2:59am UTC](https://discourse.processing.org/t/coding-help-cannot-make-random-images-being-chosen/6057 "2018-11-29T02:59:29Z")

</div>

//master variables PImage\[\] randomIMG = new PImage\[5\]; int numOfIMG; int rand = 0; PImage image1,image2,image3,image4,image5; float height = 100; float width = 50; float length = 150; //imageONE = loadImage ("imageNOW.…

---

## [Assistance Needed for Text Fade](https://discourse.processing.org/t/assistance-needed-for-text-fade/5786)

<div class="topic-metadata">

**Author:** [@lormanny](https://discourse.processing.org/u/lormanny)\
**Replies:** 4\
**Last updated:** [November 29, 2018, 12:25am UTC](https://discourse.processing.org/t/assistance-needed-for-text-fade/5786 "2018-11-29T00:25:21Z")

</div>

I need some help with my code. I am creating an Anagrams project for school. I need help knowing where to start to get the fading text to work. Whenever you type something that is invalid, there is a feedback string that…

---

## [Fixing mouse position to window center](https://discourse.processing.org/t/fixing-mouse-position-to-window-center/6023)

<div class="topic-metadata">

**Author:** [@djokjula](https://discourse.processing.org/u/djokjula)\
**Replies:** 3\
**Last updated:** [November 28, 2018, 11:46pm UTC](https://discourse.processing.org/t/fixing-mouse-position-to-window-center/6023 "2018-11-28T23:46:18Z")

</div>

Is it possible to set the cursor position to the center (or anywhere else) of the screen? Similar to how games hide the cursor and don’t let it escape the window. Context: I’m making a 3D scene, and want the camera to …

---

## [Random colours problem](https://discourse.processing.org/t/random-colours-problem/6044)

<div class="topic-metadata">

**Author:** [@oscie24](https://discourse.processing.org/u/oscie24)\
**Replies:** 2\
**Last updated:** [November 28, 2018, 9:16pm UTC](https://discourse.processing.org/t/random-colours-problem/6044 "2018-11-28T21:16:18Z")

</div>

For my tessellation project, I’m so near to finishing. I didn’t spot this problem until a friend of mine pointed it out. What I have I done is when I click anywhere within the small grid that will tessellate that onto th…

---

## [Help with a Problem](https://discourse.processing.org/t/help-with-a-problem/6048)

<div class="topic-metadata">

**Author:** [@drakenus777](https://discourse.processing.org/u/drakenus777)\
**Replies:** 1\
**Last updated:** [November 28, 2018, 9:11pm UTC](https://discourse.processing.org/t/help-with-a-problem/6048 "2018-11-28T21:11:29Z")

</div>

Relatively New Programmer Asking for help. So I am making a Beginner “game” in processing where I’m to supposed reset a character’s timer when they collide with an enemy. Here is the code: public void timer() { newt…

---

## [How to populate a String?](https://discourse.processing.org/t/how-to-populate-a-string/6029)

<div class="topic-metadata">

**Author:** [@polispace](https://discourse.processing.org/u/polispace)\
**Replies:** 6\
**Last updated:** [November 28, 2018, 8:42pm UTC](https://discourse.processing.org/t/how-to-populate-a-string/6029 "2018-11-28T20:42:14Z")

</div>

Hi there, I’m braking down a bigger code in to small parts. Now i’m stuck with what I guess is a basic things. I would like to simply display words I have in a text file .txt. I written a code but i get the error “nu…

---

## [How to create a reset for my program](https://discourse.processing.org/t/how-to-create-a-reset-for-my-program/6036)

<div class="topic-metadata">

**Author:** [@evasiv](https://discourse.processing.org/u/evasiv)\
**Replies:** 1\
**Last updated:** [November 28, 2018, 6:13pm UTC](https://discourse.processing.org/t/how-to-create-a-reset-for-my-program/6036 "2018-11-28T18:13:21Z")

</div>

I created a simple Pong game for my program, currently when the score for one player reaches “10” the window just closes. I’m trying to make it so when it reaches 10 the program will instead just close and then restart, …

---

## [Vertex will not fill (Processing 3)](https://discourse.processing.org/t/vertex-will-not-fill-processing-3/6013)

<div class="topic-metadata">

**Author:** [@Mr\_Dumpling](https://discourse.processing.org/u/Mr_Dumpling)\
**Replies:** 5\
**Last updated:** [November 28, 2018, 3:47pm UTC](https://discourse.processing.org/t/vertex-will-not-fill-processing-3/6013 "2018-11-28T15:47:23Z")

</div>

So I have been trying to make a circle generator using vertexes, as I want to be able to use them in contours. However I have only been able to get points to show up, lines will not connect, and simply make dots every ot…

---

## [Random Walker Spiral using Probabilities](https://discourse.processing.org/t/random-walker-spiral-using-probabilities/5948)

<div class="topic-metadata">

**Author:** [@RC75018](https://discourse.processing.org/u/RC75018)\
**Replies:** 8\
**Last updated:** [November 28, 2018, 1:06pm UTC](https://discourse.processing.org/t/random-walker-spiral-using-probabilities/5948 "2018-11-28T13:06:51Z")

</div>

Hi Everyone, I am working on an algorithm to create a random walker using probabilities. I want to have a controlled random spiral shape. Like this: I have create a random walker class first. When i am trying to make…

---

## [Store values in array](https://discourse.processing.org/t/store-values-in-array/5385)

<div class="topic-metadata">

**Author:** [@b\_and\_z](https://discourse.processing.org/u/b_and_z)\
**Replies:** 7\
**Last updated:** [November 28, 2018, 9:50am UTC](https://discourse.processing.org/t/store-values-in-array/5385 "2018-11-28T09:50:57Z")

</div>

I already posted this on reddit, so here goes: For an installation, I need to create a code where one can press a key (r, g, b, y) which then creates a rgb code for an rgb lamp. There will be a fixed amount of lamps (e.…

---

## [Connect particle previous and current positions with line](https://discourse.processing.org/t/connect-particle-previous-and-current-positions-with-line/6017)

<div class="topic-metadata">

**Author:** [@klaik30](https://discourse.processing.org/u/klaik30)\
**Replies:** 2\
**Last updated:** [November 28, 2018, 8:32am UTC](https://discourse.processing.org/t/connect-particle-previous-and-current-positions-with-line/6017 "2018-11-28T08:32:54Z")

</div>

I’m trying to use a particles previous position to draw a line to its current position but they are always equal even though previous position is got before the position is updated? So I’m following Coding Challenge #24…

---

## [Snake Game problem: having trouble figuring out how to make it reset](https://discourse.processing.org/t/snake-game-problem-having-trouble-figuring-out-how-to-make-it-reset/6005)

<div class="topic-metadata">

**Author:** [@blankbleak](https://discourse.processing.org/u/blankbleak)\
**Replies:** 3\
**Last updated:** [November 28, 2018, 12:05am UTC](https://discourse.processing.org/t/snake-game-problem-having-trouble-figuring-out-how-to-make-it-reset/6005 "2018-11-28T00:05:52Z")

</div>

Hello, I have just started a snake game project for my class, however I’m a little confused with partial arrays in the sense that I am unsure about how to make it start in the top middle of the canvas, I am just confused…

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

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