# Coding Questions

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

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

**Page:** 167

---

## [lerpColor and float\[\] values do not seem to change](https://discourse.processing.org/t/lerpcolor-and-float-values-do-not-seem-to-change/5207)

<div class="topic-metadata">

**Author:** [@mhmmadeel](https://discourse.processing.org/u/mhmmadeel)\
**Replies:** 4\
**Last updated:** [November 6, 2018, 2:00am UTC](https://discourse.processing.org/t/lerpcolor-and-float-values-do-not-seem-to-change/5207 "2018-11-06T02:00:52Z")

</div>

Hi everyone :blush: I’m currently new to coding and am taking a class for it at a university. I have a code running which is currently reading the data from the NYC Tree Census and loading svg’s of the leaf shape for t…

---

## [Alternative to for and while loops?](https://discourse.processing.org/t/alternative-to-for-and-while-loops/5142)

<div class="topic-metadata">

**Author:** [@Lexyth](https://discourse.processing.org/u/Lexyth)\
**Replies:** 6\
**Last updated:** [November 6, 2018, 12:19am UTC](https://discourse.processing.org/t/alternative-to-for-and-while-loops/5142 "2018-11-06T00:19:28Z")

</div>

I‘m looking for an alternative for for and while loops. The functionality i‘m looking for is basically the speed given by a for loop or a while loop. The Problem lies in the fact, that if my for loop is too big (millions…

---

## [Moving objects: move game ghost back and forth](https://discourse.processing.org/t/moving-objects-move-game-ghost-back-and-forth/5206)

<div class="topic-metadata">

**Author:** [@ari\_y](https://discourse.processing.org/u/ari_y)\
**Replies:** 5\
**Last updated:** [November 5, 2018, 11:18pm UTC](https://discourse.processing.org/t/moving-objects-move-game-ghost-back-and-forth/5206 "2018-11-05T23:18:14Z")

</div>

I’m new to coding and I’m trying to write a program that is similar to the pacman game. I can’t figure out how to move the ghost back and forth using parameters. here’s part of my code: void drawRedghost(int x, int y)…

---

## [Problem with colors](https://discourse.processing.org/t/problem-with-colors/5241)

<div class="topic-metadata">

**Author:** [@mikany](https://discourse.processing.org/u/mikany)\
**Replies:** 1\
**Last updated:** [November 5, 2018, 10:08pm UTC](https://discourse.processing.org/t/problem-with-colors/5241 "2018-11-05T22:08:44Z")

</div>

Hi my project is a little paint program but i have problems with the colorChooser in java , for change of color , to change color, pressing the color button opens chooser color but does not change it.

---

## [Loading in svg : problem](https://discourse.processing.org/t/loading-in-svg-problem/5224)

<div class="topic-metadata">

**Author:** [@Elrig23](https://discourse.processing.org/u/Elrig23)\
**Replies:** 2\
**Last updated:** [November 5, 2018, 8:31pm UTC](https://discourse.processing.org/t/loading-in-svg-problem/5224 "2018-11-05T20:31:00Z")

</div>

Hi there I am trying to import a vector using the load shape command, it’s a Dennis the menace top and it keeps loading in as black. I haven’t done any fills just a standard loadshape. What could I do to fix this ?

---

## [I need help with my program ( PROCESSING 3.0)](https://discourse.processing.org/t/i-need-help-with-my-program-processing-3-0/5212)

<div class="topic-metadata">

**Author:** [@epicwyvern](https://discourse.processing.org/u/epicwyvern)\
**Replies:** 2\
**Last updated:** [November 5, 2018, 8:17pm UTC](https://discourse.processing.org/t/i-need-help-with-my-program-processing-3-0/5212 "2018-11-05T20:17:54Z")

</div>

hi i need help. i have a settings page for this program that has a function to turn the border on and off, which is controlled by the boolean borders. however, another function, which can turn the background on or off, …

---

## [PImage::save() returns a bigger image than the input](https://discourse.processing.org/t/pimage-save-returns-a-bigger-image-than-the-input/5231)

<div class="topic-metadata">

**Author:** [@Rothuskrill](https://discourse.processing.org/u/Rothuskrill)\
**Replies:** 4\
**Last updated:** [November 5, 2018, 5:18pm UTC](https://discourse.processing.org/t/pimage-save-returns-a-bigger-image-than-the-input/5231 "2018-11-05T17:18:50Z")

</div>

Hello everyone, I am currenlty playing with the load/save methods built-in processing, and I notice something weird with this simple snippet : PImage test = loadImage(“store.png”); test.save(“store2.png”); The image …

---

## [Point co-ordinate generator using mouse](https://discourse.processing.org/t/point-co-ordinate-generator-using-mouse/5203)

<div class="topic-metadata">

**Author:** [@ReDeagle](https://discourse.processing.org/u/ReDeagle)\
**Replies:** 7\
**Last updated:** [November 5, 2018, 1:52pm UTC](https://discourse.processing.org/t/point-co-ordinate-generator-using-mouse/5203 "2018-11-05T13:52:39Z")

</div>

I’m trying to make a piece of code that displays the co-ordinates at which the mouseX and mouseY co-ordinates are. This is the code I have so far… Help? int mousex = mouseX; int mousey = mouseY; void setup () { size (…

---

## [Making a secret message reader](https://discourse.processing.org/t/making-a-secret-message-reader/5031)

<div class="topic-metadata">

**Author:** [@Dee-3\_123](https://discourse.processing.org/u/Dee-3_123)\
**Replies:** 23\
**Last updated:** [November 5, 2018, 10:11am UTC](https://discourse.processing.org/t/making-a-secret-message-reader/5031 "2018-11-05T10:11:05Z")

</div>

Hello everyone, right now I am working on a code which accepts number of letters from users and convert it in encrypted message. but I had a problem while declaring 8=1. how can I declare 8=1.

---

## [Help with drawing checker board](https://discourse.processing.org/t/help-with-drawing-checker-board/5214)

<div class="topic-metadata">

**Author:** [@gpevehou](https://discourse.processing.org/u/gpevehou)\
**Replies:** 3\
**Last updated:** [November 5, 2018, 7:22am UTC](https://discourse.processing.org/t/help-with-drawing-checker-board/5214 "2018-11-05T07:22:09Z")

</div>

For my assignment, we have to create a chess board on a canvas so that it doesn’t take up the full canvas. However, all I can create is one that does not look completed. Each square must be 3030 and it is an 88 board. I …

---

## [How to code 3 magnets?](https://discourse.processing.org/t/how-to-code-3-magnets/5173)

<div class="topic-metadata">

**Author:** [@Lexyth](https://discourse.processing.org/u/Lexyth)\
**Replies:** 4\
**Last updated:** [November 5, 2018, 4:35am UTC](https://discourse.processing.org/t/how-to-code-3-magnets/5173 "2018-11-05T04:35:17Z")

</div>

Hi, what i need is less an actualy magnet, than an object that attracts at a higher distance and pushes back if closer. Though not as simple as that. It should basically end up being stuck on a perimeter around the 2st …

---

## [Problem with a variable. Don't know where to declare](https://discourse.processing.org/t/problem-with-a-variable-dont-know-where-to-declare/5155)

<div class="topic-metadata">

**Author:** [@bking](https://discourse.processing.org/u/bking)\
**Replies:** 8\
**Last updated:** [November 4, 2018, 11:32pm UTC](https://discourse.processing.org/t/problem-with-a-variable-dont-know-where-to-declare/5155 "2018-11-04T23:32:54Z")

</div>

Hello, I made a program with works when two variables (here two pulsations) are declared before the setup with a constant value. Like that: float w1 = 0.1; float w2 = 0.11; But actually I want the second value…

---

## [Animated text / Spacing problem](https://discourse.processing.org/t/animated-text-spacing-problem/4559)

<div class="topic-metadata">

**Author:** [@RC75018](https://discourse.processing.org/u/RC75018)\
**Replies:** 4\
**Last updated:** [November 4, 2018, 8:57am UTC](https://discourse.processing.org/t/animated-text-spacing-problem/4559 "2018-11-04T08:57:06Z")

</div>

Hi Everyone, I am trying to create an animated text, starting with a random size and color on the page. Each letter move according a sine fonction. Unfortunately, i get lost in my thoughts and don’t understand anymore…

---

## [Alternative to Circular Array?](https://discourse.processing.org/t/alternative-to-circular-array/5147)

<div class="topic-metadata">

**Author:** [@Lexyth](https://discourse.processing.org/u/Lexyth)\
**Replies:** 13\
**Last updated:** [November 3, 2018, 11:46pm UTC](https://discourse.processing.org/t/alternative-to-circular-array/5147 "2018-11-03T23:46:04Z")

</div>

Now, i‘m not really looking for an alternative for a circular array, But for a System that works similar to it. A circular array is basically a normal array, that works like \[i%array.length\] (if i got that right…). What…

---

## [Sorting Two Arrays at a Time?](https://discourse.processing.org/t/sorting-two-arrays-at-a-time/5164)

<div class="topic-metadata">

**Author:** [@alexac692](https://discourse.processing.org/u/alexac692)\
**Replies:** 2\
**Last updated:** [November 3, 2018, 10:37pm UTC](https://discourse.processing.org/t/sorting-two-arrays-at-a-time/5164 "2018-11-03T22:37:00Z")

</div>

My problem is that I want to take an array and “reassign” indices so that you can list them from lowest to highest, without actually shuffling the original array. In this case it’s with student IDs and I want to be able …

---

## [Draw rows of squares pattern](https://discourse.processing.org/t/draw-rows-of-squares-pattern/5100)

<div class="topic-metadata">

**Author:** [@gpevehou](https://discourse.processing.org/u/gpevehou)\
**Replies:** 10\
**Last updated:** [November 3, 2018, 10:04pm UTC](https://discourse.processing.org/t/draw-rows-of-squares-pattern/5100 "2018-11-03T22:04:41Z")

</div>

This code is supposed to be drawing the attached pattern, but is only drawing one square. . does anyone know what I need to add/ what I’m doing wrong? Thank you! int X\_coordinate=150; int y\_coordinate=200; void change…

---

## [Why does my spikes not show up?](https://discourse.processing.org/t/why-does-my-spikes-not-show-up/5161)

<div class="topic-metadata">

**Author:** [@Xeeker](https://discourse.processing.org/u/Xeeker)\
**Replies:** 2\
**Last updated:** [November 3, 2018, 6:39pm UTC](https://discourse.processing.org/t/why-does-my-spikes-not-show-up/5161 "2018-11-03T18:39:52Z")

</div>

float x = 150; float y = 200; float okning = 3; int toggle = 0; float r; int gravity = 0.07; int velocity; int NumbOfSpikes = 10; //S stands for Spike float\[\] SPos = new float \[NumbOfSpikes\]; float\[\] SX = new float \[N…

---

## [Getting a specific character printed when mouse is clicked](https://discourse.processing.org/t/getting-a-specific-character-printed-when-mouse-is-clicked/5138)

<div class="topic-metadata">

**Author:** [@rebelcoder](https://discourse.processing.org/u/rebelcoder)\
**Replies:** 8\
**Last updated:** [November 3, 2018, 2:29am UTC](https://discourse.processing.org/t/getting-a-specific-character-printed-when-mouse-is-clicked/5138 "2018-11-03T02:29:40Z")

</div>

Hey Guys, I am trying to write a program in which the alphabets are rotating in a circle with constant speed. this is my code for drawing the characters in a circle and then rotating them in a circle. the first angle dra…

---

## [Sliding Tile Puzzle](https://discourse.processing.org/t/sliding-tile-puzzle/4930)

<div class="topic-metadata">

**Author:** [@Shimuni](https://discourse.processing.org/u/Shimuni)\
**Replies:** 8\
**Last updated:** [November 3, 2018, 3:21am UTC](https://discourse.processing.org/t/sliding-tile-puzzle/4930 "2018-11-03T03:21:00Z")

</div>

I have to create a sliding tile puzzle, but it seems I am stuck. I don’t know how to make it so the tiles in the grid can swap places in order for me to arrange them correctly. Integer AmountOfButtons = 16; int cols = 4…

---

## [How to make shapes out of characters using loop?](https://discourse.processing.org/t/how-to-make-shapes-out-of-characters-using-loop/5134)

<div class="topic-metadata">

**Author:** [@rollbon](https://discourse.processing.org/u/rollbon)\
**Replies:** 1\
**Last updated:** [November 2, 2018, 11:07pm UTC](https://discourse.processing.org/t/how-to-make-shapes-out-of-characters-using-loop/5134 "2018-11-02T23:07:22Z")

</div>

I am trying to make a circle that is made out of English Alphabet. I made a String that included the entire alphabet and I tried creating the circle using each character from the string individually using ‘for’ command (…

---

## [Sorting ArrayList](https://discourse.processing.org/t/sorting-arraylist/5083)

<div class="topic-metadata">

**Author:** [@Yann](https://discourse.processing.org/u/Yann)\
**Replies:** 5\
**Last updated:** [November 2, 2018, 10:13pm UTC](https://discourse.processing.org/t/sorting-arraylist/5083 "2018-11-02T22:13:25Z")

</div>

Hi, I can’t find how to sort an ArrayList by one of the variables of the contained objects. Let’s say I have a class like this one: class Event { int position; int value; Event(int p, int v) { position = p;…

---

## [Need a help in simple "Label Marker" processing game](https://discourse.processing.org/t/need-a-help-in-simple-label-marker-processing-game/5130)

<div class="topic-metadata">

**Author:** [@John](https://discourse.processing.org/u/John)\
**Replies:** 1\
**Last updated:** [November 2, 2018, 8:38pm UTC](https://discourse.processing.org/t/need-a-help-in-simple-label-marker-processing-game/5130 "2018-11-02T20:38:40Z")

</div>

As i am new to processing so the program seemed vary hard for me. if some one helped me with that i would be glad.The instructions are given below: Write a program which will allow you to type a message at the bottom of…

---

## [Flood Fill Very Slow](https://discourse.processing.org/t/flood-fill-very-slow/5110)

<div class="topic-metadata">

**Author:** [@murphysuk](https://discourse.processing.org/u/murphysuk)\
**Replies:** 1\
**Last updated:** [November 2, 2018, 6:08pm UTC](https://discourse.processing.org/t/flood-fill-very-slow/5110 "2018-11-02T18:08:14Z")

</div>

I have created the flood fill program shown below. When you click in an area then that shape will fill with black. I am pleased with the result except that it is incredibly slow. I believe this is because every surroundi…

---

## [Filling window with points](https://discourse.processing.org/t/filling-window-with-points/5108)

<div class="topic-metadata">

**Author:** [@techMatt](https://discourse.processing.org/u/techMatt)\
**Replies:** 2\
**Last updated:** [November 2, 2018, 11:15am UTC](https://discourse.processing.org/t/filling-window-with-points/5108 "2018-11-02T11:15:57Z")

</div>

Hello guys, i’m here with my first processing issue. I don’t know why this code doesn’t work. My purpose was filling the entire window with points but i don’t see no points at all. Why?:frowning\_face::frowning\_face: Thi…

---

## [Particles moving away from center, how?](https://discourse.processing.org/t/particles-moving-away-from-center-how/5082)

<div class="topic-metadata">

**Author:** [@evievdm](https://discourse.processing.org/u/evievdm)\
**Replies:** 8\
**Last updated:** [November 2, 2018, 7:38am UTC](https://discourse.processing.org/t/particles-moving-away-from-center-how/5082 "2018-11-02T07:38:14Z")

</div>

Hello everyone! First of all, I am quite a newby to Processing and coding in general, so my code might not look very 'professional. I have created a program that has particles moving around. When the mouse is pressed,…

---

## [Realtime 2D radiosity shader implementation](https://discourse.processing.org/t/realtime-2d-radiosity-shader-implementation/4257)

<div class="topic-metadata">

**Author:** [@solub](https://discourse.processing.org/u/solub)\
**Replies:** 4\
**Last updated:** [October 22, 2018, 9:31am UTC](https://discourse.processing.org/t/realtime-2d-radiosity-shader-implementation/4257 "2018-10-22T09:31:47Z")

</div>

Hi all, I was wondering if some of you could help me make this 2D radiosity shader work with Processing. By “work”, I mean being able: to apply the shader to basic shape primitives (rect, ellipse, triangle, arc) draw…

---

## [How should I structure the Main loop for my game?](https://discourse.processing.org/t/how-should-i-structure-the-main-loop-for-my-game/5009)

<div class="topic-metadata">

**Author:** [@Angle](https://discourse.processing.org/u/Angle)\
**Replies:** 4\
**Last updated:** [November 1, 2018, 11:23pm UTC](https://discourse.processing.org/t/how-should-i-structure-the-main-loop-for-my-game/5009 "2018-11-01T23:23:16Z")

</div>

Should I just use the draw() method from processing? Or should I use noLoop() and write my own main loop code instead? I want to implement dt (deltaTime, used to keep gameplay smooth) and all that jazz, so it seems like …

---

## [Black Box Behind Letters (how to eliminate)](https://discourse.processing.org/t/black-box-behind-letters-how-to-eliminate/5043)

<div class="topic-metadata">

**Author:** [@sirianth](https://discourse.processing.org/u/sirianth)\
**Replies:** 8\
**Last updated:** [November 1, 2018, 11:13pm UTC](https://discourse.processing.org/t/black-box-behind-letters-how-to-eliminate/5043 "2018-11-01T23:13:11Z")

</div>

I have some black boxes behind my text. What causes this and how do I elminate it? I can past my code, but my code is really long…

---

## [How to turn this code into a simple loop?](https://discourse.processing.org/t/how-to-turn-this-code-into-a-simple-loop/5098)

<div class="topic-metadata">

**Author:** [@rollbon](https://discourse.processing.org/u/rollbon)\
**Replies:** 1\
**Last updated:** [November 1, 2018, 10:27pm UTC](https://discourse.processing.org/t/how-to-turn-this-code-into-a-simple-loop/5098 "2018-11-01T22:27:08Z")

</div>

How can I turn this code into a simple loop using ‘for’ command? The first circle is the smallest circle, each circle, fill subtracts 30 and size grows by 10. The x and y stay the same. void setup(){ size(500, 500); …

---

## [NullPointerException](https://discourse.processing.org/t/nullpointerexception/5079)

<div class="topic-metadata">

**Author:** [@rohmat](https://discourse.processing.org/u/rohmat)\
**Replies:** 20\
**Last updated:** [November 1, 2018, 9:05pm UTC](https://discourse.processing.org/t/nullpointerexception/5079 "2018-11-01T21:05:21Z")

</div>

when i run my program, the message error say NullPointed Exception. could someone help me to fix my program? I’m still beginer with Processing Benda\[\] bola = new Benda\[20\]; color warna; PVector gravitasi; PVector angi…

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

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