# Coding Questions

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

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

**Page:** 19

---

## [Porting Prim’s Algorithm notebook from JavaScript to Java](https://discourse.processing.org/t/porting-prim-s-algorithm-notebook-from-javascript-to-java/26840)

<div class="topic-metadata">

**Author:** [@micycle](https://discourse.processing.org/u/micycle)\
**Replies:** 6\
**Last updated:** [December 22, 2022, 9:04pm UTC](https://discourse.processing.org/t/porting-prim-s-algorithm-notebook-from-javascript-to-java/26840 "2022-12-22T21:04:06Z")

</div>

I came across this funky color-cycling Prim’s Algorithm Observable notebook and I’m trying to port it to Processing Java. But surprise surprise it’s not working. So I’ve annotated the ported code with my interpretatio…

---

## [Rasterizing Image with grid of dice](https://discourse.processing.org/t/rasterizing-image-with-grid-of-dice/40176)

<div class="topic-metadata">

**Author:** [@asymmetric](https://discourse.processing.org/u/asymmetric)\
**Replies:** 9\
**Last updated:** [December 21, 2022, 6:01pm UTC](https://discourse.processing.org/t/rasterizing-image-with-grid-of-dice/40176 "2022-12-21T18:01:17Z")

</div>

Hi! I am trying to rasterize an image with dice connected to each pixel value, but I am running into a wall with sizing the dice appropriately. Goal: Current output: Input image: Current code: PImage img; …

---

## [Processing 4.0.2 and above giving "Cannot find a class or type named 'PApplet'" error](https://discourse.processing.org/t/processing-4-0-2-and-above-giving-cannot-find-a-class-or-type-named-papplet-error/40110)

<div class="topic-metadata">

**Author:** [@mirek](https://discourse.processing.org/u/mirek)\
**Replies:** 2\
**Last updated:** [December 21, 2022, 2:13pm UTC](https://discourse.processing.org/t/processing-4-0-2-and-above-giving-cannot-find-a-class-or-type-named-papplet-error/40110 "2022-12-21T14:13:00Z")

</div>

I’m maintaining an open-source Processing app — GitHub - FOSStriangulator/FOSStriangulator: A tool for making triangulated illustrations out of photos . It used to compile just fine with every Processing version I’ve tri…

---

## [Help processing GIF](https://discourse.processing.org/t/help-processing-gif/40207)

<div class="topic-metadata">

**Author:** [@polllynarium](https://discourse.processing.org/u/polllynarium)\
**Replies:** 3\
**Last updated:** [December 19, 2022, 11:45pm UTC](https://discourse.processing.org/t/help-processing-gif/40207 "2022-12-19T23:45:22Z")

</div>

Hi! It does not work to saddle the gif, the balls disappear because it is not necessary, and the radius does not decrease, I attach the code, please see what is wrong! }Preformatted text float angle; float w = 36; …

---

## [Creating variation in grid with random(); & image](https://discourse.processing.org/t/creating-variation-in-grid-with-random-image/40135)

<div class="topic-metadata">

**Author:** [@asymmetric](https://discourse.processing.org/u/asymmetric)\
**Replies:** 27\
**Last updated:** [December 19, 2022, 7:05pm UTC](https://discourse.processing.org/t/creating-variation-in-grid-with-random-image/40135 "2022-12-19T19:05:02Z")

</div>

I’m interested in morphing the grid with randomness while also having an image interact with the grid. How do I go about designing varying cells and joining them together as a grid image? Can I use the random(); with (TR…

---

## [Error while running Processing with Maven](https://discourse.processing.org/t/error-while-running-processing-with-maven/26420)

<div class="topic-metadata">

**Author:** [@bugaj](https://discourse.processing.org/u/bugaj)\
**Replies:** 16\
**Last updated:** [December 20, 2022, 6:40pm UTC](https://discourse.processing.org/t/error-while-running-processing-with-maven/26420 "2022-12-20T18:40:35Z")

</div>

I’m trying to run an app build with maven with processing-core dependency. As far as I can tell there is problem with one of the internal dependencies in library’s POM file that prevents program from recognizing processi…

---

## [True and false keycodes for game (Quiz / true or false game)](https://discourse.processing.org/t/true-and-false-keycodes-for-game-quiz-true-or-false-game/15884)

<div class="topic-metadata">

**Author:** [@Zayba](https://discourse.processing.org/u/Zayba)\
**Replies:** 40\
**Last updated:** [December 20, 2022, 2:21pm UTC](https://discourse.processing.org/t/true-and-false-keycodes-for-game-quiz-true-or-false-game/15884 "2022-12-20T14:21:29Z")

</div>

I am a new learner in coding, and i can’t figure out how to make this true and false game work. if it is possible can someone help me with making a keycode ‘t’ for true and keycode ‘f’ for false? thanks! String myText; …

---

## [COMPARE DATAS to know if at least one data has the same value as another](https://discourse.processing.org/t/compare-datas-to-know-if-at-least-one-data-has-the-same-value-as-another/40133)

<div class="topic-metadata">

**Author:** [@bking](https://discourse.processing.org/u/bking)\
**Replies:** 21\
**Last updated:** [December 19, 2022, 2:38pm UTC](https://discourse.processing.org/t/compare-datas-to-know-if-at-least-one-data-has-the-same-value-as-another/40133 "2022-12-19T14:38:25Z")

</div>

Dear you :wink: I’m trying to find a way to compare two datas or more, in order to know if they has the same value. For exemple if the data TrigmodPos\[10\]=0 && TrigmodPos\[7\]=0, I would like to switch only theses datas…

---

## [Sometimes when the bullet touch the zombie, i receive an error!](https://discourse.processing.org/t/sometimes-when-the-bullet-touch-the-zombie-i-receive-an-error/40053)

<div class="topic-metadata">

**Author:** [@C2014](https://discourse.processing.org/u/C2014)\
**Replies:** 2\
**Last updated:** [December 19, 2022, 9:14pm UTC](https://discourse.processing.org/t/sometimes-when-the-bullet-touch-the-zombie-i-receive-an-error/40053 "2022-12-19T21:14:00Z")

</div>

IndexOutOfBoundsException: Index 1 out of bounds for length 1 This is my code, if someone can help me : Enemy\[\] zombie; int maxzombie=8; //Enemy zombie,zombie2,zombie3; boolean enemyspawn=false; PImage background,gif…

---

## [SelectInput: I like to tell it the folder to use?](https://discourse.processing.org/t/selectinput-i-like-to-tell-it-the-folder-to-use/13703)

<div class="topic-metadata">

**Author:** [@Chrisir](https://discourse.processing.org/u/Chrisir)\
**Replies:** 9\
**Last updated:** [December 19, 2022, 7:47pm UTC](https://discourse.processing.org/t/selectinput-i-like-to-tell-it-the-folder-to-use/13703 "2022-12-19T19:47:13Z")

</div>

Hello all, I‘d like to tell selectInput() which folder and file extension to use: File file1= new File( sketchPath(”“) + ”\*.txt“); selectInput(”...“, ”...“, file1); Doesn’t work. It starts with the Desktop Folder ins…

---

## [NullPointerException error](https://discourse.processing.org/t/nullpointerexception-error/40167)

<div class="topic-metadata">

**Author:** [@onosecond](https://discourse.processing.org/u/onosecond)\
**Replies:** 7\
**Last updated:** [December 17, 2022, 6:46pm UTC](https://discourse.processing.org/t/nullpointerexception-error/40167 "2022-12-17T18:46:57Z")

</div>

Question \[\] questions; //array of objects for the question class Screens sc; // object of the screen class Answers ans; final int stateFirst=0; //cannot be changed final int stateGameOver=1; final int stateq1=2; final in…

---

## [Detect multiple key presses at once?](https://discourse.processing.org/t/detect-multiple-key-presses-at-once/40193)

<div class="topic-metadata">

**Author:** [@REK166](https://discourse.processing.org/u/REK166)\
**Replies:** 2\
**Last updated:** [December 17, 2022, 6:24pm UTC](https://discourse.processing.org/t/detect-multiple-key-presses-at-once/40193 "2022-12-17T18:24:13Z")

</div>

Is there a way to access all buttons currently pressed? If not, why? And if there is, how?

---

## [Making a mergesort visualization](https://discourse.processing.org/t/making-a-mergesort-visualization/40158)

<div class="topic-metadata">

**Author:** [@MarcosN](https://discourse.processing.org/u/MarcosN)\
**Replies:** 2\
**Last updated:** [December 15, 2022, 1:49am UTC](https://discourse.processing.org/t/making-a-mergesort-visualization/40158 "2022-12-15T01:49:07Z")

</div>

I made a topic earlier about quicksort, now i’m onto mergesort and it’s way harder because of the nature of it’s temporary arrays. What we were talking about on the other topic ended up becoming this code. It fails if …

---

## [Creating 3D animation with math expressions](https://discourse.processing.org/t/creating-3d-animation-with-math-expressions/40152)

<div class="topic-metadata">

**Author:** [@aalgoro](https://discourse.processing.org/u/aalgoro)\
**Replies:** 4\
**Last updated:** [December 14, 2022, 12:42pm UTC](https://discourse.processing.org/t/creating-3d-animation-with-math-expressions/40152 "2022-12-14T12:42:19Z")

</div>

Hello I’ve been trying to create this animation However, I have very liitle idea on how i can make it. I wrote a code for two spinning ellipses, but I don’t think that it is correct to start with circles. Maybe PVect…

---

## [Making an image change when you press the keyboard, like a slideshow](https://discourse.processing.org/t/making-an-image-change-when-you-press-the-keyboard-like-a-slideshow/40139)

<div class="topic-metadata">

**Author:** [@Darkafterzoom](https://discourse.processing.org/u/Darkafterzoom)\
**Replies:** 17\
**Last updated:** [December 13, 2022, 7:17am UTC](https://discourse.processing.org/t/making-an-image-change-when-you-press-the-keyboard-like-a-slideshow/40139 "2022-12-13T07:17:23Z")

</div>

Hello, I just need help with a simple code. PImage \[\] images = new PImage\[3\] images\[0\] = loadImage("ImageOne.jpg"); images\[1\] = loadImage("ImageTwo.jpg"); images\[2\] = loadImage("ImageThree.jpg"); I have several …

---

## [Think I found a bug in P3D](https://discourse.processing.org/t/think-i-found-a-bug-in-p3d/40117)

<div class="topic-metadata">

**Author:** [@Mikey83](https://discourse.processing.org/u/Mikey83)\
**Replies:** 6\
**Last updated:** [December 13, 2022, 2:20am UTC](https://discourse.processing.org/t/think-i-found-a-bug-in-p3d/40117 "2022-12-13T02:20:03Z")

</div>

So ive been working on a little project today and ran into an issue, wondering if anyone can tell my why its happening, theres a get() line commented out under the draw function, with it commented out it breaks and stops…

---

## [Initializing stacked circles in setup() vs draw() draws only one circle](https://discourse.processing.org/t/initializing-stacked-circles-in-setup-vs-draw-draws-only-one-circle/40136)

<div class="topic-metadata">

**Author:** [@debxyz](https://discourse.processing.org/u/debxyz)\
**Replies:** 2\
**Last updated:** [December 13, 2022, 1:39am UTC](https://discourse.processing.org/t/initializing-stacked-circles-in-setup-vs-draw-draws-only-one-circle/40136 "2022-12-13T01:39:16Z")

</div>

Hello all :nerd\_face: This is an extension of a previous topic thread here: Updating stacked circles drawn with curveVertex() and for-loop But the focus is a bit different to warrant a new thread perhaps. I have move…

---

## [Processing resize images without blur?](https://discourse.processing.org/t/processing-resize-images-without-blur/39982)

<div class="topic-metadata">

**Author:** [@turke1034](https://discourse.processing.org/u/turke1034)\
**Replies:** 6\
**Last updated:** [December 13, 2022, 1:39am UTC](https://discourse.processing.org/t/processing-resize-images-without-blur/39982 "2022-12-13T01:39:09Z")

</div>

I’ve done extensive research for this, but I can’t seem to find anything that works :frowning: My problem is, my game is themed around pixel art however when resizing images in processing, the image becomes blurry. My g…

---

## [Question does not show on screen](https://discourse.processing.org/t/question-does-not-show-on-screen/40127)

<div class="topic-metadata">

**Author:** [@onosecond](https://discourse.processing.org/u/onosecond)\
**Replies:** 4\
**Last updated:** [December 12, 2022, 11:13pm UTC](https://discourse.processing.org/t/question-does-not-show-on-screen/40127 "2022-12-12T23:13:44Z")

</div>

Hi everyone, I am working on a quiz game in processing. The first screen will display just a welcoming text and you should press space in order to move to the next screen. I am using states to control when each screen s…

---

## [Lerp unintentional offset: help me understand](https://discourse.processing.org/t/lerp-unintentional-offset-help-me-understand/40090)

<div class="topic-metadata">

**Author:** [@i-draw-monkeys](https://discourse.processing.org/u/i-draw-monkeys)\
**Replies:** 6\
**Last updated:** [December 12, 2022, 10:50am UTC](https://discourse.processing.org/t/lerp-unintentional-offset-help-me-understand/40090 "2022-12-12T10:50:44Z")

</div>

I honestly feel someone else will look at this and understand the issue right away, like I feel like it is glaringly obvious but somehow I don’t get it. I am simply trying to get a set of evenly set points that fall alon…

---

## [How do I move ball shape from corner to corner?](https://discourse.processing.org/t/how-do-i-move-ball-shape-from-corner-to-corner/40087)

<div class="topic-metadata">

**Author:** [@ilhxmun](https://discourse.processing.org/u/ilhxmun)\
**Replies:** 6\
**Last updated:** [December 11, 2022, 8:23pm UTC](https://discourse.processing.org/t/how-do-i-move-ball-shape-from-corner-to-corner/40087 "2022-12-11T20:23:44Z")

</div>

Hi, I need to make a program in processing where a ball moves from each corner of the screen to the other. I keep getting stuck at the 3rd corner. Another option for my assignment is making a ball grow bigger as it move…

---

## [How to Change Image RBG value when image hits x or y axis](https://discourse.processing.org/t/how-to-change-image-rbg-value-when-image-hits-x-or-y-axis/40114)

<div class="topic-metadata">

**Author:** [@Mikella](https://discourse.processing.org/u/Mikella)\
**Replies:** 2\
**Last updated:** [December 11, 2022, 6:22pm UTC](https://discourse.processing.org/t/how-to-change-image-rbg-value-when-image-hits-x-or-y-axis/40114 "2022-12-11T18:22:51Z")

</div>

Hi so I’m brand new to coding, just started maybe a week ago for a class. I’m trying to code the “dvd logo.png” image to hit a random RGB value when it hits the x and y borders of the window. So far it will load a random…

---

## [Converting JS (DTwitter) code into Processing](https://discourse.processing.org/t/converting-js-dtwitter-code-into-processing/40083)

<div class="topic-metadata">

**Author:** [@funnyrectangles](https://discourse.processing.org/u/funnyrectangles)\
**Replies:** 8\
**Last updated:** [December 11, 2022, 4:43pm UTC](https://discourse.processing.org/t/converting-js-dtwitter-code-into-processing/40083 "2022-12-11T16:43:34Z")

</div>

Hi, is it possible to convert this JS (Dtwitter) code into regular Processing code? function u(t) { T(\[0,0,c.width|=T=(A,i=0,z,p=S(t++)/3+.5)=\>i++\>12?x.strokeRect(...A):T(A=\[...A\],i,z=A\[2+i%2\]\*=p,T(A,i),A\[i%=2\]+=z,A\[2+…

---

## [Updating stacked circles drawn with curveVertex() and for-loop](https://discourse.processing.org/t/updating-stacked-circles-drawn-with-curvevertex-and-for-loop/40097)

<div class="topic-metadata">

**Author:** [@debxyz](https://discourse.processing.org/u/debxyz)\
**Replies:** 2\
**Last updated:** [December 10, 2022, 2:00am UTC](https://discourse.processing.org/t/updating-stacked-circles-drawn-with-curvevertex-and-for-loop/40097 "2022-12-10T02:00:06Z")

</div>

Hello! :nerd\_face: In the current approach update() accesses only part of the circle’s vertices. But I need the last three vertices outside of the for-loop to complete the circle shape (I believe…). How can get all of …

---

## [Snake Game Code](https://discourse.processing.org/t/snake-game-code/1725)

<div class="topic-metadata">

**Author:** [@nofil7](https://discourse.processing.org/u/nofil7)\
**Replies:** 25\
**Last updated:** [December 9, 2022, 11:15am UTC](https://discourse.processing.org/t/snake-game-code/1725 "2022-12-09T11:15:14Z")

</div>

Snake Code assignment

---

## [Sort of a snake game problem with code](https://discourse.processing.org/t/sort-of-a-snake-game-problem-with-code/40076)

<div class="topic-metadata">

**Author:** [@taco1](https://discourse.processing.org/u/taco1)\
**Replies:** 4\
**Last updated:** [December 9, 2022, 8:33am UTC](https://discourse.processing.org/t/sort-of-a-snake-game-problem-with-code/40076 "2022-12-09T08:33:41Z")

</div>

Hello all, For school i have to make a kind of snake game. The game has the following rules: Rules of game: 1 player needs to make as many points before all particles of body dissapeared. game should be a field of 16…

---

## [Collision Detection Help / Once-over](https://discourse.processing.org/t/collision-detection-help-once-over/40059)

<div class="topic-metadata">

**Author:** [@moffmix](https://discourse.processing.org/u/moffmix)\
**Replies:** 2\
**Last updated:** [December 8, 2022, 6:52pm UTC](https://discourse.processing.org/t/collision-detection-help-once-over/40059 "2022-12-08T18:52:06Z")

</div>

Hi again! This is for a school assignment, but I was wondering if anyone could give my code a once-over for me / help me figure out the bug in the system. I’ve been following a wonderful tutorial by Long Nguyen (Tutorial…

---

## [HashMap Workaround](https://discourse.processing.org/t/hashmap-workaround/40018)

<div class="topic-metadata">

**Author:** [@moffmix](https://discourse.processing.org/u/moffmix)\
**Replies:** 5\
**Last updated:** [December 8, 2022, 4:48am UTC](https://discourse.processing.org/t/hashmap-workaround/40018 "2022-12-08T04:48:53Z")

</div>

Hello again! I’ve got another question for my Processing class. I found a great example in another forum on how to make a Choose Your Own Adventure game; I’m currently dissecting it and trying to make it my own, with the…

---

## [Using dist(); for collision detection](https://discourse.processing.org/t/using-dist-for-collision-detection/40050)

<div class="topic-metadata">

**Author:** [@LeckereKrokette](https://discourse.processing.org/u/LeckereKrokette)\
**Replies:** 6\
**Last updated:** [December 8, 2022, 2:12am UTC](https://discourse.processing.org/t/using-dist-for-collision-detection/40050 "2022-12-08T02:12:46Z")

</div>

Hello processing community. I want to make a mini game where you control a ellipse and have to avoid other ellipse. I first wanted the “opponents” to repel each other. For this I initialized 10 ellipses in an array. But …

---

## [Snake game: start screen and two players](https://discourse.processing.org/t/snake-game-start-screen-and-two-players/39962)

<div class="topic-metadata">

**Author:** [@ALAL](https://discourse.processing.org/u/ALAL)\
**Replies:** 10\
**Last updated:** [December 7, 2022, 1:06pm UTC](https://discourse.processing.org/t/snake-game-start-screen-and-two-players/39962 "2022-12-07T13:06:38Z")

</div>

Heyy!! this is my first time and I’m a beginner. I have questions about sank game in processing. I have an exam next week so I hoop to found someone to help me. my question is how can I make a home start en a another s…

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

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