# Coding Questions

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

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

**Page:** 160

---

## [Change resampling method when resizing](https://discourse.processing.org/t/change-resampling-method-when-resizing/6440)

<div class="topic-metadata">

**Author:** [@jb4x](https://discourse.processing.org/u/jb4x)\
**Replies:** 4\
**Last updated:** [December 13, 2018, 6:46pm UTC](https://discourse.processing.org/t/change-resampling-method-when-resizing/6440 "2018-12-13T18:46:35Z")

</div>

Hi, Is there a way to change the resampling method when resizing a PGraphics object? I would like to have the nearest-neighbor interpolation in the following code: void setup() { size(512, 512); PGraphics pg = …

---

## [Copying from NYTimes API JSON to a local JSON file](https://discourse.processing.org/t/copying-from-nytimes-api-json-to-a-local-json-file/6462)

<div class="topic-metadata">

**Author:** [@Niloo](https://discourse.processing.org/u/Niloo)\
**Replies:** 2\
**Last updated:** [December 13, 2018, 7:19am UTC](https://discourse.processing.org/t/copying-from-nytimes-api-json-to-a-local-json-file/6462 "2018-12-13T07:19:09Z")

</div>

Hi all, I really appreciate if you take the time and help me solve this issue as I have spent hours and haven’t made any progress. What’s the project I’m creating a data visualization project using New York Times Arti…

---

## [Has anyone used the mousewheel to select between shapes onscreen](https://discourse.processing.org/t/has-anyone-used-the-mousewheel-to-select-between-shapes-onscreen/6547)

<div class="topic-metadata">

**Author:** [@CalvinBreene](https://discourse.processing.org/u/CalvinBreene)\
**Replies:** 4\
**Last updated:** [December 13, 2018, 4:28am UTC](https://discourse.processing.org/t/has-anyone-used-the-mousewheel-to-select-between-shapes-onscreen/6547 "2018-12-13T04:28:20Z")

</div>

Hi Experts, I have 3 rectangles onscreen and want to use the mouse wheel to highlight each one in turn. Has anyone done something similar? I would appreciate an example if possible. Thank you. KB

---

## [I need help coming up with a very simple little polymorphism animation](https://discourse.processing.org/t/i-need-help-coming-up-with-a-very-simple-little-polymorphism-animation/6291)

<div class="topic-metadata">

**Author:** [@starkid](https://discourse.processing.org/u/starkid)\
**Replies:** 2\
**Last updated:** [December 7, 2018, 1:02am UTC](https://discourse.processing.org/t/i-need-help-coming-up-with-a-very-simple-little-polymorphism-animation/6291 "2018-12-07T01:02:48Z")

</div>

I need to make a very simple and small animation using polymorphism. I have looked at examples and watched video but most of them are too complicated or large, and I want something small. Any suggestions on what I could …

---

## [Scaling on High-DPI Monitor is Incorrect](https://discourse.processing.org/t/scaling-on-high-dpi-monitor-is-incorrect/6407)

<div class="topic-metadata">

**Author:** [@RecursiveCursive](https://discourse.processing.org/u/RecursiveCursive)\
**Replies:** 1\
**Last updated:** [December 12, 2018, 8:58pm UTC](https://discourse.processing.org/t/scaling-on-high-dpi-monitor-is-incorrect/6407 "2018-12-12T20:58:23Z")

</div>

I wrote a sketch using Processing 2 but rather than using the Processing IDE, I used Eclipse. I now want to export the sketch as a jar file, but I am having an annoying issue when trying to run the resulting jar on a dis…

---

## [Object stop upon collision?](https://discourse.processing.org/t/object-stop-upon-collision/6498)

<div class="topic-metadata">

**Author:** [@MartinM](https://discourse.processing.org/u/MartinM)\
**Replies:** 7\
**Last updated:** [December 12, 2018, 1:51pm UTC](https://discourse.processing.org/t/object-stop-upon-collision/6498 "2018-12-12T13:51:02Z")

</div>

I am currently having a problem with collision, I do not want an object to pass through another of which I understand the basics of. For instance: nt\[\] player1; int\[\] player2; int p1width = 50; int p1height = 50; int p2…

---

## [Random circles using arrays](https://discourse.processing.org/t/random-circles-using-arrays/6536)

<div class="topic-metadata">

**Author:** [@Jrekz](https://discourse.processing.org/u/Jrekz)\
**Replies:** 1\
**Last updated:** [December 12, 2018, 1:13pm UTC](https://discourse.processing.org/t/random-circles-using-arrays/6536 "2018-12-12T13:13:39Z")

</div>

Hello, So I have these tasks: 1. When the sketch starts, a circle with a random size, position and border color is displayed in the window and a first circle with a radius of 10 pixels on the mouse position. 2. Every…

---

## [Whack-a-Mole Game. Make Mole Change Color When Hit](https://discourse.processing.org/t/whack-a-mole-game-make-mole-change-color-when-hit/6523)

<div class="topic-metadata">

**Author:** [@Rapide](https://discourse.processing.org/u/Rapide)\
**Replies:** 2\
**Last updated:** [December 12, 2018, 6:00am UTC](https://discourse.processing.org/t/whack-a-mole-game-make-mole-change-color-when-hit/6523 "2018-12-12T06:00:58Z")

</div>

I’m making a whack a mole game for my class assignment. I’m pretty much finished besides the final step, which is to make the mole change color when it is clicked on by the mouse, but I’m having trouble doing so. I want…

---

## [MazzSweeper Game](https://discourse.processing.org/t/mazzsweeper-game/6519)

<div class="topic-metadata">

**Author:** [@Jolak101](https://discourse.processing.org/u/Jolak101)\
**Replies:** 7\
**Last updated:** [December 11, 2018, 11:32pm UTC](https://discourse.processing.org/t/mazzsweeper-game/6519 "2018-12-11T23:32:35Z")

</div>

Hey, I am attempting to create a Minesweeper game with a chemistry twist to it on processing. In my code, the if statement to unveil what is hidden under the square (bomb or number) did not work. I attempted to println w…

---

## [StringDict.get() Problem](https://discourse.processing.org/t/stringdict-get-problem/6435)

<div class="topic-metadata">

**Author:** [@JoshElliott](https://discourse.processing.org/u/JoshElliott)\
**Replies:** 9\
**Last updated:** [December 11, 2018, 11:01am UTC](https://discourse.processing.org/t/stringdict-get-problem/6435 "2018-12-11T11:01:21Z")

</div>

Hi All, Sorry, I’m pretty new to all this. I have a project I’m working on that saves keyboard input to a StringDict with a keyword for each of a number of associated textfield objects. It seems to be mostly operationa…

---

## [Zooming + Scrolling in a Procedural Drawing Application need some help finishing off](https://discourse.processing.org/t/zooming-scrolling-in-a-procedural-drawing-application-need-some-help-finishing-off/5177)

<div class="topic-metadata">

**Author:** [@FyodorKrasniy](https://discourse.processing.org/u/FyodorKrasniy)\
**Replies:** 3\
**Last updated:** [December 11, 2018, 10:06am UTC](https://discourse.processing.org/t/zooming-scrolling-in-a-procedural-drawing-application-need-some-help-finishing-off/5177 "2018-12-11T10:06:22Z")

</div>

Hi guys, I made a post a long while ago working on the zoom interface for this drawing app Ive been working on, Ive got it closish to what I want but am having issues with figuring out how to make the zoom focus on the m…

---

## [Loop inside class instancing problem](https://discourse.processing.org/t/loop-inside-class-instancing-problem/6494)

<div class="topic-metadata">

**Author:** [@Rangerz132](https://discourse.processing.org/u/Rangerz132)\
**Replies:** 1\
**Last updated:** [December 11, 2018, 7:49am UTC](https://discourse.processing.org/t/loop-inside-class-instancing-problem/6494 "2018-12-11T07:49:16Z")

</div>

Hi guys! I’m currently developping a 3D game with processing for a University project. The game is actually a fighter jet poursuit. I have a radar in 2D who map the distance between the enemies and my jet. I have an Arr…

---

## [Seems to be performance issues, but only with one player](https://discourse.processing.org/t/seems-to-be-performance-issues-but-only-with-one-player/6489)

<div class="topic-metadata">

**Author:** [@MartinM](https://discourse.processing.org/u/MartinM)\
**Replies:** 1\
**Last updated:** [December 10, 2018, 9:22pm UTC](https://discourse.processing.org/t/seems-to-be-performance-issues-but-only-with-one-player/6489 "2018-12-10T21:22:07Z")

</div>

I am currently in the process in making a modified version of capture the flag and a quarter way though the process I ran into a weird issue. For some reason when moving player 2, the yellow player, around the board the …

---

## [\[SOLVED\] How can I turn off any filtering? solved thanks to the wonderful @jb4x](https://discourse.processing.org/t/solved-how-can-i-turn-off-any-filtering-solved-thanks-to-the-wonderful-jb4x/6488)

<div class="topic-metadata">

**Author:** [@lord\_berto](https://discourse.processing.org/u/lord_berto)\
**Replies:** 2\
**Last updated:** [December 10, 2018, 8:52pm UTC](https://discourse.processing.org/t/solved-how-can-i-turn-off-any-filtering-solved-thanks-to-the-wonderful-jb4x/6488 "2018-12-10T20:52:23Z")

</div>

Im fairly new to processing. Im using PGraphics to try a simple paint program. but I want my program to be primitive looking ( low resolution ), I’ve managed to get it in fullscreen with a custom low-res resolution, but…

---

## [Making a for loop ( or timer )](https://discourse.processing.org/t/making-a-for-loop-or-timer/6483)

<div class="topic-metadata">

**Author:** [@Sunnylimenoid](https://discourse.processing.org/u/Sunnylimenoid)\
**Replies:** 1\
**Last updated:** [December 10, 2018, 4:58pm UTC](https://discourse.processing.org/t/making-a-for-loop-or-timer/6483 "2018-12-10T16:58:12Z")

</div>

Hello, I am new to processing, but have been trying to figure out how to implement a for loop for my code below. I have only used while loops before, so i’m not used to for loops, but I’m told that they are efficient and…

---

## [Loop after loop in setup](https://discourse.processing.org/t/loop-after-loop-in-setup/6472)

<div class="topic-metadata">

**Author:** [@netphysicist](https://discourse.processing.org/u/netphysicist)\
**Replies:** 5\
**Last updated:** [December 10, 2018, 12:59pm UTC](https://discourse.processing.org/t/loop-after-loop-in-setup/6472 "2018-12-10T12:59:04Z")

</div>

If i want to use a specific loop for two different functions inside the draw what am i suppose to do?? For example if i want to use this : for (int i=0; i\<table.getRowCount(); i++) { for two different function insid…

---

## [How do I make sure that a function is used properly/as intended when called?](https://discourse.processing.org/t/how-do-i-make-sure-that-a-function-is-used-properly-as-intended-when-called/6447)

<div class="topic-metadata">

**Author:** [@klaik30](https://discourse.processing.org/u/klaik30)\
**Replies:** 3\
**Last updated:** [December 10, 2018, 10:49am UTC](https://discourse.processing.org/t/how-do-i-make-sure-that-a-function-is-used-properly-as-intended-when-called/6447 "2018-12-10T10:49:00Z")

</div>

I want to make some code that just converts an int of value 0 or 1 to a boolean but I don’t want the value inputted to be anything other than 0 or 1. If that is the case I want to throw an error and stop the program like…

---

## [Out Of Memory Error](https://discourse.processing.org/t/out-of-memory-error/6442)

<div class="topic-metadata">

**Author:** [@dragon\_hatcher](https://discourse.processing.org/u/dragon_hatcher)\
**Replies:** 6\
**Last updated:** [December 10, 2018, 10:10am UTC](https://discourse.processing.org/t/out-of-memory-error/6442 "2018-12-10T10:10:04Z")

</div>

My project keeps getting an out of memory error after 15 - 20 minutes. However when I looked online at the problem it seemed that this almost always happens when you load some sort of file but I’m not doing this. Does a …

---

## [(Processing 3.0) how to sort string array by value of substrings?](https://discourse.processing.org/t/processing-3-0-how-to-sort-string-array-by-value-of-substrings/6436)

<div class="topic-metadata">

**Author:** [@epicwyvern](https://discourse.processing.org/u/epicwyvern)\
**Replies:** 5\
**Last updated:** [December 10, 2018, 7:47am UTC](https://discourse.processing.org/t/processing-3-0-how-to-sort-string-array-by-value-of-substrings/6436 "2018-12-10T07:47:53Z")

</div>

hello guys im in a bit of a dilemma. i am trying to sort the following text file: a a 1 aasd asdasa 23 aghf bsad 12 ytyi qwea 1222313 hlkjojto erewrui 1222 aerwjdu sdahdsu 1…

---

## [Hidden line removal for wireframe obj as PShape](https://discourse.processing.org/t/hidden-line-removal-for-wireframe-obj-as-pshape/4253)

<div class="topic-metadata">

**Author:** [@ffd8](https://discourse.processing.org/u/ffd8)\
**Replies:** 10\
**Last updated:** [December 9, 2018, 9:44pm UTC](https://discourse.processing.org/t/hidden-line-removal-for-wireframe-obj-as-pshape/4253 "2018-12-09T21:44:47Z")

</div>

Starting to play with importing an obj file using loadShape() and rendering it as a wireframe. Now comes the tricky part… how to do ‘hidden line removal’ (similar to back-face detection, culling… still sorting out exact…

---

## [Mouseclick colorswitch (RGB)](https://discourse.processing.org/t/mouseclick-colorswitch-rgb/6387)

<div class="topic-metadata">

**Author:** [@Student\_NL](https://discourse.processing.org/u/Student_NL)\
**Replies:** 6\
**Last updated:** [December 9, 2018, 8:41pm UTC](https://discourse.processing.org/t/mouseclick-colorswitch-rgb/6387 "2018-12-09T20:41:52Z")

</div>

Hello, I’m trying to figure out how to switch the color of the screen multiple times by using mouseclick/ mousepressed. The background has to switch from black to red, then blue, then green, (and then back to red.) Th…

---

## [How do I draw a continuous line between several points?](https://discourse.processing.org/t/how-do-i-draw-a-continuous-line-between-several-points/6091)

<div class="topic-metadata">

**Author:** [@klaik30](https://discourse.processing.org/u/klaik30)\
**Replies:** 5\
**Last updated:** [December 9, 2018, 6:03pm UTC](https://discourse.processing.org/t/how-do-i-draw-a-continuous-line-between-several-points/6091 "2018-12-09T18:03:46Z")

</div>

I’d like to draw a continuous line between several points. It should be any shape what so ever and not fill anything between any of the points, like drawing with a pen. Picture for reference: I know that if I don’t up…

---

## [Setting a class field array via reflection](https://discourse.processing.org/t/setting-a-class-field-array-via-reflection/6444)

<div class="topic-metadata">

**Author:** [@Aleksi](https://discourse.processing.org/u/Aleksi)\
**Replies:** 7\
**Last updated:** [December 9, 2018, 5:20pm UTC](https://discourse.processing.org/t/setting-a-class-field-array-via-reflection/6444 "2018-12-09T17:20:11Z")

</div>

Hello once again. The pipeline I’m developing uses a csv file to drive the animations. I’ve hit a stumbling block: I’d like to be able to parse a string into a class’s float array field using reflection. I feel like I’m…

---

## [Couple of questions about lights, snow and rain](https://discourse.processing.org/t/couple-of-questions-about-lights-snow-and-rain/6422)

<div class="topic-metadata">

**Author:** [@ant](https://discourse.processing.org/u/ant)\
**Replies:** 7\
**Last updated:** [December 9, 2018, 1:26pm UTC](https://discourse.processing.org/t/couple-of-questions-about-lights-snow-and-rain/6422 "2018-12-09T13:26:39Z")

</div>

Working on a project and I have a few questions before it’s complete. First, on the third stage of my code it is snowing, but when I went to go use the same code I made for rain on my fourth stage the rain is not moving.…

---

## [I need help making save states for an rpg](https://discourse.processing.org/t/i-need-help-making-save-states-for-an-rpg/6428)

<div class="topic-metadata">

**Author:** [@myxen](https://discourse.processing.org/u/myxen)\
**Replies:** 1\
**Last updated:** [December 8, 2018, 7:16pm UTC](https://discourse.processing.org/t/i-need-help-making-save-states-for-an-rpg/6428 "2018-12-08T19:16:19Z")

</div>

how do i make save states in an rpg game in processing

---

## [Updating '1.0.3' processing version code to the current version of processing?](https://discourse.processing.org/t/updating-1-0-3-processing-version-code-to-the-current-version-of-processing/6379)

<div class="topic-metadata">

**Author:** [@Malvan](https://discourse.processing.org/u/Malvan)\
**Replies:** 3\
**Last updated:** [December 8, 2018, 6:46pm UTC](https://discourse.processing.org/t/updating-1-0-3-processing-version-code-to-the-current-version-of-processing/6379 "2018-12-08T18:46:07Z")

</div>

So i was digging through the internet to find the code of an application, i need, and i’ve successfully found it, but the thing is, the app was written so many years ago, that it’s outdated (it doesnt working properly), …

---

## [Not sure how to slow down the randomizing color](https://discourse.processing.org/t/not-sure-how-to-slow-down-the-randomizing-color/6423)

<div class="topic-metadata">

**Author:** [@charmypatel](https://discourse.processing.org/u/charmypatel)\
**Replies:** 5\
**Last updated:** [December 8, 2018, 6:22pm UTC](https://discourse.processing.org/t/not-sure-how-to-slow-down-the-randomizing-color/6423 "2018-12-08T18:22:14Z")

</div>

I have this snip it from my code below, and I would like to slow down the rate at which the color randomly changes. I know that is the point of random, but I will be presenting this in class and anyone who has photosensi…

---

## [Match image to data, sequentially](https://discourse.processing.org/t/match-image-to-data-sequentially/6158)

<div class="topic-metadata">

**Author:** [@karinalopez87](https://discourse.processing.org/u/karinalopez87)\
**Replies:** 3\
**Last updated:** [December 8, 2018, 5:36pm UTC](https://discourse.processing.org/t/match-image-to-data-sequentially/6158 "2018-12-08T17:36:47Z")

</div>

Hello everyone, I have an array of numbers from my txt file, e.g. line\[0\] = img\[0\], line\[1\] = img\[1\], … it seems to read all of the images but it only saves one. the code doesn’t give me an error yet it’s not saving m…

---

## [Fill a parabole track](https://discourse.processing.org/t/fill-a-parabole-track/6338)

<div class="topic-metadata">

**Author:** [@saotome](https://discourse.processing.org/u/saotome)\
**Replies:** 16\
**Last updated:** [December 8, 2018, 7:32am UTC](https://discourse.processing.org/t/fill-a-parabole-track/6338 "2018-12-08T07:32:54Z")

</div>

Hi I have this code and I want to draw each point of the parabole instead of viewing only the point moving. Code is the following float dx=10; // Inital x position float dy=620; // Inital y position float vx=0; // I…

---

## [Generating random images in an array one at a time](https://discourse.processing.org/t/generating-random-images-in-an-array-one-at-a-time/6413)

<div class="topic-metadata">

**Author:** [@Taikun649](https://discourse.processing.org/u/Taikun649)\
**Replies:** 2\
**Last updated:** [December 8, 2018, 5:00am UTC](https://discourse.processing.org/t/generating-random-images-in-an-array-one-at-a-time/6413 "2018-12-08T05:00:49Z")

</div>

Hello! I’m fairly new to this so please bear with me. I’ve been looking all over the place but I couldn’t find anything on this in particular. So I made a little game where you have different types of food moving from t…

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

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